git cherry-pick和git rebase的混合用法

悶蛋的編程話題,陰功。

  之前在 git 上遇過一個問題
A-B  master
   \
    C-D-E-F-G topic

  問題是,我只想把 D,F 加到 master ,其他的留在 topic ,而且又不想把 history 搞得很亂,最好就變成這個樣子:
A-B-D-F  master
       \
        C-E-G topic

  有甚麼好的作法?

  原來答案相當簡單。
$ git checkout master
$ git cherry-pick D
$ git cherry-pick F
$ git checkout topic
$ git rebase master

  就這樣。



转自: http://blog.luzi82.com/2010/08/git-cherry-pick-rebase.html

你可能感兴趣的:(git,2010)