Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send merge conflicts to collaborators to resolve in Git

While resolving merge conflicts, if I don't know which one to pick (because I'm not aware of any of the two changes), I would like to

  1. create a patch, or
  2. create separate branch (kind of), or
  3. anything else which can be done,

so that I can send the conflict to my teammate for him to resolve conflict.

Note: Aborting the merge and asking my teammate to merge is one way in such a situation. However, that would mean all the conflicts that were resolved were a waste of effort, and others who will merge now will have to repeat all the resolutions again. So, that's not an option.

like image 503
IsmailS Avatar asked May 30 '14 10:05

IsmailS


1 Answers

You should commit your patch in a different branch. Then the other team-mate should do the merging and solve the conflicts accordingly. Remember to give a nice message of what did you change so if the other person have conflicts with your code he knows what is new.

Do not commit unresolved conflicts since this can be forgotten and give problems in the future.

To create a branch out of the current branch just do

git checkout -b newBranchName

then just commit and push the branch

git commit -m "message here"
git push origin newBranchName

the other person should pull and merge and then erase this new branch if necessary

EDIT:

I saw your update... so, what you should do (though I will not recommend it) is create another branch, add the files that have merge conflict use the git add file command to remove the conflict status, and then in the message of the commit say which files have a conflict....

You should see the logs or use git blame file, to see which parts are new or not. And try to solve them yourself. There is no partial resolution of conflicts in GIT.

like image 59
api55 Avatar answered Oct 04 '22 14:10

api55