Squash my last X commits together using Git

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

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

30条回答
  •  面向向阳花
    2020-11-21 05:44

    Use git rebase -i and replace "pick" on the second and subsequent commits with "squash" or "fixup", as described in the manual.

    In this example, is either the SHA1 hash or the relative location from the HEAD of the current branch from which commits are analyzed for the rebase command. For example, if the user wishes to view 5 commits from the current HEAD in the past the command is git rebase -i HEAD~5.

提交回复
热议问题