相關資料:
http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/
http://stackoverflow.com/questions/881092/how-to-merge-a-specific-commit-in-git
以下爲正文
項目分支情況說明
cursor git:(911backup) ✗ git br
* 911backup
B9.0.1
B9.1.1
需求1:
想將分支
B9.0.1
中的兩個文件的改動,合併到當前分支,且其他文件不做任何改動
那麼使用
git checkout B9.0.1 specified_file's_absolute_path
如
適用情況
指定文件做了 N 次 commit,這 N 次 commit 中又有些不想提交的內容、或者不想那麼麻煩,合併那麼多次的 commit
需求2:
想將分支
B9.0.1
中某一次的 commit 合併到當前分支,且不合並其他 commit
那麼使用
git cherry-pick specified_commit_id
如:
適用情況
只想合併某一次 commit 或者某幾次 commit