我如何将特定提交推送到远程,而不是以前的提交? [英] How can I push a specific commit to a remote, and not previous commits?

查看:107
本文介绍了我如何将特定提交推送到远程,而不是以前的提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经对不同的文件进行了多次提交,但到目前为止,我只想推送到我的远程存储库,只进行特定的提交。



这可能吗?

解决方案

要将向上推送给定提交,您可以编写:

  git push< remotename> < commit SHA>:< remotebranchname> 

已提供< remotebranchname> 遥控器。 (如果没有,可以使用 git push< remotename>< commit SHA>:refs / heads /< remotebranchname> 来自动创建它。)



如果你想推送一个commit 而不用推送先前的提交,你应该首先使用 git rebase -i $ b 编辑



改为更完整的描述检查@ Samuel的答案: https://stackoverflow.com/a/27907287/889213



参考文献:


  1. http://blog.dennisrobinson.name/push-only-one-commit-with-git/

  2. http://blog.dennisrobinson.name/reorder -commits-with-git /


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:

  1. http://blog.dennisrobinson.name/push-only-one-commit-with-git/
  2. http://blog.dennisrobinson.name/reorder-commits-with-git/

这篇关于我如何将特定提交推送到远程,而不是以前的提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆