Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git跳过提交_Git - Fatal编程技术网

git跳过提交

git跳过提交,git,Git,我在git中有一个分支,看起来像这样 A-B-C-D-E A-B-D-E-F-G 还有一根看起来像这样的树枝 A-B-F-G 我想做一根这样的树枝 A-B-C-D-E A-B-D-E-F-G 我想可能会涉及到标记,但我对git还是比较陌生的 您可能希望创建一个新分支,从提交B开始,然后在新分支上选择您感兴趣的特定提交 git checkout my-branch <B-commit-id> git cherry-pick <D-commit-id> git c

我在git中有一个分支,看起来像这样

A-B-C-D-E
A-B-D-E-F-G
还有一根看起来像这样的树枝

A-B-F-G
我想做一根这样的树枝

A-B-C-D-E
A-B-D-E-F-G

我想可能会涉及到标记,但我对git还是比较陌生的

您可能希望创建一个新分支,从提交B开始,然后在新分支上选择您感兴趣的特定提交

git checkout my-branch <B-commit-id>

git cherry-pick <D-commit-id>
git cherry-pick <E-commit-id>
git cherry-pick <F-commit-id>
git cherry-pick <G-commit-id>

您可能希望在另一个分支上执行重基,在提交B上执行交互式重基

Branch指向提交

git checkout branchG
git rebase branchE
git rebase -i <B-commit-id>
删除C-Commit-Id的完整行。保存并关闭编辑器。完成了


请阅读编辑器中的帮助消息。它解释了交互重基的可能性。

标记与此无关。标记允许您为提交创建符号名。这是标记的一个很好的解释,它帮助我理解。谢谢,所以cherry pick添加了一个提交?另外git checkout my branch缺少一个nYes,cherry pick将一个提交按其ID复制到您当前的分支中。@ellotheth它们是不相交的,来自不同的分支。你最多可以用D.E和F.G。