1

I don't have network connectivity to allow git fetch to work, but I do have remote desktop access so I am trying to use git format-patch and git am to transfer the commits.

However it appears that the patch gets a new commit number when applied, so you'd end up having to do a merge when the network is restored.

Is it possible to get the effect of a pull by transferring patch files?

Ian Horwill
  • 2,741
  • 2
  • 22
  • 23
  • 1
    You're looking for [git bundle](https://git-scm.com/docs/git-bundle). See https://stackoverflow.com/q/11792671/7976758 – phd Apr 28 '18 at 12:51
  • Thanks, I hadn't thought of that. That transfers the entire repo though which in my case is not huge (so git bundle is a workable solution). Is there some way to transfer just the missing commits? – Ian Horwill Apr 28 '18 at 12:54
  • 2
    You can [git-bundle a single commit](https://stackoverflow.com/a/31332220/7976758) or as much as you need — an entire branch or just a few commits and tags… – phd Apr 28 '18 at 12:56
  • 1
    To expand phd's comment a bit: a bundle file is suitable as input to `git fetch`. It consists of everything `git fetch` *would* get if the network *were* up. The problem is that without the network being up, *you* must tell the sending side (where you make the bundle) what commits the receiving side does and does not have, instead of the receiving side telling the sending side directly. So you give `git bundle` a set of names or hash IDs that the receiver *does* have, and a set of *names the receiver should update*, and the sender builds the bundle from that. – torek Apr 28 '18 at 16:19
  • Thanks @phd - that's exactly what I need. And thanks for the elaboration torek. – Ian Horwill Apr 28 '18 at 17:05
  • If the network is down, what about faking your origin to your local filesystem: https://stackoverflow.com/questions/10603671/how-to-add-a-local-repo-and-treat-it-as-a-remote-repo?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – gmolaire Apr 28 '18 at 17:48
  • @gumol - that won't help because the source repo is not in my local filesystem. – Ian Horwill May 02 '18 at 08:06

0 Answers0