git 如何解决 Eclipse 中的脏索引?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24285321/
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-10 18:12:25  来源:igfitidea点击:

How do I solve a dirty index in Eclipse?

eclipsegitgithubpull

提问by n00b1990

I have the following problem in eclipse:

我在 eclipse 中遇到以下问题:

enter image description here

在此处输入图片说明

How do I solve a dirty index?

如何解决脏索引?

回答by Sascha Wolf

The index is the place in git where you register the changes you want to include in your next commit (via git add).

索引是 git 中您注册要包含在下一次提交中的更改的地方(通过git add)。

If you have no changes recorded on your index at all, the index is considered clean, but if there are files added to the index, the index is considered dirty.

如果您的索引上根本没有记录任何更改,则该索引被认为是clean,但如果有文件添加到索引中,则该索引被认为是脏的

The same applys to your working tree (the checked out files from your repository). If you made changes to them, they are dirtyotherwise they are clean.

这同样适用于您的工作树(从您的存储库中检出的文件)。如果您对它们进行了更改,则它们是脏的,否则它们是干净的

To make your index clean you could do a resetto just remove the changes from the index but not from the working tree, to also remove them from the working tree you can use git stashvia the command line, or via the Git Repositoriesview in Eclipse.

为了使您的索引干净,您可以reset只从索引中删除更改而不是从工作树中删除,也可以从工作树中删除它们,您可以git stash通过命令行或通过Eclipse 中的Git 存储库视图使用它们。

Eclipse Git Stash

Eclipse Git 存储

When you stash changes they get saved just like a commit but you easily regain and delete stashes. You can consider them as some kind of cache. You can read more here.

当您存储更改时,它们就像提交一样被保存,但您可以轻松地重新获得和删除存储。您可以将它们视为某种缓存。您可以在此处阅读更多内容。

If you stashthe changes you can regain them by applying them back to the repository via the command line (git stash apply) or via EGit (see Stashed Commits).

如果您stash更改了更改,您可以通过命令行 ( git stash apply) 或通过 EGit(请参阅 Stashed Commits)将更改应用回存储库来重新获得它们。

回答by Mac

Stash your changes then pull your branch

隐藏你的更改然后拉你的分支

apply stashed changes once you pulled your branch

拉动分支后应用隐藏的更改