相关资料:
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