0

Most hg commands allow you to pass a -Xfilename argument to exclude a file that doesn't belong on your ignore list. Is there a way to do this with git?

I've got a script that's checking if there are any changes to the working copy, using git status, but I'd like it to exclude changes to itself.

Dov
  • 15,530
  • 13
  • 76
  • 177
  • Possible duplicate of [Stop tracking and ignore changes to a file in Git](http://stackoverflow.com/questions/936249/stop-tracking-and-ignore-changes-to-a-file-in-git) – Alister Bulman Mar 22 '16 at 21:46
  • @AlisterBulman I don't really want to stop tracking the changes to the file. I just wanted to exclude it from the single invocation of `git status`. – Dov Mar 23 '16 at 13:46

2 Answers2

1

No. But if you're doing this in a script, then you can pipe git status to grep -v or similar.

Paul Hicks
  • 13,289
  • 5
  • 51
  • 78
1

You can temporarily ignore the file with the help of

git update-index --assume-unchanged <file>
Alex G.
  • 909
  • 1
  • 9
  • 16