Resuming git push

拟墨画扇 提交于 2020-01-03 13:41:52

问题


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


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/7757164/resuming-git-push

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!