Git cherry-从合并提交中选择一个文件并保留作者身份

时间:2017-08-07 20:10:21

标签: git github

虽然我能够从提交中挑选一个特定文件,但是在git reset之后无法保留原始提交消息。

#cherry-pick a merge commit
git cherry-pick -x -s --edit -m 2 <SHA>

#remove unwanted staged changes
git reset HEAD

#add back the file
git add <file I want to pick on>

#try to continue, but cherry-pick was canceled by reset
#git cherry-pick --continue

#manually add back the commit message and author info
git commit

是否有保留原始信息和作者身份?

0 个答案:

没有答案