How to launch Git Extensions from Git Bash on Windows
Typically when I'm working on a piece of software, I leave an msysgit bash prompt open in the current project directory. Over time I've come to prefer using the command line for some git operations (clone, fetch, pull, rebase, push, checkout, branching) and the Git Extensions UI for others (commit, view log, examining prior commit details, diffing).
For various esoteric and obsessive compulsive reasons, I don't like installing shell extensions and I don't like leaving Git Extensions sitting open all the time. This setup makes launching Git Extensions a bit tedious (go find the shortcut, double-click it, wait for it to open, tell it to open the git repository I'm working out of...), especially when I find myself needing to do this repeatedly in a short period of time.
What I want then, is to be able to launch Git Extensions just like gitk, from the git bash shell. Fortunately, this is relatively simple to accomplish.
What you need to do first is open your text editor of choice using run as an administrator. Then paste the following into a new file:
#!/bin/sh "$PROGRAMFILES\GitExtensions\GitExtensions.exe" "$@" &
You will need to adjust the path to match your Git Extensions installation directory if you did not install it in the default location.
Save the file as "git-ex" with no extension in the msysgit bin folder. This will be either "C:\Program Files (x86)\Git\bin" if you're running 64 bit Windows or "C:\Program Files\Git\bin" if you're running 32 bit Windows.
Fire up a new instance of git bash, and type "git ex". Git Extensions should open straight to the current repository:
You can also include Git Extensions command line arguments in order to jump straight to specific command windows. For example, typing "git ex commit", will open the Git Extensions commit dialog:
And if your're wondering precisely what Git Extensions command line options are at your disposal, here they are:
browse add addfiles apply applypatch branch checkout checkoutbranch checkoutrevision cleanup clone [path] commit [--quiet] filehistory [file] formatpatch init pull [--rebase] [--merge] [--fetch] [--quiet] push [--quiet] settings viewdiff rebase [--branch name] marge [--branch name] cherry tag stash synchronize [--rebase] [--merge] [--fetch] [--quiet]
And that's it. Now you can revel in your newly found git bash Git Extensions launching command line glory.
UPDATED (2012-03-24): Changed bash script to use $PROGRAMFILES environment variable & changed script name to git-ex based on feedback from Pat Thoyts.comments powered by Disqus