本文介绍了恢复git推送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将git推送到远程服务器,以实现一个大型项目。
上传开始后有没有办法,如果连接丢失,我可以恢复git push命令,而不必重新开始?

编辑:我试图推送到github



edit2:所以似乎要走的路是增量式的。有人可以举一个例子说明如何在我的计算机上已经存在完整的存储库时执行此操作吗?



谢谢

解决方案Hacky解决方法:推送几个中间提交,这样你就不会每次都推送太多。这当然不会为你节省,如果它是一个巨大的提交没有推动。

 #开发,并最终希望推大师
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
#...继续前进,直到你推出你想要的所有东西

选择提交进行推送有两种主要方式:


  • master〜15 master〜10 master〜5 (15,10 ,并在 master 之前提交了5个提交)


  • 使用 gitk 手动找到它们;当您在历史记录中选择提交时,SHA1会自动置于中间单击粘贴剪贴板。



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

解决方案

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.

这篇关于恢复git推送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 20:15