02/12/2014 - GIT
You have done some changes to a file and it is listed as "tracked" file but you never want to commit it. You simply want to avoid it being indexed with git add
command. For this purpose, we use git update-index --assume-unchanged
command. For more information, click git update-index link.
inanzzz@inanzzz:~/project$ git status
On branch develop
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: another_file.html
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: index.html.twig
Untracked files:
(use "git add <file>..." to include in what will be committed)
new_file.txt
We want to update directory cache so that "index.html.twig" is removed from working tree.
inanzzz@inanzzz:~/project$ git update-index --assume-unchanged index.html.twig
As we can see "index.html.twig" is not tracked anymore.
inanzzz@inanzzz:~/project$ git status
On branch develop
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: another_file.html
Untracked files:
(use "git add <file>..." to include in what will be committed)
new_file.txt
You've changed your mind and want to track the file again.
inanzzz@inanzzz:~/project$ git update-index --no-assume-unchanged index.html.twig
inanzzz@inanzzz:~/project$ git status
On branch develop
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: another_file.html
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: index.html.twig
Untracked files:
(use "git add <file>..." to include in what will be committed)
new_file.txt