日食与E-Git:查看旧的 Github 修订版进行比较 - 但无法查看/恢复当前的 HEAD 修订版
我一直有一个关于检查旧 Git 修订版的问题。 Eclipse 中有一个功能,您可以通过“团队版本控制历史记录”视图查看“Git 历史记录”并查看所有提交。如果右键单击旧版本,则可以单击上下文菜单中的“签出”将项目恢复到该版本。这对于查看特定错误从哪里开始非常有帮助,因为有时这些错误可能是数十万行长的项目中的一行。
问题是,当我检查这些旧版本时,一旦我完成了范围确定,我无法通过 Eclipse UI 完全弄清楚如何将我的项目恢复到主 HEAD 版本,或者一般较新的版本。老的。
特别是,我在 Eclipse 中打开 git 历史记录视图并查看了 4 天前的版本。但是,我想回到最新的修订版,而历史记录似乎停在我查看的当前修订版上,我无法超越它。我已经尝试了多种方法,但通常最终只会使项目更加混乱,我最终放弃 - 删除项目 - 并重新克隆它。至少可以说这是乏味的。
对于某些上下文,这里有一个问题,涉及此恢复过程如何工作。不幸的是,这篇特定帖子的答案说,当您完成恢复后,只需再次检查最新版本,但正如我将在下面解释的那样,它隐藏了我检查后的修订版本out:
如何让它显示修订在我当前已签出的那个之后?至少可以说这有点令人沮丧。您可以在这里看到,此修订版上方没有显示任何内容:
编辑:再次重新克隆后,以下是当前版本为 HEAD 修订版时的样子。我在发表这篇文章时检查过的旧选项上方的选项消失了:
最后,为了提供更多帮助,这里有一个 git 历史菜单/上下文菜单的屏幕截图向您展示到底是什么我正在谈论的功能:
感谢您的宝贵时间!
I have a longtime question here about checking out old Git revisions. There's a feature in Eclipse where you can view your "Git History" via the Team Version Control History view and see all of your commits. If you right-click old revisions, you can click "Checkout" in the context menu to revert your project to that version. It's extremely helpful for seeing where a specific bug began, since sometimes these bugs can be a single line in a project that's hundreds of thousands of lines long.
The problem is that, when I check out these old versions, I can't quite figure out through the Eclipse UI how to revert my project back to the main HEAD version, or newer versions in general, once I've finished scoping out an old one.
In particular, I opened the git history view in Eclipse and checked out a version from 4 days ago. However, I want to go back to the latest revision, and the history seems to stop at the current one I have checked out and I can't go above it. I've tried multiple things but it usually just ends up screwing up the project more, and I eventually give up - delete the project - and re-clone it. Which is tedious to say the least.
For some context, here is a question that goes over how this reversion process works. Unfortunately the answer to this specific post says to simply check-out the latest revision again when you're done to revert, but as I'll explain below, it hides the revisions after the one I checked out, after I've checked it out:
How to go to previous commits in eclipse and egit
How do I get it to show the revisions after the one I currently have checked out? This is a bit frustrating to say the least. You can see here, nothing is showing above this revision:
EDIT: After re-cloning again, here's what it looks like when the current version is the HEAD revision. The options above the old one I had checked out when I made this post disappeared:
And lastly, just to help out a bit more, here's a screenshot of the git history menu/context menu to show you exactly what functionality I'm talking about:
Thank you for your time!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在历史视图右上角的工具栏中,有一个下拉按钮可以控制要显示的提交。它看起来像一个分成两部分的淡蓝色向下箭头。默认情况下,它设置为仅显示当前 HEAD 的祖先,但您可以选择其他过滤器。您想要的可能是 refs/heads/** 它将显示所有本地分支。
In the toolbar at the top-right of the history view, there’s a dropdown button to control which commits to show. It’s the one that looks like a pale blue downward arrow splitting into two. By default it’s set to show only ancestors of the current HEAD, but you can select additional filters. The one you want is probably
refs/heads/**
which will show all local branches.