git,不要在未跟踪的文件列表中显示* .pyc! [英] git, don't show me *.pyc in the list of untracked files!

查看:882
本文介绍了git,不要在未跟踪的文件列表中显示* .pyc!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在做:

 > git status 

它显示未跟踪文件下的大型.pyc文件列表。我不希望它显示这些,因为它增加了噪音。



换句话说,我该如何让git忽略.pyc文件以及所有项目?



编辑



我并没有要求传播我的方式忽略文件给其他人,我真的只是说对于所有项目,这意味着我不想配置每个新项目来忽略.pyc文件。



UPDATE



我应该补充一点,我正在使用Windows,而我的git是 msysgit


用户希望git在所有情况下都可以忽略的模式(例如,用户选择的编辑器生成的备份或临时文件)通常会进入由用户的〜/ .gitconfig中的core.excludesfile指定的文件。


是.gitconfig文件还是文件夹?我的家目录中没有这样的东西( C:\ users \< myusername> \



UPDATE2



感谢大家的回应,

我使用以下方法解决了这些问题:

 > git config --global core.excludesfile c:\ git \ignore_files.txt 

并将* .pyc放入 c:\ git \ignore_files中。 txt

解决方案

  git config --global core.excludesfile c:\程序文件\whatever\global_ignore.txt

然后, p>

  *。foo 

到该文件。


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.

这篇关于git,不要在未跟踪的文件列表中显示* .pyc!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆