/ Published in: Bash

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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# 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
URL: http://stackoverflow.com/questions/307828/git-remove-file-accidentally-added-to-the-repository
Comments
