Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
184 views
in Technique[技术] by (71.8m points)

github - How to apply a git patch when given a pull number

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 :

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

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.

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

question from:https://stackoverflow.com/questions/7827002/how-to-apply-a-git-patch-when-given-a-pull-number

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...