Git Merge Conflicts

Merge conflicts can show up when you do a ‘git-merge’ or a ‘git-rebase’:

https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging

One way you can “anticipate” a git merge is with the ‘diff’ command

Here’s some bash pseudo code using command substitution:

diff -y <(git show branchA:file.txt) <(git show branchB:file.txt)

Remember though ☝️

A diff will always yield results, that’s what a patch is..

The key is when the SAME LINES are being changed: That’s the conflict! 😉

If the lines from diff don’t overlap…you can probably assume the merge or rebase won’t produce a conflict

(at least, for the file you looked at😊)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: