0

I am looking for a way to export to a file the diff (e.g. as plaintext) between two git commits in a local repo. Then a way to apply that as a patch in another local repo (transferring a file with a pendrive).

Reasons:

  1. One computer cannot be connected to the Internet, or to any of our servers, for the matter.
  2. So far we are copying the whole Git repo, but it is becoming rather inconvenient.

Preferably:

  1. It would be very good if intermediate commits were kept, with their hashes, etc.
  2. It would also be good if authorship information was preserved and blame worked everywhere.

I thought this was trivial with Git, but I am finding no information in the Internet about how to do it, it is clearly not trivial, is it possible? If so, how?

Trylks
  • 1,458
  • 2
  • 18
  • 31
  • 2
    Probably want to look at [`git format-patch`](https://git-scm.com/docs/git-format-patch) – anthony sottile May 19 '18 at 22:29
  • @AnthonySottile along with [`git am`](https://git-scm.com/docs/git-am), yes, this looks exactly like what I need. Thank you. I will try it tomorrow (it's 0:43 here) – Trylks May 19 '18 at 22:43
  • `git bundle` may help. – ElpieKay May 20 '18 at 02:29
  • @AnthonySottile I'm running into trouble with this, `git am` uses `git apply`, which fails silently. I can make it work with [`patch`](http://data.agaric.com/git-apply-does-not-work-from-within-local-checkout-unrelated-git-repository) but the information about dates and authors in the commits is lost, and it feels like there has to be a better way to make `git am` work. – Trylks May 26 '18 at 21:09

0 Answers0