Reputation: 4159
Here is the context:
I am using egit within Eclipse
I made a number of commits that I have not pushed to the remote repository
I suddenly notice a bug with my app that wasn't there before
How can I quickly update my working directory with earlier git commits until I find the first commit that introduced the bug? How do I then get back to my latest local commit?
I used hard git resets to do this recently and would have lost my last set of git commits if I hadn't found this answer so there must be another, safer way to achieve the same result.
Upvotes: 2
Views: 198
Reputation: 4159
I just figured out the answer to my own question.
It's actually quite simple:
Do git checkout of earlier versions until identifying the last version that does not exhibit the bug and the first one that does
Then do a git switch to the master version to go back to the latest committed version
The checkouts are not intended to make further changes to the code but are quick and useful for updating the working directory without messing with the git directory, which is all what's needed to quickly pin-point the appearance of a new bug in the git tree.
Upvotes: 1
Reputation: 1324505
I am running into a bug in my latest version of the code and want to go back in time until the bug no longer shows up.
That is called git bisect
, and is not implemented in Egit.
You should consider using git in command-line, in order to launch a bisect session.
Upvotes: 1