Dov
Dov

Reputation: 16166

How to exclude a file from git status

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.

Upvotes: 0

Views: 228

Answers (2)

Alex G.
Alex G.

Reputation: 949

You can temporarily ignore the file with the help of

git update-index --assume-unchanged <file>

Upvotes: 1

Paul Hicks
Paul Hicks

Reputation: 13999

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

Upvotes: 1

Related Questions