Git applying patches

This quick blog post is about applying git patches to your git repo.

Command:

git apply [path to the patch file]

Ex:

git apply /home/denuwanthi/Downloads/product-greg.patch

Before applying the patch you can check wether there a re any issues using the following command.

git apply – -check [path to the patch file]

Ex:

git apply –check /home/denuwanthi/Downloads/product-greg.patch

If you don’t get any errors, you can apply the patch straight forward using the first command.

If you want to remove the change/patch you added, before committing, you can use

git checkout – – <file>

Ex:

git checkout — pom.xml

Author: denuwanthi

Graduate of Department of Computer Science & Engineering, University of Moratuwa, Sri Lanka.Currently working in WSO2 Lanka (pvt)Ltd.

Leave a comment