The .gitignore
file prevents files from showing up as files to be added to the repository. If the file is already in the repo when it is added to the .gitignore
file, any changes to the file will be shown by git and can be committed. The .gitignore
settings only affect new files that are in the repos path. You would use this for keeping temp files created by you IDE or compile files from showing up and cluttering your list of files that you modified when you do git status
.
git update-index --assume-unchanged
doesn't show that a file was changed at all. If you make any modifications to the file, git won't show that it has been modified in git status
. You would use this with config files for users. When the repository gets cloned they need to have the file but there may be some changes that they need so that they can use the code (i.e. change a file path for their local machine). But you don't want them to accidentally commit the file and mess up things for others when they pull in the changes.
For changes to a config file, you want to use the git update-index
option. You want the config file in the repo but you don't want to commit the changes to it.