Dan Jordan

Sharing Git Diffs

Have you ever wanted to share some code changes without creating a new commit and pushing to a branch?

Recently I had this problem and discovered that using git diff and git apply can do this.

You can use git diff to export your unstaged changes to a patch file.

git diff > changes.patch

You can then send this file to the people you want to share the changes with. If they run git apply they will apply the changes to their branch.

git apply changes.patch

Further Reading