Squash my last X commits together using Git

前端 未结 30 3386
醉酒成梦
醉酒成梦 2020-11-21 05:17

How can I squash my last X commits together into one commit using Git?

30条回答
  •  一向
    一向 (楼主)
    2020-11-21 05:46

    If for example, you want to squash the last 3 commits to a single commit in a branch (remote repository) in for example: https://bitbucket.org

    What I did is

    1. git reset --soft HEAD~3
    2. git commit
    3. git push origin --force

提交回复
热议问题