Reputation: 2506
I learn git and I confused with this little problem. Here's the storyline
How I back to point 2 ? And how to prevent the same accident in the future?
Upvotes: 0
Views: 45
Reputation: 24194
By giving git checkout <branch-name>
you would be go top commit of that branch.
$ git checkout <branch-name>
Or, you can see all working tree history by git reflog
command
$ git reflog # copy the commit-hash you want to go
$ git checkout <copy-commmit-hash> # go to a specific commit
$ git checkout -b <branch-name> # create a new branch from that commit
Upvotes: 0
Reputation: 18129
You can git reset
your branch back to whatever commit you want it to point to. If you don't know what commit this is, find out using git reflog
to list the ones you have had checked out before.
Upvotes: 1