Reputation: 17181
I have two fresh checkouts of remote branches, one branch (crm-mania
) is a couple of months old and I am attempting to rebase it onto the main development branch (master
). So I have the following:
vagrant@localhost /var/www/current (crm-mania)$git branch
* crm-mania
master
I then do the following:
vagrant@localhost /var/www/current (crm-mania)$git checkout master
Switched to branch 'master'
vagrant@localhost /var/www/current (master)$git pull
Already up-to-date.
Then I try the rebase and I get the following (amongst other messages that I have chopped out):
vagrant@localhost /var/www/current (master)$git rebase master crm-mania
First, rewinding head to replay your work on top of it...
Applying: CRM-174: Mania Site
Using index info to reconstruct a base tree...
M app/AppKernel.php
M app/config/config.yml
M app/config/routing_crmpicco.yml
<stdin>:107: trailing whitespace.
<?php
<stdin>:108: trailing whitespace.
/**
<stdin>:109: trailing whitespace.
* @author CRMPicco <[email protected]>
<stdin>:110: trailing whitespace.
* @date 02/04/2015
<stdin>:111: trailing whitespace.
* @copyright Copyright (c) CRMPicco.
warning: squelched 1022 whitespace errors
warning: 1027 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging app/config/routing_crmpicco.yml
Auto-merging app/config/config.yml
CONFLICT (content): Merge conflict in app/config/config.yml
Auto-merging app/AppKernel.php
Failed to merge in the changes.
Patch failed at 0001 CRM-174: Mania Site
The copy of the patch that failed is found in:
/var/www/releases/20150708141200/.git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
The main issue I have is that the HEAD is now detached, e.g.
vagrant@localhost /var/www/current (HEAD)$git status
# HEAD detached at e90cb5c
I also find that if I ignore this message and try and work through my conflicts that Git is recognising "conflicts" in code that only I have worked on and only reside in my crm-mania
feature branch. They are definitely NOT in the master
branch.
Upvotes: 2
Views: 1405
Reputation: 14843
The main issue I have is that the HEAD is now detached
This is expected behavior. The way that git rebase
works is by directly checking out the destination SHA, which puts you in detached HEAD. This is coincidentally why ours
and theirs
are reversed from normal in the git rebase
scenario.
Whenever you have a merge conflict during a rebase you will always be in detached HEAD state. This will also happen if you edit
any of the commits in an interactive rebase.
As to why you are seeing unexpected conflicts, that is impossible to say without seeing changelogs for the two branches. Usually the answer is "somebody else modified the code and I didn't realize it".
Upvotes: 2