Untrack files in Git

Untrack files in Git

Last updated:

There are at least 2 ways to untrack a file using git:

Remove file from git but keep local copy

Remove file from the repository but keep it in your working directory

$ git rm --cached your_filename

Make git not notice changes to a file

This will keep the file in the repository, but it won't commit changes to it. It will stay unchanged in the repository:

$ git update-index --assume-unchanged your_filename
  • to undo the previous command(tell git that you do want to keep track of changes for the file), there's the opposite command, --no-assume-unchanged

    $ git update-index --no-assume-unchanged your_filename
    

References