nowox
nowox

Reputation: 29066

How to generate a patch that includes the commit SHA?

I have two people

Bob wants to send to Alice the diff of the master branch since Alice left.

I initially thought that

bob $ git format-patch --stdout e6def65..master > history.patch

alice $ git am history.patch

would preserve the commit hash, but it doesn't.

Is there a solution to easily exchange by e-mail a diff that preserves the commit SHA?

Upvotes: 2

Views: 1154

Answers (1)

zoul
zoul

Reputation: 104065

Does git bundle do what you want?

Some workflows require that one or more branches of development on one machine be replicated on another machine, but the two machines cannot be directly connected, and therefore the interactive Git protocols (git, ssh, http) cannot be used. This command provides support for git fetch and git pull to operate by packaging objects and references in an archive at the originating machine, then importing those into another repository using git fetch and git pull after moving the archive by some means (e.g., by sneakernet). As no direct connection between the repositories exists, the user must specify a basis for the bundle that is held by the destination repository: the bundle assumes that all objects in the basis are already in the destination repository.

See also this previous question about Git over e-mail.

Upvotes: 5

Related Questions