Git Ignore-On-Commit

Git Ignore-On-Commit

Sergey Kuzmich bio photo By Sergey Kuzmich Comment

I used SVN & Tortoise SVN for years ago. There was one cool feature: ignore-on-commit.

Now I use Git to track projects & file changes. I’m pretty sure that Tortoise GIT has ignore-on-commit feature, but I prefer to use Git within Terminal. Anyway there is a legal way to do the same behavior.

  • git update-index --assume-unchaged <filename>
    makes file changes ‘invisible’ for git tree status;
  • git update-index --no-assume-unchaged <filename>
    unhides file from beeing ‘invisible’ for git;
  • git ls-files -v | grep '^h' | cut -c3-
    shows all ‘invisible’ files;

There is one more tip with it - use aliases. Put lines below to .gitconfig file.

Now commands at the begining is available the next way:

  • git hide <filename>
    makes file changes ‘invisible’ for git tree status;
  • git unhide <filename>
    unhides file from beeing ‘invisible’ for git;
  • git show-hidden
    shows all ‘invisible’ files;

That’s it!

comments powered by Disqus