Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: merge conflict and commit message [duplicate]

Tags:

git

merge

I merge with Git and get a conflict. After having resolved the conflicts, upon commit I will see an auto-generated commit message containing a list of files which were in conflict. What is the best-practice - should I keep this list of conflicting files for a good reason or can I delete this part of the commit message?

like image 838
Mot Avatar asked Jul 30 '12 19:07

Mot


People also ask

Can you commit with merge conflicts?

A merge conflict is an event that takes place when Git is unable to automatically resolve differences in code between two commits. Git can merge the changes automatically only if the commits are on different lines or branches.

How do you accept both changes in a merge conflict?

The only way to "accept both" would be to just re-stage (marking as resolved) the conflicted files without resolving them ( >>> and <<< would be there still), but your result couldnt be compiled or executed. And this is terrible practice, even if you make commits later to resolve.


1 Answers

For whatever it's worth, keep. If the file borks down the line, this helps you determine where a merge might have occurred with unintentional consequences.

Often, an "unconflict" involves judgement calls where the merger knows one branch better than the other (b/c s/he worked on it) or doesn't know either branch well at all. Relatively uninformed, even if well-meaning, judgement calls can often spell trouble. Easier to grep which merge unconflicted with those lines in there.

Your mileage may vary, I am not a lawyer.

like image 139
ruffin Avatar answered Sep 27 '22 21:09

ruffin