Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After fixing conflicts git still complains?

Tags:

git

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 sort-of 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?

like image 393
JP Silvashy Avatar asked Aug 31 '10 16:08

JP Silvashy


People also ask

Does Git remember conflict resolution?

The git rerere functionality is a bit of a hidden feature. The name stands for “reuse recorded resolution” and, as the name implies, it allows you to ask Git to remember how you've resolved a hunk conflict so that the next time it sees the same conflict, Git can resolve it for you automatically.


1 Answers

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.

like image 152
Mark Rushakoff Avatar answered Sep 27 '22 18:09

Mark Rushakoff