Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to go to previous commits in eclipse and egit

Tags:

git

eclipse

egit

I have a git android project managed in eclipse and some times i want to temporarily roll back my android project to a specific time and then build it and do stuff and then restore to the latest version. How is this possible?

like image 419
Mehdi Fanai Avatar asked Nov 25 '13 17:11

Mehdi Fanai


People also ask

How do you jump to a previous commit?

To jump back to a previous commit, first find the commit's hash using git log . This places you at commit 789abcd . You can now make new commits on top of this old commit without affecting the branch your head is on. Any changes can be made into a proper branch using either branch or checkout -b .


1 Answers

To check out an old state:

  1. Open the History view for the repository (Window > Show view > Other... > Team > History)
  2. Select the commit at the time you want
  3. Context menu > Checkout

When you want to go back, just select the commit where master is (or the branch you were working on before) and select Checkout again. Because there is a branch there, it will automatically check out the branch instead of the commit.

Note that you may also have to enable "Show All Branches and Tags" in the history to see master in the history view, see the section in the user guide about this.

like image 151
robinst Avatar answered Oct 10 '22 23:10

robinst