git 在gitk中,为什么我的黄色按钮在master上面?

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

In gitk, why is my yellow button above master?

gitversion-controlgitk

提问by rick

I couldn't find any documentation on gitk about what the colors mean, but the problem here I think is that my yellow button has passed my master. Now when I try to do:

我在 gitk 上找不到任何关于颜色含义的文档,但我认为这里的问题是我的黄色按钮已经通过了我的主人。现在当我尝试做:

git push origin master

git push origin master

It doesn't work. How did my yellow button get over master and how do I get them back together so I can do push origin master?

它不起作用。我的黄色按钮是如何克服 master 的,我如何将它们重新组合在一起,以便我可以执行 push origin master?

回答by Bombe

Looks you need to put that commit back into the masterbranch (if it belongs there). Also it looks like you've detached HEAD because that commit is not a branch head. If all this is true, try the following:

看起来您需要将该提交放回master分支(如果它属于那里)。此外,您似乎已经分离了 HEAD,因为该提交不是分支负责人。如果所有这些都是真的,请尝试以下操作:

# git log -1

Remember the commit ID.

记住提交 ID。

# git checkout master
# git reset --hard <commit-id>

Now gitkwill show the yellow commit right next to the mastermarker and git pushwill be working again.

现在gitk将在master标记旁边显示黄色提交,git push并将再次工作。

As to how you got into that situation, the only thing I can imagine is that you used git resetto reset the masterbranch to a previous commit but have not changed the currently checked-out commit.

至于您是如何陷入这种情况的,我唯一能想象的是您曾经git resetmaster分支重置为先前的提交,但尚未更改当前签出的提交。