Git: Undo a merge solution


# you are on the dev branch
git checkout master
git merge dev 
# here you've merged the dev branch into master but actually you wanted to perform a --no-ff merge
git reset --hard origin/master to undo the above merge: reset the master branch to the pre-merge state
git merge --no-ff -m 'my custom merge message' dev # now you can perform the merge you actually wanted

To undo an already pushed merge, you have to "git reset --hard 'the preceding commit ID of your last push to the master branch'" and repush the newly created commit using the -f flag.

Comments

Popular posts from this blog

Tuning ext4 for performance with emphasis on SSD usage

NetBeans 6.1: Working with Google´s Android SDK, Groovy and Grails