Git:如何反向合并提交? [英] Git: how to reverse-merge a commit?

查看:126
本文介绍了Git:如何反向合并提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用SVN很容易反向合并提交,但是如何用Git来实现这一点? 创建创建SVN一个新的提交'撤销'过去提交的变化,使用:

  $ git revert< commit> 

也可以通过重新绑定然后重新设置来实际删除任意点的提交,但是如果你已经将你的提交推送到另一个仓库(或其他人已经从你那里拿到了),你真的不想这样做。


With SVN it is easy to reverse-merge a commit, but how to do that with Git?

解决方案

To create a new commit that 'undoes' the changes of a past commit, use:

$ git revert <commit>

It's also possible to actually remove a commit from an arbitrary point in the past by rebasing and then resetting, but you really don't want to do that if you have already pushed your commits to another repository (or someone else has pulled from you).

这篇关于Git:如何反向合并提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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