问题描述
我已经对不同的文件进行了多次提交,但到目前为止,我只想推送到我的远程存储库,只进行特定的提交。
这可能吗?
要将向上推送给定提交,您可以编写:
git push< remotename> < commit SHA>:< remotebranchname>
已提供< remotebranchname>
遥控器。 (如果没有,可以使用 git push< remotename>< commit SHA>:refs / heads /< remotebranchname>
来自动创建它。)
如果你想推送一个commit 而不用推送先前的提交,你应该首先使用 git rebase -i $ c
$ b 编辑
改为更完整的描述检查@ Samuel的答案:
参考文献:
I have made several commits on different files, but so far I would like to push to my remote repository only a specific commit.
Is that possible?
To push up through a given commit, you can write:
git push <remotename> <commit SHA>:<remotebranchname>
provided <remotebranchname>
already exists on the remote. (If it doesn't, you can use git push <remotename> <commit SHA>:refs/heads/<remotebranchname>
to autocreate it.)
If you want to push a commit without pushing previous commits, you should first use git rebase -i
to re-order the commits.
EDIT
to a more complete description of what to do check @Samuel's answer: https://stackoverflow.com/a/27907287/889213
References:
- http://blog.dennisrobinson.name/push-only-one-commit-with-git/
- http://blog.dennisrobinson.name/reorder-commits-with-git/
这篇关于我如何将特定提交推送到远程,而不是以前的提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!