简体   繁体   English

从远程分支重新设置了git的基准,重新基准后,分支信息丢失了

[英]Did rebase of git from remote branch, after rebase, branch info is lost

I have a remote branch : let's say X and i have a mirror or above : Let's say Y With in Y, i have another branch feature. 我有一个远程分支:假设X并且我有一个镜像或以上:假设Y在Y中,我还有另一个分支功能。

I wanted to rebase feature with X, so tried following command : git rebase X/master Y/feature 我想用X重新设置功能,所以尝试了以下命令:git rebase X / master Y / feature

After this, branch info is lost, and i am not able to push any changes. 此后,分支信息丢失,并且我无法推送任何更改。

Any pointers?? 任何指针?

As Jubobs noted in a comment , you can't do that. 正如Jubobs 在评论中指出的那样,您不能这样做。

More specifically, as the documentation notes: 更具体地说,如文档所述:

git rebase ... [ upstream [ branch ]] git rebase ... [ upstream [ branch ]]

If branch is specified, git rebase will perform an automatic git checkout branch before doing anything else. 如果指定了branch ,则git rebase将在执行其他任何操作之前执行自动git checkout branch ... ...

In your example you wrote: 在您的示例中,您写道:

git rebase X/master Y/feature

Here, upstream is X/master , and branch is Y/feature , so the rebase process starts by doing git checkout Y/feature . 在这里, upstreamX/master ,而branchY/feature ,因此,通过执行git checkout Y/feature开始rebase过程。

If you try this yourself, you will see: 如果您自己尝试此操作,则会看到:

 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. 

So, git rebase will start by putting you into "detached HEAD" state. 因此, git rebase将首先使您进入“分离的HEAD”状态。 It will then do the usual rebase operation using X/master as the upstream for the newly-detached HEAD. 然后,它将使用X/master作为新分离的HEAD的上游进行常规的变基操作。

This has a well-defined meaning, but is probably nothing like what you intended (though it's not clear to me what you did intend). 这具有明确的含义,但可能与您的意图不同(尽管我不清楚您的意图)。

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

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