国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

git cherry-pick. 如何把已經提交的commit, 從一個分支放到另一個分支

2019-11-09 13:54:38
字體:
來源:轉載
供稿:網友

原文 http://sg552.iteye.com/blog/1300713

git cherry-pick. 如何把已經提交的commit, 從一個分支放到另一個分支

gitcherry-pick沖突合并 

實際問題:   在本地 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     # 這個 38361a68 號碼,位于:

 
$ git log 
commit 38361a68138140827b31b72f8bbfd88b3705d77a Author: Siwei Shen <siwei.shen@focusbeijing.com>Date:   Sat Dec 10 00:09:44 2011 +0800

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

就跟普通的沖突一樣,手工解決:2.1 $ git status    # 看哪些文件出現沖突

both modified:      app/models/user.rb 

2.2 $ vim app/models/user.rb  # 手動解決它。 2.3 $ git add app/models/user.rb2.4 git commit -c <新的commit號碼>

其他問題解決方案

If you receive an error of fatal: bad revision when trying to cherry-pick commits from a pull request in git you are PRobably missing a reference to upstream.

To cherry-pick commits in a pull request:

BASH CODE git checkout -b otherrepo-master mastergit remote add upstream git://github.com/otherrepo/whatever.gitgit fetch upstreamgit checkout master# find the hash on the pull requestgit cherry-pick abc0123git loggit branch -D otherrepo-mastergit push origin master


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 龙井市| 微山县| 陆良县| 南澳县| 柳江县| 正安县| 调兵山市| 芜湖市| 喀喇沁旗| 巴里| 平度市| 汨罗市| 乌兰县| 历史| 兰溪市| 小金县| 广西| 平定县| 长岭县| 镇巴县| 揭西县| 芦溪县| 苏尼特左旗| 昆山市| 隆回县| 张家港市| 三河市| 南靖县| 凭祥市| 灯塔市| 德昌县| 道真| 洛川县| 香港 | 恩施市| 黄浦区| 南昌市| 徐汇区| 杂多县| 诸城市| 定边县|