简体   繁体   English

从dev分支创建两个具有特定提交的新分支

[英]Create two new branches with specific commits from a dev branch

I have created a project using Xamarin Studio for a multi-platform app, I did it using a 'dev' branch but after the job was finished I thought it would be better [for clearance and a easy reference] to have two different branches besides master and dev: iOS and Android for commits related to each platform. 我已经使用Xamarin Studio为一个多平台应用程序创建了一个项目,我使用了一个'dev'分支来完成了该项目,但是在工作完成之后,我认为除了两个不同的分支之外,[为了方便起见和方便参考]会更好。 master和dev:iOS和Android用于与每个平台相关的提交。

Is there a way at this point of the project that I can clone the dev branch, and delete all the commits non-related to this platform? 在项目的这一点上,有什么方法可以克隆dev分支,并删除与该平台无关的所有提交?

This is what i currently have: 这是我目前拥有的:

dev -- Android commit -- Android commit -- iOS commit -- Android commit

And this what I want to achieve: 这就是我想要实现的目标:

  /-- iOS Branch -- iOS Commit 1
dev -- Android commit 1-- Android commit 2 -- iOS commit 1 -- Android commit 3
  \-- Android branch -- Android commit 1 -- Android commit 2 -- Android commit 3

If you are willing and have access to the command line, you can do this by creating each branch you want from your last commit and doing 如果您愿意并有权访问命令行,则可以通过从上一次提交创建所需的每个分支并执行

git rebase -i dev

This will show you a list of commits in vim and you can delete the ones you want to skip. 这将向您显示vim中的提交列表,您可以删除要跳过的提交。

You can use GitKraken Tool, it will ease your daily command line syntax to GUI based application. 您可以使用GitKraken工具,它将简化基于GUI的应用程序的日常命令行语法。

For reference: https://www.gitkraken.com 供参考: https : //www.gitkraken.com

With the help of Gitkraken you can simply create multiple branch on single click event. 借助Gitkraken,您只需单击事件即可创建多个分支。

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

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