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

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

问题描述

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

I have made several commits on different files, but so far I would like to push to my remote repository only a specific commit.

这可能吗?

推荐答案

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

To push up through a given commit, you can write:

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

提供的 已经存在于遥控器上.(如果没有,您可以使用 git push :refs/heads/ 来自动创建它.)

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.)

如果你想推送一个提交而不推送以前的提交,你应该首先使用 git rebase -i 重新排序提交.

If you want to push a commit without pushing previous commits, you should first use git rebase -i to re-order the commits.

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

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