简体   繁体   English

本地Git分支在交互式rebase之后与原点不同

[英]Local Git branch has diverged from origin following an interactive rebase

I have a local branch ( CRM-ayrshireminis ) that has a couple of commits on it that I have pushed to the origin ( origin/CRM-ayrshireminis ). 我有一个本地分支( CRM-ayrshireminis ),它有几个提交,我已推到原点( origin/CRM-ayrshireminis )。 This branch was created from the develop branch about one week ago, on which there have been one weeks worth of work from other collaborators. 这个分支是在大约一周前从develop分支创建的,其他合作者已经有一周的工作时间。

What I want to do is rebase the latest code from origin/develop into my feature branch CRM-ayrshireminis . 我想要做的是将origin/develop的最新代码CRM-ayrshireminis到我的功能分支CRM-ayrshireminis

What I done was: 我做的是:

git checkout develop
git pull
git rebase -i develop CRM-ayrshireminis

I had two commits, so I squashed them into one and then quit out. 我有两个提交,所以我把它们压成一个然后退出。 I got the message saying Rebasing (2/2) , so it seemed fine... 我收到消息说Rebasing (2/2) ,所以看起来很好......

[crmpicco@dev53 ayrshireminis]$ git status
# On branch CRM-ayrshireminis
# Your branch and 'origin/CRM-ayrshireminis' have diverged,
# and have 2 and 2 different commits each, respectively.
#   (use "git pull" to merge the remote branch into yours)

Is there any way for me to rebase the commits from develop into my branch and squash my two commits into one as I am attempting to do? 有没有什么方法可以让我将这些提交变成我的分支并将我的两个提交压缩成一个,就像我试图做的那样?

Is there any way for me to rebase the commits from develop into my branch 有没有办法让我把提交从发展变成我的分支

You're doing this backwards. 你这样做是倒退的。 You're moving the branch develop on top of your branch, which necessarily causes it to diverge from origin/develop . 你正在将分支develop到你的分支之上,这必然导致它与origin/develop分道扬.. If your intent is to include new commits from develop in your branch, what you actually want is to rebase your branch on top of develop : 如果您的意图是在您的分支中包含来自develop的新提交,那么您真正想要的是在develop之上重新设置您的分支:

git fetch
git checkout CRM-ayrshireminis
git rebase -i origin/develop
git push -f origin CRM-ayrshireminis

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

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