~/Blog

Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI studying Automated Reasoning in AI and Linux Enthusiast.

Sharing Patches in Git

Published on

Updated on

Warning: This post has not been modified for over 2 years. For technical posts, make sure that it is still relevant.

The Linux kernel community make use of patches in git to share code changes with one another. Patches are only nicely formatted differences between your current codebase and what you compare it to. If you want to share a subsetted git tree, then git bundle would be the way to go.

Creating the patch

If you want to create a patch based off the difference between your current branch and master, run the following:

git format-patch master --stdout > feature_branch.patch

You can then email the patch to the team.

Applying the patch

To apply go into a new branch and apply the patch file.

git checkout -b feature_branch
git apply /path/to/feature_branch.patch
Reply via Email Buy me a Coffee
Was this useful? Feel free to share: Hacker News Reddit Twitter

Published a response to this? :