git merge --no-commit vs git cherry-pick --no-commit [英] git merge --no-commit vs git cherry-pick --no-commit

查看:246
本文介绍了git merge --no-commit vs git cherry-pick --no-commit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

git merge --no-commit 和 git cherry-pick --no-commit ?



如果我在这两个命令之后提交,那么历史是否有任何区别? 解决方案

如果你在 git merge --no-commit 之后提交,你实际上会得到一个合并提交。而在 git cherry-pick --no-commit 之后,您将得到一个父母的提交。



因此,这两个命令是有区别的。



特别是如果你有类似的东西



<$ A $ B $ C
$ L $
$ b $ D $ E
$ $ $ c>

如果 cherry-pick commit E ,你不会得到commit D 的修改。而如果你 merge ,你会得到两者。


Is there any difference between git merge --no-commit and git cherry-pick --no-commit?

And is there any difference in history if I commit after these two commands?

解决方案

If you commit after git merge --no-commit, you'll actually get a merge commit. Whereas after a git cherry-pick --no-commit you'll get a commit with a single parent.

Hence, yes, there is a difference between those two commands.

In particular if you have something like

A -- B -- C
 \        L HEAD
  \
   -- D -- E

If you cherry-pick commit E, you won't get modifications of commit D. Whereas if you merge, you'll get both.

这篇关于git merge --no-commit vs git cherry-pick --no-commit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆