Skip to content
Advertisement

Eclipse & E-Git: checking out old Github revisions for comparison – but can’t checkout/restore current HEAD revision

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:

enter image description here

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:

enter image description here

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:

enter image description here

Thank you for your time!

Advertisement

Answer

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.

Change which commits to show

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement