Ignoring file changes with git

Here's a quick little post about one of the most useful tricks you can do with git. Often you have files you are working with in a project that you need to track the file for everyone on the project to have but not save your changes to the file itself. For example, project files in eclipse that change how the project uses the files. To have the file in the index but not save the changes, do the following.

  1. do a
    git add 
  2. do a
    git commit
  3. do a
    git update-index --assume-unchanged [FilePath]

Now the file you have told git that any changes you make to the file, it can ignore. There are a couple more notes you might want to know.

  • To stop ignoring changes to the file you can call git update-index --no-assume-unchanged
  • If someone else changes the file in a merge, even if they change it back, you'll have to tell git to ignore it again.
  • Egit, the eclipse git plugin, has this functionality under the advanced section of the team menu.
  • Rebasing always seems to require me to remind git to ignore changes.

This has been a great help for files at work. Actionscript project files like .actionscriptproperties, .project and a developer config file are important to have tracked but helpful to allow untracked changes.

Resolution 2013:Cooking With Joy - first update

Social Network Conundrum