git - cherry-pick - HOWTO/WHYTO

标签 git git-cherry-pick git-am

Problem: You want to test a feature someone has developed, but it only exists in a remote branch which is woefully out of date.

Source

  1. cherry-pick 如何解决问题?
  2. 为什么我不使用 git am 或 git apply?

最佳答案

Problem: You want to test a feature someone has developed, but it only exists in a remote branch which is woefully out of date.

如果您 merge 或 rebase ,您会得到一堆旧的更改,可能会发生冲突。

通过 cherry picking,您可以获取一个更改集,并将其作为新提交重播到另一个分支。

如果您只想将一个提交到另一个分支,而不需要其历史记录,这将很有用。

使用 -x 选项很有用,因此提交消息包含一个注释,它是从哪里挑选出来的。

Why won't I use git am or git apply?

因为 git apply 是打补丁(文件),而 git am 是打补丁系列。 git cherry-pick 应用提交 - 即,从您自己的存储库提交,与从其他存储库导入的提交。

关于git - cherry-pick - HOWTO/WHYTO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13522664/

相关文章:

Git 排除分支中的提交

Github:镜像 gh-pages 到 master

git - 在 master 中间恢复多个提交

git - 在Git cherry-pick或rebase merge 冲突中,如何确定BASE(aka “the ancestor”),LOCAL和REMOTE?

git - gitcherry-pick 中跳过的文件会包含在以后的 git merge 中吗?

git-merge - 不能将 `git mergetool` 与 `git am` 或 `git apply` 或 `patch` 一起使用

git - git cherry-pick 和 git format-patch 有什么区别?我是 SCSS ?

git - 我如何发现差异由哪些提交组成?

c# - 为什么从 C# 代码中获取 Git 不起作用

git - 如何 'git-am' 应用使用 'git-format-patch --no-prefix' 创建的补丁?