Sharing code via email with git

Ángel Ortega

In a clone of a remote repository, start a branch to hold your code:

 git checkout -b my-changes

Do your work and commit changes as you like.

When you are happy with your work, create a temporary directory:

 mkdir /tmp/patches

Then change back to the master branch and build a set of patches from your branch with git format-patch:

 git checkout master
 git format-patch -n -o /tmp/patches

A bunch of files, one per changeset, have been created in /tmp/patches. Now, use the git send-email to send them, one per email, to the original author.

 git send-email --no-thread --from me@here --to author@remote /tmp/patches

If author@remote acknowledges your changes, you can just merge your changes to the current master head and delete your temporary branch:

 git merge my-changes
 git branch -d my-changes

On the remote machine

If author@remote uses mutt, he can move to his working copy, call it and type |git am on each message.

Comments [Add new one]

None yet.