git, don't show me *.pyc in the list of untracked files!
When doing:
>git status
It shows a big list of .pyc files under "untracked files". I don't want it to show these, as it adds noise.
In other words, how do I make git ignore .pyc files all the time and for all projects?
EDIT
I'm not asking for a way to spread my ignored files to other people, I really just mean "for all projects", meaning I don't want to configure each new project to ignore .pyc files.
UPDATE
I should add that I'm working on windows, and my git is msysgit
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.
Is .gitconfig a file or a folder? I don't have such a thing in my home directory (C:\users\<myusername>\
)
UPDATE2
Thanks everybody for the responses,
I solved the issues by using:
>git config --global core.excludesfile c:\git\ignore_files.txt
and putting *.pyc in c:\git\ignore_files.txt
git config --global core.excludesfile "c:\program files\whatever\global_ignore.txt"
Then, add
*.foo
to that file.
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 theuser'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"
.
Another way to ignore some file patterns is: add *.pyc to .git/info/excludes, this is a much cleaner way.
add
*.pyc
in .gitignore file
and run this
git config --global core.excludesfile .gitignore
which worked for me
If I recall, there is a way to setup a global .gitignore... But the problem with that is you can't share it with other people (that is, other people who pull your code will see the .pyc files).
So, IMHO, it's better to just add it to the .gitignore for each project you start. I keep a stock .gitignore around for just that reason.
<flamebait>
Or you could switch to bzr, which comes with a sensible default list of things to ignore ^_^
</flamebait>
Couldn't you add
*.pyc
to your .gitignore?
참고URL : https://stackoverflow.com/questions/640449/git-dont-show-me-pyc-in-the-list-of-untracked-files
'programing' 카테고리의 다른 글
.NET Framework 4.0의 TLS 1.2 (0) | 2020.11.29 |
---|---|
사용자 상태 FORCE_CHANGE_PASSWORD를 변경하는 방법은 무엇입니까? (0) | 2020.11.29 |
순수 C / C ++ (cout / printf)에서 진행률 표시기를 표시하는 방법은 무엇입니까? (0) | 2020.11.29 |
VideoToolbox를 사용하여 H.264 비디오 스트림의 압축을 푸는 방법 (0) | 2020.11.29 |
Google API : 클라이언트의 유효한 출처가 아닙니다. URL이 클라이언트 ID 'ID'에 허용되지 않았습니다. (0) | 2020.11.29 |