In my working tree there's a directory with several modified files that I temporarily would like to not see when I do git status. But this should ideally be done without modifying the "state" of my working tree. How could I do this?
I looked at man git-status but couldn't see an option to exclude a specific directory.
Some workarounds:
git status | grep -v dir-to-exclude, but then I lose the pretty colours.git status dir-1 dir-2 dir-3 file-1 file-2git stash to temporarily store modifications in dir-to-exclude/, but that modifies my statedir-to-exclude/ to .gitignore, but that modifies the state of my working tree and I have remember to revert the change. It also does not work for modified version controlled files.git status, if one exists???If there's no ready made option for git status, then somehow using grep without losing the pretty colours is perhaps what I should be using.
Try this
git -c color.ui=always status | grep -v <dir-to-exclude>
See Colors in Git section here
Git fully supports colored terminal output, which greatly aids in visually parsing command output quickly and easily. A number of options can help you set the coloring to your preference.
color.ui
Git automatically colors most of its output, but there’s a master switch if you don’t like this behavior.
You can also set it to always to ignore the difference between terminals and pipes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With