Take the 2-minute tour ×

Is there a way to , when doing

git commit 

to not display the untracked files in my $EDITOR?

I know how to do so in the shell, using git status -u no, but I'd like do it in $EDITOR as well

EDIT: I should have stated, I do not want to ignore these files forever, just not see them on certain occasions...

share|improve this question

4 Answers 4

up vote 9 down vote accepted

From the git-commit man page:

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

           files. The possible options are:

           ·   no - Show no untracked files

           ·   normal - Shows untracked files and directories

           ·   all - Also shows individual files in untracked directories.

               when the option is not specified.
share|improve this answer
Thanks, that works. –  chiggsy May 5 '10 at 15:18
Great thing about git is they're really trying to keep command line options consistent between commands with similar functionality. –  jcordasc May 5 '10 at 15:20
Do you know if there is a way to change the setting permanently, but independently for the status and commit commands? I want to see them with status, but not for commit, but git-config(1) shows only the option status.showUntrackedFiles which effects both commands. –  Philipp Wendler Feb 9 '13 at 11:21

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, set the Git config variable status.showUntrackedFiles to no, as noted here:

$ git config --global status.showUntrackedFiles no
share|improve this answer
Hmm, this is an interesting thing to know. Thanks –  chiggsy May 5 '10 at 15:36

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 :


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

share|improve this answer

Add the file names - or templates (wild cards) for the file names - to the .gitignore file and add that to the repository:

git add .gitignore
git commit -m 'Added .gitignore file'

For example, for my Go repository, I have a .gitignore file containing:


I should probably compress the '_cgo_' names with a wild card; the other '.c' file is generated from a '.ec' file so it does not need to be tracked.

share|improve this answer

Your Answer


