Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get git not to show untracked files

Tags:

git

When doing git commit, is there a way to not display the untracked files in my editor (defined in $EDITOR)? I know how to do so in the shell (git status -uno), but I'd like do it in editor as well.

Note that I do not want to ignore these files forever; I just don't want to see them on certain occasions.

like image 996
chiggsy Avatar asked May 05 '10 15:05

chiggsy


People also ask

Does git status show untracked files?

git status has the untracked-files switch where we select which files to see each time we execute git status . The mode parameter is used to specify the handling of untracked files. It is optional: it defaults to all, and if specified, it must be stuck to the option (e.g. -uno, but not -u no).

Why do I have untracked files in git?

Untracked files are those that are in the repo's directory but have not yet been added to the repo's index with git add .

How do I view untracked files?

If git only shows that the directory is untracked, then every file in it (including files in subdirectories) is untracked. If you have some ignored files in the directory, pass the -u flag when running git status (i.e., git status -u ) to show the status of individual untracked files.


1 Answers

If you don't ever want to commit them to your repo, use a .gitignore file to ignore them. More details can be found on the gitignore man page. They won't show up as untracked files when entering your commit message in your $EDITOR.

If you simply don't want to see them when committing in any repo, set the Git config variable status.showUntrackedFiles to no, as noted here:

$ git config --global status.showUntrackedFiles no 

For applying this to a single repo, instead use:

$ git config --local status.showUntrackedFiles no 
like image 189
mipadi Avatar answered Sep 19 '22 08:09

mipadi