本地Git分支在交互式重新分配之后已经与原点分离 [英] Local Git branch has diverged from origin following an interactive rebase

查看:239
本文介绍了本地Git分支在交互式重新分配之后已经与原点分离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个本地分支( CRM-ayrshireminis ),它有几个提交,我已经推送到原点( origin / CRM-ayrshireminis )。这个分支是在大约一周前从 develop 分支创建的,其中有一周的工作来自其他合作者。



我想要做的是将来自 origin / develop 的最新代码重定位到我的功能分支中 CRM-ayrshireminis

我做的是:

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

我有两个承诺,所以我压扁了他们,然后退出了。我收到了消息说 Rebasing(2/2),所以看起来很好......

  [crmpicco @ dev53 ayrshireminis] $ git status 
#分支CRM-ayrshireminis
#你的分支和'origin / CRM-ayrshireminis'有分歧,
#分别有2个和2个不同的提交。
#(使用git pull将远程分支合并到你的)

任何方式来重新分配提交到我的分支和压缩我的两个提交到一个,因为我试图做? 解决方案

blockquote>

有没有什么办法可以让开发人员将我的分支转化为分支


做这个倒退。您正在将分支 develop 移动到您的分支之上,这必然会导致分支从 origin / develop 发散。如果你的意图是在你的分支中包含开发的新提交,你真正需要的是在 develop 之上重新分配你的分支:

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


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). 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.

What I want to do is rebase the latest code from origin/develop into my feature branch 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...

[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. 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:

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

这篇关于本地Git分支在交互式重新分配之后已经与原点分离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆