On software development while working with source control, it’s inevitable sometime we get our code conflicts with other, since we work in a team. There are many diff and merge tools out there and some of them can be integrated with with Git. In this post I just want to note what I did in my development machine (Windows 7 and macOS Sierra)
DiffMerge on macOS
For my macOS development machine I use DiffMerge. Actually DiffMerge is not only available for macOS, but also for Windows and Linux. So we can use it as Git diff merge tool as well on Windows and Linux. To configure Git to use DiffMerge can be done by running the following command via terminal.
1 2 3 4 5 6 7 8 9 10
The command will add the following config code in global
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
We can also directly edit the
.gitconfig and manually add the config code.
WinMerge 2.x on Windows
WinMerge is an open source differencing and merging tool for Windows. It can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle. At the time of writing this blog post, WinMerge 3 is still in progress of development and no release yet. WinMerge 3 will be modern compare/synchronization tool. It will be based on Qt library and cross-platform. You can use the same tool in Windows and in Linux. So for now and so on in this blog post, WinMerge term means WinMerge 2.x.
After installing WinMerge, to configure it as diff and merge tool of Git is by adding /editing the following config setting to
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
The config above also can be configured by Git bash shell with
–global parameter instead of manual edit via text editor.
Now, whenever you want it to launch diffs just use difftool:
1 2 3 4 5 6 7 8
To resolve merge conflicts