更改签出分支
Changing checked out branch
想象一下场景:
您目前在 develop
分支。
您创建了新分支。让我们说 A
您做出了一些承诺。
但后来您意识到这是一个修补程序,它应该基于 master
分支。 develop
有一些不应该在 master
分支中的更改。 (gitflow)
那么,基于 master
将所有更改带到新分支的最简单方法是什么?
今天这件事发生在我身上。我的(愚蠢的)解决方案是:
- 删除
A
- 记住您所做的所有更改。
- 结账到
master
。
- 创建新分支。
B
- 将您的更改应用到这个新分支。
必须有更好的方法! :)
So whats the easiest way to carry of all the changes to a new branch based on master?
这就是 rebase 的作用:
git rebase --onto master development A
现在你的分支是基于 master 的。
参见 the docs for git-rebase,特别是 --onto 部分。
想象一下场景:
您目前在 develop
分支。
您创建了新分支。让我们说 A
您做出了一些承诺。
但后来您意识到这是一个修补程序,它应该基于 master
分支。 develop
有一些不应该在 master
分支中的更改。 (gitflow)
那么,基于 master
将所有更改带到新分支的最简单方法是什么?
今天这件事发生在我身上。我的(愚蠢的)解决方案是:
- 删除
A
- 记住您所做的所有更改。
- 结账到
master
。 - 创建新分支。
B
- 将您的更改应用到这个新分支。
必须有更好的方法! :)
So whats the easiest way to carry of all the changes to a new branch based on master?
这就是 rebase 的作用:
git rebase --onto master development A
现在你的分支是基于 master 的。
参见 the docs for git-rebase,特别是 --onto 部分。