Git 使用补丁

发布于 2024-07-25 04:31:04 字数 305 浏览 2 评论 0原文

跟进我之前的问题Git 工作流程与未经验的成员。 我选择让他向我发送补丁。 问题是我以前没有使用过补丁,并且找不到解释工作流程的教程。

我想要的是让他从仓库中提取最新的代码。 创建一个分支工作,当他完成后提交他的更改,我希望他为它创建一个补丁,这样我就可以将它集成到master中。

你能告诉我如何在这种情况下创建补丁并将其应用到我的主人上吗?

To follow up on my previous question Git work flow with an inexpirenced member.
I choose to have him send patches to me. The problem is i haven't used patches before and i can't find tutorials giving explanation on the work flow.

What i want is have him pull the latest code from the repo. create a branch work on it commit his changes when he is done i want him to create a patch for it so i can integrate it into master.

Can you tell me how can i create patches in a situation like this and apply it to my master?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

缘字诀 2024-08-01 04:31:04

使用 git-format-patch 创建补丁(1),或者,如果您想发送电子邮件,只需 git-send-email(1).

然后使用 git-apply(1) 或者,对于电子邮件,git-am(1 )

Create patch with git-format-patch(1), or, if you want to send emails just git-send-email(1).

Then apply it with git-apply(1) or, for email, git-am(1).

你的心境我的脸 2024-08-01 04:31:04

这相对容易。 假设分支是 foo,补丁来自 master:

# Put every patch for revisions from master to foo into tmp: 0001, 0002, etc...
git format-patch master...foo --stdout > yo

....

# You apply the patches with git am
cat yo | git am

请注意,由于提交者的差异,它不会为您提供与原始版本相同的修订版本。 在这种情况下,情况会稍微复杂一些(http://home.regit.org/?page_id=32 )

That's relatively easy. Say the branch is foo, and the patches from master:

# Put every patch for revisions from master to foo into tmp: 0001, 0002, etc...
git format-patch master...foo --stdout > yo

....

# You apply the patches with git am
cat yo | git am

Note that it won't give you the same revisions as the original because of commiters differences. That's a bit more complicated in that case (http://home.regit.org/?page_id=32)

稍尽春風 2024-08-01 04:31:04

无需提交:

git pull
<hack>
git diff -p > myfirstpatch.txt

然后他可以通过电子邮件将补丁发送给您。

如果他确实承诺了,那么只需给 diff 一些论据即可。

git diff blah...blah2 -p >mysecondpatch.txt

那么你只需这样做:

git apply mysecondpatch.txt

without commiting:

git pull
<hack>
git diff -p > myfirstpatch.txt

then he can email you the patch.

if he does commit, then just give diff some arguments.

git diff blah...blah2 -p >mysecondpatch.txt

then you just do:

git apply mysecondpatch.txt
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文