14

Assuming network access is sporadic with no central server, what would be the best way to use git to keep three or more branches in sync? Is there a way to extract just my deltas, email those, and merge them on the other end?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Alexandra Franks
  • 2,982
  • 1
  • 19
  • 23

3 Answers3

27

While "git format-patch" and "git am" are great ways to manage patches from non-git sources, for git repositories you should investigate "git bundle".

"git bundle" and the subcommands "create" and "unbundle" can be used to create and use a binary blob of incremental commits that can be used to transfer branch history across a 'weak' link via an alternative file transfer mechanism (e.g. email, snail-mail, etc.).

git bundles will preserve commit ids, whereas format-patch/am will not resulting in the destination commits not being identical (different SHA1s).

CB Bailey
  • 755,051
  • 104
  • 632
  • 656
  • Nice. I've heard of the patch based handlers before (see other posts) but git-bundle is something I really need. http://www.kernel.org/pub/software/scm/git/docs/git-bundle.html – Pat Notz Sep 20 '08 at 09:43
5

See the main pages for git-format-patch and git-am. This is one of the ways the system was originally designed to work with.

Alireza
  • 100,211
  • 27
  • 269
  • 172
Jim Puls
  • 79,175
  • 10
  • 73
  • 78
3

There are a few tools in git to use to mail patches or import mailed patches: git-am (apply patches from a mailbox), git-format-patch (prepare email for mailing), git-send-email (send a collection of patches via mail), etc. man 1 git has a complete list.

Alireza
  • 100,211
  • 27
  • 269
  • 172
terminus
  • 13,745
  • 8
  • 34
  • 37