Get git not to show untracked files

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

You can temporary use the git commit option -uno to mask untracked files (git help commit).

If you want a permanent solution use the .gitignore file.

For instance, if you want to ignore the file bar.foo and any file with the .bak extension, you juste have to create a .gitignore file in the root directory of your project containing :

bar.foo
*.bak

Some file are ignored by a global gitignore file (for instance, dot file and directory are ignored).


From the git-commit man page:

       -u[], --untracked-files[=]
           Show untracked files (Default: all).

           The mode parameter is optional, and is used to specify the handling of untracked
           files. The possible options are:

           ·   no - Show no untracked files

           ·   normal - Shows untracked files and directories

           ·   all - Also shows individual files in untracked directories.

               See git-config(1) for configuration variable used to change the default for
               when the option is not specified.

Tags:

Git