Creating and applying a patch in Git

April 23, 2015 - Unix

Creating a patch

  1. Navigate to the root directory of your codebase
  2. Crate a patch, i.e. git diff > /tmp/mypatch.patch

Applying the patch

NOTE: it’s best to create a new branch in the new codebase before applying the patch first.

  1. Navigate to the root directory of the new codebase
  2. Apply the patch, i.e. git apply /tmp/mypatch.patch

Leave a Reply

Your email address will not be published. Required fields are marked *