A patch is a small piece of code that can be applied to fix a bug or add a new feature.
We will be creating an SVN patch from github, as we have setup WordPress development from GitHub
Step 1: Create a new feature branch from the master
git checkout master -b some-feature/123
Step 2: Add changes to staging area
// Use git add . to stage all the unstage changes for commit.
git add .
Step 3: Commit changes
// edit files
git commit -am "fixed the bug"
//edit more files
git commit -am "fixed edge case"
Step 4: Generate the patch
git diff master --no-prefix > ~/Downloads/123.diff
The –no-prefix flag is added so the patch does not show any source or destination prefix
In case you want to test a patch created by another download the .diff file from the ticket, use the following command
patch -p0 < ~/downloads/3124.diff
Once the patch is tested you can stash the changes by GitHub and pull the master for the latest changes, rebuild WordPress..on to the next ticket
References: