Monday, May 02, 2022

GitHub - Quickly create a patch file

Recently I had to create a patch file to submit to an open source project.

Here is a quick way to do it via the GitHub web-pages.

  1. Go to your pull request (eg: https://github.com/pentaho/pentaho-kettle/pull/8283)
  2. Add ".patch" to the end. Click enter.
  3. This will redirect you to a new page with the patch info with some additional email info, etc.
  4. Copy the entire text and paste it into a file. Save the file with an extension of .patch.
  5. I found that I needed to add a new line at the end of the patch file.
That is your patch file!

To apply the patch file:
  1. Create a new branch from master (or whichever branch the patch is to be applied to).
  2. Switch to the branch.
  3. Run the following command: git apply name_of_patch_file.patch
If you instead want to manually create your patch using GIT:
  1. Switch to the branch with your changes
  2. Run the following command: git diff master > ..\name_of_patch_file.patch


No comments: