git将多个commit合并成一个新的commit

问题:git

有如下commit:hash

    323uddit

    ede234方法

    6e7s6eco

要合并第一个和第二个commit交互

方法有二:commit

方法一

  使用git rebase -i hash-id,-i表示以交互模式进行commit合并,hash-id指代某个commit,如

  git rebase -i 6e7s6e  (这步操做会多出弹出交互窗口进行commit的设置)

方法二

  使用git reset --soft hash-id,以下操做:

  git reset --soft 6e7s6e

  git commit -m "merge 323udd and ede234"

相关文章
相关标签/搜索