Gitkraken / Github / git:从非父分支创建新分支

问题描述

在我的远程存储库中,我有

Origin
feature
abc 
20200801_branch_1
20200802_branch_2
.
.
abc 
develop

我想使用来自feature / abc / develop的数据创建一个新的分支feature / abc / 20200811_mybranch。我该怎么办??

谢谢!

解决方法

几种方法(checkout -bbranch)可以实现细微差别的简单操作:

1),您当前有feature/abc/develop个已签出,您想创建新分支,但停留在feature/abc/develop

git branch feature/abc/20200811_mybranch

2),您当前已签出feature/abc/develop,要创建新分支并以相同的方式签出

git checkout -b feature/abc/20200811_mybranch

3),您还有另一个分支(例如abc)已签出,您想从feature/abc/develop创建新分支,但保留在当前分支上

git branch feature/abc/20200811_mybranch feature/abc/develop

4),您还有另一个分支(例如abc)已签出,您想从feature/abc/develop创建新分支并立即签出新分支>

git checkout -b feature/abc/20200811_mybranch feature/abc/develop