Reputation: 583
I've took up git for some minor testing project of mine and tried to revert several revisions. Now I've done something, no idea what exactly, and I can't do anything with it. To avoid my noobish attempts of explaining this I've got a snipshot of the issue, so if anyone can PLEASE explain what I've done here and how to best get myself out of the issue.
To note: I've been trying to revert changes to revision that is now marked as HEAD.
Upvotes: 0
Views: 177
Reputation: 559
What you baiscally have done is detached head. back to commit 'structure refactoring'.
The HEAD is where you are currently point in the brnach. The head can move forward and backward. It's hard to understand what exactly you are trying to achieve but if you are willing to go back to 'structure refactoring' and continue from there:
From command line:
run git log. this will show you all commits history. copy the commit hash of 'structure refactoring'. i.e
commit d47ad1b23fb7ebcfaee36918b8ff0b68f1a3bebf
run git reset --hard . this will point your head back to 'structure refactoring', where commit hash is the one you just copied above (d47ad1b23fb7ebcfaee36918b8ff0b68f1a3bebf in my case).
in sourceTree:
note: this will remove 'revert123' and 'test123' completely. if you want to keep the changes choose using mode 'soft'
Upvotes: 1
Reputation: 86
You have a detached head
. There are many way how you can get here so it's a bit hard to say. Most likely you've checked out a specific commit. This happens if you double click on the commit.
I guess all you need to do is checkout your branch again. Try right-clicking on master branch and selecting checkout.
If you prefer from the terminal:
git checkout master
Upvotes: 1