Question

Je téléchargé une version de tronc d'une base de code de git, et il y a des erreurs de construction. Aparently un patch est maintenant disponible, et je reçu un e-mail:

voir https://github.com/JustinTulloss/zeromq.node/pull/47 pour le patch

Je suis nouveau à git donc je ne suis pas tout à fait sûr de ce qu'il faut faire avec ce « patch » en particulier, depuis que la page ressemble plus à un fil de discussion.

Quelqu'un sait comment je peux obtenir / appliquer ce correctif à mon dépôt git cloné localement?

Était-ce utile?

La solution

Save the patch quelque part. Si vous utilisez Linux, vous pouvez utiliser boucle:

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

Pour appliquer l'utilisation du patch git apply. Vous pouvez voir si le patch appliquera proprement avec l'option check. Changement dans votre répertoire git et exécutez:

git apply --check /tmp/47.patch

S'il semble que vous voulez appliquer le patch supprimer l'option de vérification

git apply /tmp/47.patch

Autres conseils

Il suffit d'ajouter un .patch à la fin pour obtenir le patch:

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

Vous pouvez faire quelque chose comme ci-dessous:

$ git checkout master
$ curl http://github.com/JustinTulloss/zeromq.node/pull/47.patch | git am
$ git push origin master

http://help.github.com/send-pull-requests/

La règle semble récemment changé.

nous avons pris précédemment un PR et ajouter un .patch à la fin pour obtenir le patch

http://github.com/[group]/[project]/pull/30583.patch

Mais le lien est redirect (301) à

https://patch-diff.githubusercontent.com/raw/[group]/[project]/pull/30583.patch

Donc, si vous utilisez curl, vous pouvez tuyau avec commande git apply pour appliquer un patch git de la demande Pull

curl https://patch-diff.githubusercontent.com/raw/[group]/[project]/pull/30583.patch | git apply

Si le patch n'est pas pour vous maintenant, utilisez la commande de git apply -R pour restaurer le changement.

Pour que git télécharger la demande de traction 47 et le patch dans mylocalbranch localement, exécutez:

git checkout -b mylocalbranch
git pull origin pull/47/head

Si la demande de traction est pas sur le repo d'origine, exécutez

git remote add patchremote https://github.com/JustinTulloss/zeromq.node
git pull patchremote pull/47/head
git fetch -q origin +refs/pull/47/merge:
git checkout -qf FETCH_HEAD
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top