git:推送一个提交 [英] git: push a single commit

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

问题描述

假设我提交了多个提交,并希望选择将哪些提交到远程存储库。我怎么能这样做(在ASCII:C1-> C2-> C3-> C4,我想推C2和C4)。将重新排序,重新设置,推动,然后重新设置工作? (C1-> C2-> C3-> C4 => C2-> C4-> C1-> C3 =>复位C4 =>推动=>复位C3)。有没有更好的方法?

解决方案

如果你有私人分支的提交,你可以选择从私人分支提交并将它们应用到官方分支。此时,您现在可以在官方分支上推送所有提交(这是您之前挑选樱桃的子集)。


Say I made several commits and wish to cherry pick which ones I push to the remote repository. How can I do that (in ascii: C1->C2->C3->C4 and I want to push C2 and C4). Will reordering with rebase, resetting, pushing and then resetting work? (C1->C2->C3->C4 => C2->C4->C1->C3 => reset C4 => push => reset C3). Is there a nicer way?

解决方案

If you have your commits on a private branch, you can cherry pick commits from the private branch and apply them to the official branch. At this point you can now push all your commits on the official branch (which is the subset that you previously cherry picked).

这篇关于git:推送一个提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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