是否有可能从另一个git仓库挑选提交? [英] Is it possible to cherry-pick a commit from another git repository?

查看:216
本文介绍了是否有可能从另一个git仓库挑选提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



通常我会选择使用 HEAD @ {x} 在reflog中,但是因为 .git 对这条reflog条目(不同的物理目录) ,我该如何挑选这个,或者我可以吗?



我正在使用 git-svn 。我的第一个分支是使用Subversion库中的 git-svn trunk ,并且下一个分支使用 git-svn 在Subversion分支上。

解决方案

另一个存储库作为远程,然后获取其更改。从那里你可以看到提交,你可以挑选它。



像这样:

  git remote add other https://example.link/repository.git 
git fetch other

现在您拥有所有信息,只需执行 git cherry-pick



更多有关在这里使用遥控器的信息: https:// git- scm.com/book/en/v2/Git-Basics-Working-with-Remotes


I'm working with a git repository that needs a commit from another git repository that knows nothing of the first.

Typically I would cherry-pick using the HEAD@{x} in the reflog, but because this .git knows nothing of this reflog entry (different physical directory), how can I cherry-pick this, or can I?

I'm using git-svn. My first branch is using git-svn of the trunk of a Subversion repo, and the next branch is using git-svn on a Subversion branch.

解决方案

You'll need to add the other repository as a remote, then fetch its changes. From there you see the commit and you can cherry-pick it.

Like that:

git remote add other https://example.link/repository.git
git fetch other

Now you have all the information to simply do git cherry-pick.

More info about working with remotes here: https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes

这篇关于是否有可能从另一个git仓库挑选提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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