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

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

问题描述

做的时候:

>git status

它在未跟踪的文件"下显示了一个很大的 .pyc 文件列表.我不希望它显示这些,因为它会增加噪音.

It shows a big list of .pyc files under "untracked files". I don't want it to show these, as it adds noise.

换句话说,我如何让 git 一直忽略所有项目的 .pyc 文件?

In other words, how do I make git ignore .pyc files all the time and for all projects?

编辑

我不是在寻求一种将我忽略的文件传播给其他人的方法,我的意思只是对于所有项目",这意味着我不想将每个新项目配置为忽略 .pyc 文件.

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.

更新

我应该补充一点,我在 Windows 上工作,我的 git 是 msysgit

I should add that I'm working on windows, and my git is msysgit

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

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.

.gitconfig 是文件还是文件夹?我的主目录中没有这样的东西 (C:users)

Is .gitconfig a file or a folder? I don't have such a thing in my home directory (C:users<myusername>)

更新2

谢谢大家的回复,

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

I solved the issues by using:

>git config --global core.excludesfile c:gitignore_files.txt

并将 *.pyc 放入 c:gitignore_files.txt

and putting *.pyc in c:gitignore_files.txt

推荐答案

git config --global core.excludesfile "c:program fileswhateverglobal_ignore.txt"

然后,添加

*.foo

到那个文件.

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

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