如何应用一个git补丁,就像作者提交给我的回购一样? [英] how to apply a git patch as if the author committed to my repo?

查看:79
本文介绍了如何应用一个git补丁,就像作者提交给我的回购一样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设有一个中央存储库,在这个存储库中,卫星提交的提交需要一段时间。开发人员A在他的回购中做了一些提交,而B自己也做了一些提交。



现在,A想要将B的提交中的一个提交到他的回购(他无法访问直接拉)。

一种方法是让B创建一个补丁并发送给A,但在这种情况下有两个问题:
1. The修补程序将显示为A的本地修改,然后该修改(使用其自己的名称)
2.一旦中央回购更新,修改将会发生冲突(由两位不同的作者推送)。



有没有办法将修补程序直接应用于本地A回购作为承诺,以便它看起来好像是从中央回购(即起源)中拉出的?



PS:(这可能不适用:请参阅评论:有没有一种方法可以在验证之前触发文本?)经过一些调查和测试后,git am< git-formatted-patch会使修补程序看起来被提交给本地主服务器(然后我希望当B推送到中央服务器时,它将被识别为相同的提交)。它看起来像它是git应用程序,使修补程序未提交...

解决方案

B可以创建并发送一个 bundle 而不是补丁。这允许当没有任何可用于推送或提取的传输工作时发送提交。


Lets suppose there is a central repository where commits from satellite ones are pushed some time. Developer A makes some commits on his repo while B makes some on his own too.

Now, A wants to incorporate one of B's commits into his repo (which he cannot access directly to pull).

One way is to have B create a patch and send it to A but in that case there are two problems: 1. The patch will appear as local modifications to A who have then to commit it (with its own name) 2. Once the central repo is updated the changes will conflict (being pushed by two different authors).

Is there a way to have the patch applied directly "as a commit" on local A repo so that it will appear to him as if it were pulled from the central repo (i.e. origin)?

PS: (this might not apply: see comments: is there a way to strike text until verified?) After some more investigation and testing looks like also git am < git-formatted-patch would make it so that the patch appears committed to the local master (then I hope it will be recognized as the same commit when B pushes it to the central repo). It looks like it is git apply that leaves the patch uncommitted...

解决方案

B could create and send a bundle rather than a patch. This allows sending commits when none of the transports available for push or fetch will work.

这篇关于如何应用一个git补丁,就像作者提交给我的回购一样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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