Sharing Your Git Patches

Another way of sharing quick suggestions with your team

Imagine this situation

What possibilities are there apart from just comments in a PR?

Git diff to the rescue!

git diff origin develop > ../my-origin-develop.patch

What now?

git apply ../my-origin-develop.patch

“How to” by steps

The patch creator: the person who will create the patch

# Checkout that branch
$ ~/myProject git:(the-branch) ➜ git pull origin the-branch
# Do your suggestions and changes in the targeted branch# Generate the patch file using the diff command
$ ~/myProject git:(the-branch) ➜ git diff > ../your-diff.patch
# Share the patch file with the author of the PR

The patch user: the person who will see the patch

# Ensure you are in that branch
$ ~/myProject git:(the-branch) ➜ git pull origin the-branch
# Apply the patch file
$ ~/myProject git:(the-branch) ➜ git apply ../your-diff.patch

Aka: Chema. I love writing about stuff that I find interesting and bring some value to my life, so I can share them with you. https://chemaclass.es