'How to undo git flow feature finish?
I am learning git-flow and I just did git flow feature finish <feature-name>, which merged my feature branch to develop and removed it.
Instead of this, I want to push the feature branch to github, so I can merge it after a peer review.
So the question is, how do I 'undo' this command. Or in other words , how can I move my last two commits from develop to my feature branch?
Solution 1:[1]
I found it easiest to just update master (we call it default) back to origin, with either
git checkout -B master origin/master
or the equivalent newer command
git switch -C master origin/master
checkout -B and switch -C (or --force-create) both move the branch to the new location if it already exists.
Update After thinking about it later, I half-considered deleting this, though it worked for me, because I suspect it might only work for the fast-forward case, rather than a regular merge. That also might explain why git reset --hard <SHA-from-reflog> didn't work for me and got me into a confused state, i.e., because I "reset" my local master rather than the feature branch head.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
