在rebase之后,分支信息丢失后,远程分支的git是否重新绑定了

时间:2015-03-02 08:11:06

标签: git git-rebase git-remote

我有一个远程分支:让我们说X. 我有一面镜子或以上:让我们说Y. 在Y中,我有另一个分支功能。

我想用X来修改功能,所以尝试了以下命令: git rebase X / master Y / feature

此后,分支信息丢失,我无法进行任何更改。

任何指针??

1 个答案:

答案 0 :(得分:3)

正如Jubobs所指出的那样in a comment,你无法做到这一点。

更具体地说,正如文档所述:

  

git rebase ... [ upstream [ branch ]]

     

如果指定了 branch git rebase将在执行任何其他操作之前执行自动git checkout branch。 ...

在你的例子中你写道:

  

git rebase X/master Y/feature

此处 upstream X/master,而 branch Y/feature,因此rebase流程开始于做git checkout Y/feature

如果您自己尝试,您会看到:

Note: checking out 'Y/feature'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

所以,git rebase首先将你带入"分离的HEAD"州。然后,它将使用X/master作为新分离的HEAD的上游来执行通常的rebase操作。

这有明确的含义,但可能与你的意图完全不同(虽然我不清楚你的意图)。