Identify potential merge conflict files before merging

Lets say you are in a fea­ture branch but even before you merge in the changes in your mas­ter branch into your fea­ture branch, you want to know which files are likely to cause merge con­flicts before you even ini­ti­ate the merge.

The sim­plest way to do that is to check which are the com­mon files that have been mod­i­fied between your mas­ter branch and fea­ture branch

git diff --name-status master..HEAD | grep M

The –name-status option anno­tates the files com­monly mod­i­fied between the two branches with an M. Grep­ping by that, you can get what you need.


Ryan Sukale

Ryan is a UX engineer living in San Francisco, California.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *