Programmable completion for git and mercurial

Some time ago i read excellent post about emacs library pcomplete. The author described implementation of completion for git, mercurial version control system using this library. Article is really usefull, i used code as is, its easy and provides all you need, but later i have some problem with it. First problem - eager evaluation. General commands for git and mercurial are calculated once. Great, there is no reason to call external process like git or hg multiple times but precalculation occured at script evaluation.

PATH variable for gui programs (Mac Os)

Foreword: Sometimes you need to edit PATH variable. Of course you edit .bash_profile, .bashrc, .profile or other scripts and this works fine only in terminal. GUI apps at Mac Os use its own PATH variable (moreover has its own environment), which can be set using ‘launchctl setenv PATH <PATH_VALUE>’. So you need to setup PATH for GUI apps correctly, and do not forget about PATH var for terminal. Moreover, after update to Mac Os X 10.

Git rerere

There is some usefull git command rerere (reuse recorded resolution). Sometimes especially for long lived branch you need to resolve same conflicts again and again. This command let you save the results of conflict resolution and apply it again when needed. Let see how its works: # create test repo git init rerere # move to it cd rerere # enable rerere - reuse recorded resolution (its disabled by default) git config rerere.

Platform specific build event

Sometimes you need to build .net solution/project on different platforms (for example while developing xamarin based application). In that case pre/post build events may contain platform specific instructions. To handle this situation you can use ‘Condition’ attribute and ‘OS’ variable, for example, like this: <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' "> <!--windows specifics --> copy $(TargetPath) $(ProjectDir)../Assemblies /Y </PostBuildEvent> <PostBuildEvent Condition=" '$(OS)' == 'Unix' "> <!--*nix, mac specifics --> cp -f $(TargetPath) $(ProjectDir).

Git log aliases

Here are some usefull git aliases which i use on a daily basis: Output samples are generated using clojure repository List of one line commits ls = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %C(bold blue)<%an>%Creset' List of commits with changed files ll = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %C(bold blue)<%an>%Creset' --decorate --numstat List of commits without colors lnc = log --pretty=format:"%h\\ %s\\ [%cn]" Commits with dates ldt = log --all --pretty=format:'%Cred%h%Creset %Cgreen%ad%Creset -%C(yellow)%d%Creset %s %C(bold blue)<%an>%Creset' Commits with short dates