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.
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).
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 .
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.
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
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