我怎样才能跳过提交git? [英] How can I skip commits in git?

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

问题描述

我有一些我不想在我的项目中提交的提交,但是有一些提交是基于我想要的。
这是我的GitHub仓库网络图(ASCII,因为我仍然无法发布图片):

  []  -  []  -  [_] 
| |
| -------> |
----------> [·] - [·] - [*]

( - >表示合并)

我想删除两个[·]提交中所做的更改,并将[*] ]一个在上面的[_]上。
我尝试了合并和重新绑定,但它们应用了不需要的提交的更改。
是否有可能?



对不起,如果我不清楚,英语不是我的母语。
在此先感谢。

解决方案

我可以给你两个选择:


  • Interactive rebase git rebase -i )为您提供提交列表,编辑该列表将改变操作的结果;允许您重新排序,删除或标记这些提交用于其他操作。在你的情况下,你可以将 [*] 的分支转换为 [_] 的并且删除不需要的行提交。

  • Cherrypick 允许您将单个提交的更改应用到另一个分支。就你而言,你可以简单地将 [*] 提交给 [_] 的分支。



I have some commits that I don't want in my project, but there's a commit based on them which I do want in it. This is my GitHub "Network" graph of the repository (ASCII, as I still cannot post images):

[]--[]--[_]
|        |
|        ------->|
---------->[·]--[·]--[*]

(-> means a merge)

I want to delete the changes made in the two [·] commits, and base the [*] one on the [_] one above. I've tryed merging and rebasing, but they apply the changes of the unwanted commits. Is it possible?

Sorry if I'm not clear, English isn't my mother language. Thanks in advance.

解决方案

I can give you two options:

  • Interactive rebase (git rebase -i) presents you a list of commits, editing this list will change the result of the operation; lets you reorder, delete or tag these commits for miscellaneous operations. In your case, you can rebase [*]'s branch into [_]'s and delete the lines unwanted commits.

  • Cherrypick lets you apply the changes of a single commit into another branch. In your case, you can simply cherrypick commit [*] into [_]'s branch.

这篇关于我怎样才能跳过提交git?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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