我在git存储库中有develop分支。
git log显示的内容类似于:
commit 111
Commit Last
commit 222
Commit Last-1
commit 333
Commit Last-2我想做的是:
1. Revert to #333
2. Create a branch Branch-111 which will contain #333 + #111
3. Create a branch Branch-222 which will contain #333 + #222这些新分支应该只从#333和指定的分支之一进行更改。
我试着创建两个补丁。但我不能在#333上应用它们--我有多个patch does not apply
解决此任务的正确方法是什么?
发布于 2018-10-19 23:49:55
git branch branch222 develop~1 # this branch can be kept as is
git checkout -b branch111 develop~2
git cherry-pick develop # apply 111 change
git branch -f develop develop~2 # take back develop 2 revisions这应该可以了。
发布于 2018-10-19 23:52:06
您可以处理的一种方法是:
git checkout -b Branch-111 <hash of "commit 111">
git rebase -i HEAD~~~
# delete line for "commit 222"
git checkout -b Branch-222 <hash of "commit 222">https://stackoverflow.com/questions/52895785
复制相似问题