Copy a git-push to another computer, or perform smaller incremental pushes?
-
13-04-2021 - |
Question
I'm on holidays at present and have been doing some work, committing and pushing to github. Our internet connection here is pretty bad (wireless point-to-point in the mountains) and drops off very regularly.
I was able to push to github for about a week and a half, but for the past couple of days I haven't been able to. I can push smaller changes made to other repos, but this is a fairly big one I think, and I've been making the situation worse by adding more and more commits.
When I attempt to push (using git extensions under Windows) I get the following error:
c:\Program Files (x86)\Git\bin\git.exe push "origin" master:master Done FATAL ERROR: Network error: Software caused connection abort fatal: sha1 file '' write error: Broken pipe fatal: The remote end hung up unexpectedly error: failed to push some refs to 'git@github.com:plenderj/myproject.git'
I can see outbound network activity, and then it'll drop off, and some time later git complains. I've probably tried to push about 10 or 15 times now.
Is there a way I can split up what git's attempting to upload into smaller chunks, or can I create some sort of diff file(s), apply them to my computer at home, and then upload from there? Worst case scenario I copy and paste the whole /src/ folder to a memory stick and just do it from home, but I can't help but think there's a better way. Any suggestions? :)
Solution
Use git-format-patch
to build a series of email-able patches that you can apply using git-apply
at the other end.
see man git-format-patch
for more details.
To create patches for your changes since you pull
ed from the master:
git format-patch origin/master
This creates a series of files you can email or upload.
If you have email set-up for git on your computer, you can email directly using
git send-email
If you have email set-up for git on the origin, you can apply directly using
git am
OTHER TIPS
You can also look at your history, pick a revision somewhere on your master
and then say
git push <remote> <revision>:tmp-branch
This way you can manually incrementally push changes since git never copies the same object twice. A final git push <remote> master
will then update the master
branch.
Another option is git bundle
. You can create a file with your unpushed commits by saying
git bundle create my.bundle origin/master..master
Then you can transfer this file using some robust method (rsync?) and apply it in the remote repository with a
git pull /path/to/my.bundle master