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"

相關文章
相關標籤/搜索