Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resuming git push

Tags:

git

github

resume

I am trying to do a git push to a remote server, for a big project. Is there any way once the upload is started, that if the connection is lost, I can resume the git push command and not have to start all over again?

edit: I am trying to push to github

edit2: so it seems that the way to go is doing it incremental. Can somebody put an example on how to do that when I have the full repository already on my computer?

Thanks

like image 624
Daniel Benedykt Avatar asked Oct 13 '11 16:10

Daniel Benedykt


People also ask

How do I force a git push?

To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch). See the <refspec>... section above for details. Force an update only if the tip of the remote-tracking ref has been integrated locally.

Can you resume a git clone?

There is currently no way to resume a git clone using git, but there is a neat trick you can use instead of cloning directly -- using git bundle files. Here is how you would do it. Once this is done, you can delete the "clone. bundle" file, unless you think you will need to perform a fresh clone again in the future.


2 Answers

Hacky workaround: push several intermediate commits, so that you're not pushing as much each time. This of course won't save you if it's a single enormous commit that's failing to push.

# develop, and end up wanting to push master
git branch master-tmp <commit>
git push origin master-tmp:master
git branch -f master-tmp <a more recent commit>
git push origin master-tmp:master
# ...keep going until you've pushed everything you want

There are two primary ways to pick the commits to push:

  • master~15, master~10, master~5 (15, 10, and 5 commits before master)

  • Use gitk to manually find them; when you select a commit in the history, the SHA1 is automatically put in the middle-click paste clipboard.

like image 155
Cascabel Avatar answered Sep 30 '22 10:09

Cascabel


rsync your .git/objects directory to the remote, then do git push - it will go much faster.

like image 45
Ana Betts Avatar answered Sep 30 '22 10:09

Ana Betts