Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - resolve conflicts partially and send changes to somebody else to finish solving

Tags:

git

conflict

I would like to know if there is a way to solve some conflicts (caused by merge or rebase) and send it to another person who will solve the rest of conflicts. It sometimes happens, eg. you work on a branch you derived and when it comes to merging it may me better if the person responsible for merging those particular changes is the author of them. Or if you need few changes in stylesheets and ask design team to do them so you can finish your work and then you have conflicts in stylesheets you have never touched.

like image 934
Michał Pawłowski Avatar asked Sep 20 '13 08:09

Michał Pawłowski


People also ask

What happens in Git when a conflict occurs between your changes and someone elses?

Two ways git merge/git pull can fail This occurs because you have committed changes that are in conflict with someone else's committed changes. Git will do its best to merge the files and will leave things for you to resolve manually in the files it lists.

How do you resolve conflicts in Git?

Git commands that can help resolve merge conflicts The status command is in frequent use when a working with Git and during a merge it will help identify conflicted files. Passing the --merge argument to the git log command will produce a log with a list of commits that conflict between the merging branches.

Can Git automatically resolve merge conflicts?

When you pull or merge branches, Git will select the recursive strategy as default. The recursive strategy only can detect and do merges which involve renames, but cannot use detected copies. The ours option forces conflicted parts to be automatically resolved by favoring 'our' version.


1 Answers

The conflicts are being resolved locally on your repo. You would have to provide the other individual access to your local directly (sitting at your machine, copying the files to a usb, etc). You can't resolve some conflicts and leave the rest for someone else to resolve (I can see that leading to conflicts not being resolved as everyone points figures at someone else) There is not internal feature to git for handling this situation, you will have to consult the person responsible or make a judgement yourself.

If you only need some files from the repo, you can do git checkout <branch-name> -- <file1> <file2> and then update those files. But this can still lead to conflicts and confusion about who made what change when your branch gets merge back in.

For the most part, keeping your project branch up-to-date with regular merges/rebases should minimize the conflicts when you are requesting changes. But once you have a conflict, you will need to resolve it in some way.

If the file is one that you never touched you can just checkout the file from the branch that you are rebasing/merging and take the changes from that.

git checkout <merging-branch> -- <conflicted file>

like image 120
Schleis Avatar answered Sep 28 '22 05:09

Schleis