Tips and Tricks

Git

I recently switched from svn to git version control system for managing my research codes and other documents. I find the following advantages of using git over svn

  • No overhead of setting up any “special” repository, just a git init in the directory that you want to track would setup a git repo.

  • Branching and merging is very easy with git compared to svn.

  • All history is stored locally on your system, but git allows you to pull/merge things from a remote machine, which is very useful if you work on multiple machines and would like to merge the changes.

Listen to Linus Torvalds’ talk on git if you need some more motivation to switch to git :-)

Some related documentation and links to get started:
http://git.or.cz/course/svn.html
http://www.kernel.org/pub/software/scm/git/docs/user-manual.html
http://arthurkoziel.com/2008/05/02/git-configuration/

My .gitconfig file. If you start seeing “ESC” characters in git status or git diff then try this:

export LESS=’-erX’

zsh

I use the zsh shell, which is very configurable and can be easily integrated with terminals like mrxvt and xterm.

Special settings in my .zshrc file:

  • When I enter a git controlled directory, the shell automatically displays the current branch name. For this to work, place the S01_git script in ~/.zsh.d/ directory. Here is a small demonstration:

--(~)------------------------------------------------------------------------(varun@debian:pts/9)--
--(1:%) cd pkg-java/jajuk-mine                                                    --(01:29:23 AM)--
--(~/pkg-java/jajuk-mine)----------------------------------------------------(varun@debian:pts/9)--
--(2:master.git%) git br                                                          --(01:29:30 AM)--
  debian
* master
--(~/pkg-java/jajuk-mine)----------------------------------------------------(varun@debian:pts/9)--
--(3:master.git%) git co debian                                                   --(01:29:32 AM)--
Switched to branch 'debian'
--(~/pkg-java/jajuk-mine)----------------------------------------------------(varun@debian:pts/9)--
--(4:debian.git%) git co master                                                   --(01:29:35 AM)--
Switched to branch 'master'
--(~/pkg-java/jajuk-mine)----------------------------------------------------(varun@debian:pts/9)--
--(5:master.git%) cd                                                              --(01:29:37 AM)--
--(~)------------------------------------------------------------------------(varun@debian:pts/9)--
--(6:%)                                                                           --(01:29:38 AM)--
  • zsh when used with mrxvt, will automatically set the tab titles in mrxvt to the current working directory name (when idle), or the current running command, or the remote working (ssh) machine name.

Mutt and Procmail

I have been using mutt as my email client for a long time now and I use procmail to filter my emails. You will find a lot of documentation about mutt online. Here I have included some simple procmail recipes which I found very useful:

To filter googlegroups and yahoogroups emails I use these:

:0:
* ^Sender: .+@googlegroups.com
* ^Sender: \/[-a-zA-Z0-9\_]+
$MATCH
:0:
* ^Sender: .+@yahoogroups.com
* ^Sender: \/[-a-zA-Z0-9\_]+
$MATCH

Same idea can be extended to Debian mailing lists:

:0:
* ^X-Mailing-List: <.+@lists.debian.org>
* ^X-Mailing-List: <\/[-a-zA-Z0-9]+
$MATCH