git, don't show me *.pyc in the list of untracked files! git, don't show me *.pyc in the list of untracked files! git git

git, don't show me *.pyc in the list of untracked files!


As mentioned in gitignore, git has 3 ignore files:

  • Patterns which should be version-controlled and distributed to other repositories via clone (i.e., files that all developers will want to ignore) should go into a .gitignore file.

(that takes care of all time: if one clones your repo, it will get the .gitignore file)

  • Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user's workflow) should go into the $GIT_DIR/info/exclude file.

(not interesting in your case)

  • Patterns which a user wants git to ignore in all situations (e.g., backup or temporary files generated by the user's editor of choice) generally go into a file specified by core.excludesfile in the user's ~/.gitconfig.

(takes cares of all projects, but not all time since it is not replicated when one clones your repo.)

"All time for all projects" would means for instance a custom shell for creating new git projects, with a custom .gitignore as first file part of the first commit...


Put in the file ~/.gitignore:

*.pyc

Run:

git config --global core.excludesfile ~/.gitignore

I agree with @David Wolever this option should be used with caution if ever.

The ~/.gitignore ("%HOME%\.gitignore" on Windows) is just a convention you can use any filename you like e.g., "c:\docs\gitignore.txt".


git config --global core.excludesfile "c:\program files\whatever\global_ignore.txt"

Then, add

*.foo

to that file.