0

Is there a way in git to filter git status by not showing ignored files/folders I have gone through the documentation for .gitignore. I dint find any solution for this. I added few files and directories in .git/info/exclude file in order not to commit those files. (.pyc files, .class files etc) However when I execute following command I can see which files are ignored.

git status --ignored  

How ever I am searching for command that is exactly opposite to above command something pseudo like this:

git status --showNotIgnoredFilesOnly

Is there a way in GIT to filter as mentioned above?

Tunaki
  • 116,530
  • 39
  • 281
  • 370
Venkatesh
  • 2,788
  • 7
  • 25
  • 34
  • `git status` omits ignored files by default. Could you please [add steps to reproduce your issue](http://meta.stackexchange.com/questions/22754/sscce-how-to-provide-examples-for-programming-questions)? – Chris Jul 07 '14 at 23:15
  • @Chris : It generally ignores files that are mentioned in git exlude. I mentioned *.pyc to be ignored in exclude file. But .pyc accidentally pushed to GIT through another account. So when I do git pull, I can see .pyc files also. When I execute any .py file, it generates .pyc which GIT considers as modified file and will be shown in git status – Venkatesh Jul 07 '14 at 23:44
  • 1
    Then those files aren't ignored, they're tracked. You should remove them from the repository using `git rm --cached ` and commit, then push that commit to your shared repository. – Chris Jul 07 '14 at 23:55
  • 1
    Note also that you probably want to ignore `.pyc` files using a tracked `.gitignore` file so that they are ignored in all copies of the repository. It sounds like you might be using `.git/info/exclude`, which is not versioned or shared. – Chris Jul 08 '14 at 00:00

1 Answers1

0

If files to be ignored are maintained in .git/info/exclude which is not versioned or shared then git status will show the files modified by another account even though its not of your interest.

I had an issue with .pyc files that is shown in git status list. Even though I added line *.pyc to be ignored in .git/info/exclude, since .pyc files are already present in the repository git takes .pyc as modified and will be shown in git status list

So ideal way of doing is to maintain the exclude list in .gitignore and to be shared with all users.

Venkatesh
  • 2,788
  • 7
  • 25
  • 34