i accidentally committed unwanted file (filename.orig while resolving merge) repository several commits ago, without me noticing until now. want delete file repository history. possible rewrite change history such filename.orig never added repository in first place?
please don't use recipe if situation not 1 described in question. recipe fixing bad merge, , replaying commits onto fixed merge.
although filter-branch want, quite complex command , choose git rebase. it's personal preference. filter-branch can in single, more complex command, whereas rebase solution performing equivalent logical operations 1 step @ time.
try following recipe:
# create , check out temporary branch @ location of bad merge git checkout -b tmpfix <sha1-of-merge> # remove incorrectly added file git rm somefile.orig # commit amended merge git commit --amend # go master branch git checkout master # replant master branch onto corrected merge git rebase tmpfix # delete temporary branch git branch -d tmpfix (note don't need temporary branch, can 'detached head', need take note of commit id generated git commit --amend step supply git rebase command rather using temporary branch name.)
Comments
Post a Comment