简体   繁体   English

如何从拉取请求的功能分支中删除特定于操作系统的提交?

[英]How to remove OS-specific commits from feature branch for pull request?

I'm working on a branch Feature based off branch Ubuntu-Env where some changes are made for me working with Ubuntu. 我正在开发基于分支Ubuntu-Env的分支Feature ,其中对使用Ubuntu进行了一些更改。 These changes have to be deleted when I make a Pull Request. 发出“拉取请求”时,必须删除这些更改。 Until now I just checkout the changed files from master. 到目前为止,我只是从master检出更改的文件。 Is there a more elegant way? 有没有更优雅的方式? I tried git rebase but the commits from Ubuntu-Env are still there. 我尝试了git rebase但是Ubuntu-Env的提交仍然存在。

Your commit history probably looks something like this: 您的提交历史可能看起来像这样:

*--*--*--* [master]
 \
  A--B [Ubuntu-Env]
      \
       *--*--*--* [Feature]

And you want to open a pull request to master from Feature that doesn't contain commits A or B . 你想开一个拉请求masterFeature不包含提交AB

You are on the right track with git rebase . 您使用git rebase处于正确的轨道。 However, you need to include the --onto argument: 但是,您需要包括--onto参数:

git rebase --onto master Ubuntu-Env Feature

Your history will then look something like this: 您的历史记录将如下所示:

*--*--*--* [master]
 \        \
  \        *--*--*--* [Feature]
   \
    A--B [Ubuntu-Env]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM