The other day I ran into an interesting issue with a Git repository. We needed to have a file included in a repo so it would would get created but we didn’t want to track any of the changes (in this case it was a log file from a legacy application). Normally, if we want to ignore a file inside a repo we add it to a .gitignore file but that wouldn’t work in this case because that would completely ignore the file or track the changes after we’ve added it.

Git has a quick feature that takes the file and ignores any change to it:

git update-index --assume-unchanged path/to/file.txt

Like this post? Don't forget to follow us on Twitter and Facebook for updates.