git推送非所有提交

时间:2014-12-30 10:24:56

标签: git push commit

我在项目中使用git push时遇到问题。我有7次提交推送,但它们对我的互联网连接来说太大了,我无法完成命令。

所以我想推送最旧的提交,而不是第二次提交,依此类推。

有哪些命令可以查看提交的名称并在一次推送它们?

1 个答案:

答案 0 :(得分:2)

让我们说你有这样的历史:

A -- B -- C -- D -- E -- F -- G -- H
|                                  |
origin/master                      master

您要做的是先只提交B,然后只提C,依此类推。

为此,您可以多次使用命令

git push <remote name> <local commit to push>:<remote branch>

ie:使用连续的命令

git push origin B:master
git push origin C:master
...
git push origin H:master

其中B应该由提交B的sha1替换(或以任何其他方式指向此提交。例如master~6