Git - Temporarily ignore trivial changes to files Git - Temporarily ignore trivial changes to files git git

Git - Temporarily ignore trivial changes to files


In my use case (developing using an edited config file on my personal machine, running on another machine with the unchanged config), this was the solution for me:

start ignoring changes to a file:

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

keep tracking again:

git update-index --no-assume-unchanged path/to/file


Just don't add the trivial changes.

It's good practice to carefully review the things that you add before committing.

You can even ignore some changes in a file while adding others, using

git add -p.

This is even easier if you use gitx (R).


Keep your changes that are not ready in a separate branch. git rebase this branch atop new changes in the main history as necessary.

Be it development in progress, temporary things, even things that are never to be included in the main project history -- the same process works equally well.

If/when the changes of the branch are ready to be included in the main history; merge it in. If not, keep them in the separate branch and continue rebasing.

(side note: git merge --no-ff may be of use to create a merge-commit even if a fast-forward merge is possible -- depending on the rules of your project, this may be preferable)