- make changes then make patch BEFORE COMMITTING CHANGES
$ git diff > [project-name]-[project-version].[description].[issue-number]-[comment-number].patch
- doesn't work when adding or deleting files
- you've made changes that INCLUDE adding/deleting files, BUT NOT COMMITTED
$ git [add|rm] ...
$ git diff --staged > [project-name]-[project-version].[description].[issue-number]-[comment-number].patch
- you've made your changes AND YOU'VE COMMITTED the new changes AND there's ONLY BEEN ONE COMMIT (from base state to new state)
- get the commit-hash if you don't have it already
$ echo $(git log --format=%H -n1)
$ git show COMMIT_HASH > [project-name]-[project-version].[description].[issue-number]-[comment-number].patch
- you need to create a patch between two specific commits in the same branch (because you've made many commits between the base state and end state)
- get the commit-hashes you're comparing
$ git show OLD_COMMIT_HASH..NEW_COMMIT_HASH > [project-name]-[project-version].[description].[issue-number]-[comment-number].patch
- if you've made your changes to a branch; i.e. you've cloned, checked out the branch/tag that needs to be patched and then created a branch based off the HEAD of that branch
$ git diff ORG_BRANCH_NAME > [project-name]-[project-version].[description].[issue-number]-[comment-number].patch
- checkout the branch that needs patching (and has a pre-existing patch) (has an issue logged against it)
$ git clone GIT_URL --branch 8.x
- create a new branch based off of the HEAD of the one you checked out
$ git checkout -b ISSUEID-COMMENTID
- apply the old patch and commit it
$ git apply --index old_patch.patch && git commit -m "old patch"
- create a new branch to make your changes to
$ git checkout -b new_patch
- hackity hack
- commit the changes you've just made as many times as you need to... work until you're satisfied
$ git commit -m "new patch"
- generate the new patch file to submit; this will include all the previous changes that were submitted PLUS those you've made too
$ git diff 8.x > patch.patch
- generate the interdiff, you'll be running the diff off of the original branch you made in step 2. (BEFORE applying the pre-existing patch)
$ git diff ISSUEID-COMMENTID > interdiff.txt
Credits: Big, big thanks to @mparker17!!! :o)