stackers
stackers

Reputation: 3289

How do I tell git to stop showing a file in git status until it's modified again?

Sometimes I go into files and just clean up a little, removing uneeded spaces and whatnot. Then of course since the file is changed, when I run git status it shows up in the list:

Changes not staged for commit:
modified:   myfile.js

Is there a way to get git to stop thinking there's been a change, at least until I change it again (in case I make important changes)?

Upvotes: 1

Views: 37

Answers (2)

user3188445
user3188445

Reputation: 4792

The answer to your question is no.

Git status is comparing three things: Your working tree, the index, and HEAD. If you want your working tree to differ from HEAD, then there are three possibilities: the index can be the same as the working tree (changes staged for commit), the index can be the same as HEAD (changes not staged for commit), or the index can be neither (in which case you have some changes that are staged for commit and some that aren't).

So I don't think what you want can be done, short of post-processing the output of git-status or temporarily manipulating HEAD to something that is never intended to be part of history.

Upvotes: 2

Rishabh Agarwal
Rishabh Agarwal

Reputation: 2172

Could not find anything for git status, however for git diff you can use:

git diff --ignore-space-at-eol -b -w --ignore-blank-lines 

Hope it helps.

Upvotes: 0

Related Questions