Revert merge Git-Flow -


i'm using sourcetree , git-flow pattern. have prepared release beta-testers test created new release/v1.0.1 branch. mind slipped , decided finish (merge develop , master , tag) release though haven't sent out release testers. have release branch open again if testers finds bugs can fix these bugs in release branch , when bugs fixed can finish release.

so how can sourcetree preferably (or using git commands) revert state when had release/v1.0.1 branch?

attached screendump sourcetree:

enter image description here

edit: okay did git reset --hard head~2 on develop (head~2) because had tested manually checking out. when checkout master , git reflog seems me should reset on head~6

peters-macbook-pro:remessage peterwarbo$ git reflog f7663b1 head@{0}: checkout: moving develop master 3d132da head@{1}: reset: moving head~2 2f1c753 head@{2}: checkout: moving master develop f7663b1 head@{3}: checkout: moving develop master 2f1c753 head@{4}: merge release/v1.0.1: merge made 'recursive' strategy. 4332fe4 head@{5}: checkout: moving master develop f7663b1 head@{6}: merge release/v1.0.1: merge made 'recursive' strategy. fe323ef head@{7}: checkout: moving release/v1.0.1 master 28a63ea head@{8}: commit: bumped version number 1.0.1 

but when "error":

peters-macbook-pro:project peterwarbo$ git reset --hard head~6 fatal: ambiguous argument 'head~6': unknown revision or path not in working tree. 

edit 2: new image illustrate fuckup.

enter image description here

edit 3: attached new image illustrate current state after issuing git commands in user1615903´s answer. why develop 2 behind? , why there merge release/v1.0.1 master though did reset master initial commit (fe323ef)?

enter image description here

this quite easy. things need are:

  • reset develop branch commit before merge

  • reset master branch commit before merge

  • have release branch point correct commit again

  • remove tag

  • push fixed commits remote

so steps 1 , 2:

git checkout develop git reset --hard 4332fe4  git checkout master git reset --hard <sha of commit master before merge> 

then "recreate" release branch:

git checkout -b "release/v1.0.1" 28a63ea 

and remove tag:

git tag -d v1.0.1 

more information undoing merge in this stackoverflow question

after that, if changes pushed, need use -f switch override changes in remote:

git push -f 

and delete tag remote:

git push --delete origin v1.0.1 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -