如何使用 git-gui (tcl-tk) 应用程序忽略文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22046808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:46:53  来源:igfitidea点击:

How to ignore files using git-gui (tcl-tk) application?

gitgitignoregit-gui

提问by édouard Lopez

I'm using the git-guiinterface to manage my gitproject. Despite being ugly –tcl-tk– it's one of the most complete interface out there.

我正在使用该git-gui界面来管理我的git项目。尽管很丑 - tcl-tk- 它是最完整的界面之一。

However, I can't find how to ignore files from this interface ?

但是,我找不到如何从该界面忽略文件?

enter image description here

在此处输入图片说明

回答by Daniel Schmidt

the pragmatic way is, to add this to your gitconfiguration:

实用的方法是,将其添加到您的git配置中:

git config --global guitool."Add to .gitignore".cmd $'echo "\n$FILENAME" >> .gitignore & git add .gitignore'
git config --global guitool."Add to .gitignore".needsfile yes
git config --global guitool."Add to .gitignore".confirm yes

Usage

用法

After that, you can use it under Tools > Ignore selected filein your git gui. Select a file you want to ignore under Unstaged Changes -> Tools/ignore selected file

之后,您可以Tools > Ignore selected file在您的git gui. 在下面选择要忽略的文件Unstaged Changes -> Tools/ignore selected file

Ignore file with git-gui

使用 git-gui 忽略文件

回答by Dan Hoerst

If you mean ignore them forever, then add a .gitignorefile in the root of your directory (where the .gitfolder is). List the files or file types separated by a new line like so:

如果您的意思是永远忽略它们,请.gitignore在您的目录(.git文件夹所在的位置)的根目录中添加一个文件。列出由新行分隔的文件或文件类型,如下所示:

*.pyc
venv
.metadata

If you mean ignoring it temporarily, you can do the .gitignorestep or just stage the files you want to commit individually.

如果您的意思是暂时忽略它,您可以执行该.gitignore步骤或仅暂存您要单独提交的文件。

回答by Abby Fichtner

If you set it in your .gitconfig file, the GUI will comply.

如果您在 .gitconfig 文件中设置它,GUI 将遵守。

Add this to your .gitconfig(should be located under c:\users\USERNAME)

将此添加到您的.gitconfig(应位于 c:\users\USERNAME 下)

[core]
    excludesfile = ~/.gitignore

Then create a file c:\users\USERNAME\.gitignore

然后创建一个文件 c:\users\USERNAME\.gitignore

and add the ignore files to that.

并将忽略文件添加到其中。

回答by David Nguyen

You can try to add all the files first. After that go to git gui, choose those files you want to ignore in "Staged Changes" and press Ctrl-U.

您可以尝试先添加所有文件。之后转到 git gui,在“暂存更改”中选择要忽略的文件,然后按 Ctrl-U。