如何跳过特定的提交时重新绑定? [英] How do I rebase while skipping a particular commit?

查看:134
本文介绍了如何跳过特定的提交时重新绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在跳过另一个分支上的特定(冲突)提交时将分支重新绑定到另一个分支上?

例如,我想重新分配 mybranch master ,但master包含一个与master中的提交冲突的提交,所以我更愿意完全撤消该提交。

  -oooooxoooo master 
|
oooo mybranch

x标记冲突的提交。
<使用交互式rebase:

  git rebase -i master 

一个编辑器会打开,你将得到一个如下提交列表:

 选择b8f7c25修复1 
选择273b0bb修复2
选择6aaea1b修复3

只要删除您想要跳过的提交。如果您看不到编辑器,请参阅此问题以获取解决方案:如果您无法看到编辑器,请参阅此问题以获取解决方案: 如何设置编辑器以在Windows上使用Git?


Is there a way to rebase a branch onto another while skipping a particular (conflicting) commit on the other branch?

For example, I want to rebase mybranch onto master, but master contains a commit that will conflict with the commits in master, so I prefer to undo that commit completely.

-o-o-o-o-o-x-o-o-o-o master
     |
     o-o-o-o mybranch

x marks the conflicting commit.

解决方案

Use interactive rebase:

git rebase -i master

An editor will open and you will have a list of commits like this:

pick b8f7c25 Fix 1
pick 273b0bb Fix 2
pick 6aaea1b Fix 3

Just delete the commit you want to skip. It will be omitted while rebasing your branch onto master.

P.S. If you cannot see the editor, please, refer to this question for solution: How can I set up an editor to work with Git on Windows?

这篇关于如何跳过特定的提交时重新绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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