How do you fix a bad merge, and replay your good commits onto a fixed merge?

后端 未结 12 929
时光取名叫无心
时光取名叫无心 2020-11-21 10:25

I accidentally committed an unwanted file (filename.orig while resolving a merge) to my repository several commits ago, without me noticing it until now. I want

12条回答
  •  囚心锁ツ
    2020-11-21 10:31

    Definitely, git filter-branch is the way to go.

    Sadly, this will not suffice to completely remove filename.orig from your repo, as it can be still be referenced by tags, reflog entries, remotes and so on.

    I recommend removing all these references as well, and then calling the garbage collector. You can use the git forget-blob script from this website to do all this in one step.

    git forget-blob filename.orig

提交回复
热议问题