给定拉数时如何应用git补丁 [英] How to apply a git patch when given a pull number

查看:89
本文介绍了给定拉数时如何应用git补丁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从git下载了一个代码库的主干版本,并且存在构建错误。显然现在有一个补丁,我收到一封电子邮件:

I downloaded a trunk version of a codebase from git, and there are build errors. Aparently a patch is now available, and I received an email :

请参阅https://github.com/JustinTulloss/zeromq.node/pull/47了解补丁

see https://github.com/JustinTulloss/zeromq.node/pull/47 for patch

我是git的新手,所以我不太确定如何处理这个'补丁',因为这个页面看起来更像是一个讨论主题。

I am new to git so I'm not quite sure what to do with this 'patch' especially, since the page looks more like a discussion thread.

有人知道我可以如何获得/应用这个补丁到我本地克隆的git仓库吗?

Does anyone know how I can obtain/apply this patch to my locally cloned git repository?

推荐答案

将补丁保存在某处。如果你使用的是linux,你可以使用curl:

Save the patch somewhere. If you're using linux you can use curl:

curl -L https://github.com/JustinTulloss/zeromq.node/pull/47.patch > /tmp/47.patch

使用 git apply 。你可以看看这个补丁是否会用 check 选项干净地应用。转到你的git目录并运行:

To apply the patch use git apply. You can see if the patch will apply cleanly with the check option. Change to your git directory and run:

git apply --check /tmp/47.patch

如果看起来您想要应用该补丁,请移除检查选项

If it looks like you want to apply the patch remove the check option

git apply /tmp/47.patch

这篇关于给定拉数时如何应用git补丁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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