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

前端 未结 7 583
逝去的感伤
逝去的感伤 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:49

    I just tried this approach.

    git log -n3

    This would show the last 3 commits which would give me the idea of what is the latest commit and which one went previously. Now stated rebasing,

    git rebase -i HEAD~3

    Choose the lastest commit on top of which we need to squash the other two. The commit id which is choosen as base commit would be like,

    pick commit_id

    For the other two commit ids, change them into,

    squash commit_id

    or simply,

    s commit_id

提交回复
热议问题