Git: “Cannot 'squash' without a previous commit” error while rebase

前端 未结 7 685
逝去的感伤
逝去的感伤 2021-01-29 21:06

I have the following in the to-do text of git rebase -i HEAD~2:

pick 56bcce7 Closes #2774
pick e43ceba Lint.py: Replace deprecated link

# Rebase 68         


        
7条回答
  •  孤城傲影
    2021-01-29 21:47

    Squash with the reverse logic. You'll be able to select the desired commit message at the later step.

    • pick the first commit that you don't want the commit-message for.
    • squash or fixup the commit(s) that you want to merge, until the one that has the commit message that you actually wanted.
    pick 56bcce7 Closes #2774
    squash e43ceba Lint.py: Replace deprecated link
    
    • confirm the change (:x)
    • delete the commit message(s) that you don't want and leave only the message from the commit that you desire (in this case: Lint.py: Replace deprecated link).
    • confirm the choice (:x)

    Hope it's clearer for somebody ✌

提交回复
热议问题