سؤال

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
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top