Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 231
hakunin Avatar asked Nov 19 '12 08:11

hakunin


1 Answers

These steps should do the trick:

Get the sha's needed:

git log

<sha1> is the commit right before the merge
<sha2> is the last commit on develop before you started working on the feature

git checkout develop
git checkout -b feature/<feature-name>
git reset <sha1> --hard
git checkout develop
git reset <sha2> --hard

Push your feature branch.

like image 155
Peter van der Does Avatar answered Oct 21 '22 22:10

Peter van der Does