Reputation: 65
I accidentally moved a branch in GitX (drag&drop using the mouse) onto another branch. Now, both branch labels point at the same tip(!) and I cannot see the commits done on the moved branch.
Using git reflog
I wanted to see that change and undo it, but nothing got logged.
What is the recommended way (graphical or in terminal) to undo that move operation from GitX? Menu->Edit->Undo does not offer going back.
(Background: I thought that the move operation would also carry the commits, i.e., like a rebase, but it doesn't.)
Upvotes: 1
Views: 86
Reputation: 1436
My understanding: You had
A-B-C master
\D-E develop
You then accidentally moved develop on commit C (same as master).
You then get
A-B-C (master, develop)
\D-E
If you want to move branch "develop" back to "commitE", you should use the git branch command:
git branch -f <branch-name> <starting-point>
The command has to be used when your HEAD is on another branch. So in the example above, I would do:
git checkout master
So that my HEAD is located on branch "master", followed by
git branch -f develop commitE
This should switch you back to your initial state, i.e.
A-B-C master
\D-E develop
Upvotes: 0