Innovative Computer Solutions,
Development & Technical Support

07975 997026 • enquiries[delete-me]@[delete-me]

User Tools

Site Tools


hArpanet BLOG

Random meanderings covering any topics that we may currently be investigating or interested in.

Using WinMerge with Git

After installing GitHub for Windows, the default Merge Tool is configured as Beyond Compare (a commercial file comparison package). WinMerge is also an excellent tool for comparing file differences under Windows, and has the benefit of being free.

Configuring Git to use WinMerge is very straightforward…

* First, download WinMerge ( and install it as normal.

* I am assuming you already have GitHub for Windows installed and configured, but if not you can find it here: - come back to these instructions when you are more familiar with GitWin.

I am using the portable version of WinMerge, which I have stored in e:\apps\WinMergePortable\WinMergePortable.exe and these instructions use that. For a conventional install of WinMerge, just change the path to the file. Tip: make a note of the full drive and file path as you will need to enter it below.

* Open up GitWin and open any repository you have created * Click the 'cog' icon in the top right corner

  • On the cog menu, choose 'Open a shell here'
  • (Alternatively, in the Windows Start Menu for GitHub, Inc you can click the 'Git Shell' shortcut)

It doesn't matter which repository you choose to run the shell for, as we are setting global settings below that apply to all repositories.

MergeTool or DiffTool

Git uses two tools which can be slightly confusing for some.

* The difftool is like using a 'Read Only' version of WinMerge. It doesn't let you change anything, it just shows you the difference between two files. * The mergetool is the tool that lets you fix any file conflicts when merging between branches in Git. In most cases it is the 'mergetool' that people want to configure to gain a visual way of fixing merge conflicts, so we will do that first.

Configure WinMerge as the MERGE TOOL

In the Shell window, we need to run the following two commands individually:

git config --global merge.tool winmerge
git config --global --replace mergetool.winmerge.cmd "e:/apps/WinMergePortable/WinMergePortable.exe -e -ul -ur -dl \"Base: $MERGED\" -dr \"Mine: $REMOTE\" $MERGED $REMOTE"

In the first command, we are setting a Git variable named merge.tool to the value winmerge. This tells Git to run winmerge when the merge.tool is called.

In the second line we are defining the command that should be executed when the merge.tool is called. Note the following in this line above:

* We use forward slashes / in the path, NOT back slashes, because back slashes are treated as 'escape' symbols;

* The \” entries around the text strings are creating 'escaped' apostrophes so that they are not confused with the apostrophes around the entire command;

* We are using the Git $MERGED and $REMOTE variables to indicate the files to be compared/merged.

  • The $MERGED variable contains the file created by Git when it found a conflict during the merge attempt;
  • The $REMOTE variable contains the file that you are attempting to merge into the current repository

Now, when you get a response similar to the following…

Automatic merge failed; fix conflicts and then commit the result.

… you can run git mergetool to try and resolve the conflicts visually.

Configure WinMerge as the DIFF TOOL

In a very similar manner to above, we can use WinMerge to show us the difference between two files. In the Shell window, this time run the following two commands individually:

git config --global diff.tool winmerge
git config --global difftool.winmerge.cmd "e:/apps/WinMergePortable/WinMergePortable.exe -e -ul -ur -wl -wr -dl \"Local: $LOCAL\" -dr \"Remote: $REMOTE\" $LOCAL $REMOTE"

You will notice a few slight differences:

* We are defining the diff.tool variables this time; * We have added -wl and -wr to the command line, which are WinMerge's options to make the left and right files 'Read-Only'; * We are using the $LOCAL and $REMOTE file variables this time (there is no $MERGED variable as we are not merging across branches);

Now you can run the following command to compare two files:

git difftool <branch1> <branch2> -- <filename to compare>

Its My Kano not Meccano

The Kano Kit image

With all the wonderful hoorah lately about the up-and-coming Year of Code backed by the Mother of computer programming in the UK (the BBC), I'm very excited to have got my pre-order in for the awesome looking Kano…

Google's 15th Birthday

Oh my sweet fanny adams, how did we get here so soon! For those of us that treat Google as just another search engine, having come from the likes of Gopher and AOL, we wonder where the time has gone.

And what of the kids today - where Google is as ubiquitous as Water; they've never known it not to be there - frightening.

And where have we got to - what heights have we achieve in the past 15 years. Well, if Google's doodle celebration is to be taken as our greatest achievement, then we have managed to…. hit a swinging star with a stick in order to get some sweets!

Under Milk Wood - Dylan Thomas - FREE Kindle eBook

“It is spring, moonless night in the small town, starless and bible-black, the cobblestreets silent and the hunched, courters'-and-rabbits' wood limping invisible down to the sloeblack, slow, black, crowblack, fishingboatbobbing sea.”

Creating a new SublimeText 3 Syntax Highlighting Language


First, create a new package in: SublimeText3/Data/Packages with a relevant name, eg. myLang


Second, create a new language file(this is simply a text file containing XML) in your new package, eg. myLang.tmLanguage


A Better DokuWiki Configuration Manager Settings Page

As you add more plugins to DokuWiki, the Configuration Settings (Configuration Manager) page quickly gets very long with all the various settings for each of the plugins.

A very simple addition to DokuWiki would be to have each plugin region show just the heading to begin with, then show the relevant options when the heading is clicked on. In effect, expanding and contracting those sections as required.

blog/index.txt · Last modified: 16/09/2013 13:28 by harpanet