tags:

views:

38

answers:

1

I usually rebase when I pull in changes from my teammates, and often time I have conflicts:

...
CONFLICT (content): Merge conflict in app/views/search/index.html.erb
Auto-merging public/stylesheets/application.css
CONFLICT (content): Merge conflict in public/stylesheets/application.css
Failed to merge in the changes.
Patch failed at 0001 organizing

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

So after opening each file with a conflict, fixing it then committing the fixed files:

~/Projects/myApp[956f6e1...]% git rebase --continue
You must edit all merge conflicts and then
mark them as resolved using git add

I still get the same error...

~/Projects/myApp[64b3779...]% git rebase --continue                         
Applying: organizing
No changes - did you forget to use 'git add'?

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

I've sortof always had this problem, but I guess never really chose to address it, I would I always just get lazy and git rebase --skip, how do I actually resolve the conflict the right way?

+2  A: 

So after opening each file with a conflict, fixing it then committing the fixed files...

The problem is that you aren't supposed to commit the fixes. If a.txt has a merge conflict, then your shell log should look like:

$ vim a.txt # fix conflict
$ git add a.txt
$ # no commit between add and rebase!
$ git rebase --continue

Calling git rebase --continue will take care of the commit itself.

I'm not sure how to "get back" to before your commit, when you're in the middle of a rebase. git reset --hard HEAD would probably do the trick, but personally I'd feel safer just going straight to git rebase --abort and starting over without committing in the middle.

Mark Rushakoff
Yah I agree... I suppose I didn't really read the error message (per my usual workflow), `git rebase --abort` solved the immediate problem. Thanks again!
Joseph Silvashy
Happy to help! git can definitely be a little confusing at times, but I have no idea how I ever survived without it.
Mark Rushakoff