Note that you don't actually need a temporary branch, you can do this with a 'detached HEAD', but you need to take a note of the commit id generated by the git commit --amend step to supply to the git rebase command rather than using the temporary branch name.
- # create and check out a temporary branch at the location of the bad merge
- git checkout -b tmpfix <sha1-of-merge>
- # remove the incorrectly added file
- git rm somefile.orig
- # commit the amended merge
- git commit --amend
- # go back to the master branch
- git checkout master
- # replant the master branch onto the corrected merge
- git rebase tmpfix
- # delete the temporary branch
- git branch -d tmpfix
You need to login to post a comment.