Subrata Sarkar

Untrack file or directory from Git repository

To untrack a file or directory from your Git repository without deleting it physically follow the following steps. The example should work on any operating system as long as you have access to is terminal window or command prompt in order to enter the commands.

  1. Open the Terminal Window (Linux) or Command Prompt / Powershell (Windows)
  2. Move inside your working directory
  3. To untrack a file, type in the following command in the terminal and hit <Enter>$ git rm –cached <file-name>
  4. To untrack a directory, type in the folowing command in the termal and hit <Enter>$ git rm –cached -r <directory-name>

That’s it!

Leave a Reply

Your email address will not be published.