Remove duplicate commits introduced after bad rebase(s)

前端 未结 1 465
遇见更好的自我
遇见更好的自我 2021-01-11 12:08

I have 2 branches, master & feature. Master occasionally receives small tweaks that are needed to go live quickly. Once these tweaks are done,

1条回答
  •  有刺的猬
    2021-01-11 13:03

    To remove the duplicate commits you must go through the list generated by git rebase master -i and drop the duplicates by navigating up and down the list using the arrow keys pressing d on the commits you want to drop.

    (master can be replaced with a commmit hash or any valid re-base point)

    Once you have deleted all the duplicates and have a commit list that looks how you expect the history to look, exit the rebase screen by pressing esc and typing !wq and pressing enter.

    The re-base will then continue and apply the list of commits you picked onto your re-base point.

    0 讨论(0)
提交回复
热议问题