Tip of the day: Kompare with git and svn
This is a short blog post based on this wonderful tip, which I have slightly modified.
I have been using svn for a couple of years now as a backup and versioning of my work. It works very well as a personal backup, but I have understood that for collaboration, git is superior. After all, Linus Torvalds himself says so!
In any case, this tip can be applied both to svn and git. Add the following code in your ~/.bashrc:
git "$@" | kompare -
svn "$@" | kompare -
This is called functions. I have blogged about another tip using functions before. You can change the names of the functions (kg and ks) as you want. You need to do so if you already have some other script or similar that is named kg or ks. You can check this by simply typing “kg” or “ks” in terminal before you add these functions. You should get the error “command not found”. In principle you could add this functionality to the svn configuration file instead, but Kompare does not work properly here. It does not understand the option handles that is parsed (is this the correct usage of the term parse?) through when using an “external” diff viewer.
You can probably use this tip with mostother editors and diff viewers as well, just change the entry “kompare” to the name of your favourite diff viewer/text editor. Now, when you are inside a svn project in terminal, you can write e.g. “ks diff -r 3:5” which will show the difference between revision 3 and 5 in Kompare. Similarly you can write in a git project “kg diff -r 3:5”, “kg show -v” and so on. You are basically writing the same commands as before, just replacing git with kg, and svn with ks.
Hope someone finds this as useful as I did!