The Cook
The Cook

Reputation: 1443

How to return back to unpushed commits after returning back to an earlier commit

I commited my code, but did not push it. Let's call this commit #5 Later I needed to try an earlier version. So I checkout commit #3. Now I want to get back to my commit #5. How do I find out its commit id, and return to it?

Tried -git log, but it only shows commits from #3 to #1.

Upvotes: 2

Views: 552

Answers (1)

lake
lake

Reputation: 112

You can use this method to make HEAD re-point to commit #5, just run this command:

git checkout branch_name

After that, refer to lvan's comment to run this command to the see log:

git log --oneline --decorate --graph --all

You will find it will move the head to the latest commit #5

Upvotes: 1

Related Questions