git cherry-pick简介
生活随笔
收集整理的這篇文章主要介紹了
git cherry-pick简介
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
轉載: http://blog.csdn.net/hudashi/article/details/7669462
?
git cherry-pick用于把另一個本地分支的commit修改應用到當前分支。 實際問題? ??? 在本地?master?分支上做了一個commit?(?38361a68138140827b31b72f8bbfd88b3705d77a?) , 如何把它放到 本地 old_cc 分支上?? 辦法之一: 使用?cherry-pick. ?根據git 文檔: Apply the changes introduced by some existing commits? 就是對已經存在的commit 進行apply (可以理解為再次提交) 簡單用法: git cherry-pick <commit id> 例如: $ git checkout old_cc $?git?cherry-pick?38361a68 1.?如果順利,就會正常提交。結果: Finished one cherry-pick. # On branch old_cc # Your branch is ahead of 'origin/old_cc' by 3 commits. 2. 如果在cherry-pick 的過程中出現了沖突 Automatic cherry-pick failed. ?After resolving the conflicts, mark the corrected paths with 'git add <paths>' or 'git rm <paths>' and commit the result with:?? ? ? ? git commit -c 15a2b6c61927e5aed6718de89ad9dafba939a90b
就跟普通的沖突一樣,手工解決: 執行git status 看哪些文件出現沖突 $ git status? both modified: ? ? ?app/models/user.rb? 接著手動解決沖突的文件,然后通過git add把改到添加到索引,最后執行git commit提交修改。 $ vim app/models/user.rb ?? $ git add app/models/user.rb git commit -c <原commit號>
總結
以上是生活随笔為你收集整理的git cherry-pick简介的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: flash _currentframe+
- 下一篇: (NO.00005)iOS实现炸弹人游戏