【发布时间】:2017-02-01 09:36:06
【问题描述】:
我想创建一个仅包含一个特定提交副本的新分支(即来自 master)。我该怎么做?
我最接近的是这样的:
git checkout --orphan NEWBRANCH
git rm -rf .
git commit "MESSAGE MESSAGE MESSAGE"
git cherry-pick -x <hash>
基本上,我想要上面没有“MESSAGE MESSAGE MESSAGE”提交。
cherry-pick 后出现错误:
$ git cherry-pick -x 68cc6733a14ec571c0abb0d4e77f53d93446f009
error: could not apply 68cc673... asdvasdflmdamfvla
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
【问题讨论】:
-
问题不清楚。您想创建一个以空存储库开始并选择单个提交的新分支吗?或者你想在一个特定的提交(包括它的所有历史)开始一个新的分支?还是别的什么?
-
在新分支中我只想要一个提交,没有历史记录。
标签: git