Monday, 3 August 2009

GrokGit: Launchy & Git Bash – Perfect Unison

image I thought I would share this little nugget of info as part of my “GrokGit” series.

As you know, I am aiming to master the command line with Git rather than the GUI. It’s no secret that GUI’s are inherently slow – and I am aiming to improve my productivity as much as possible so screw that!

What is Launchy?

Launchy is a great application that is VERY high up on my tools list. It allows you to create shortcuts to programs and URL’s so you can quickly access them. I would strongly recommend giving it a whirl.

Here is a quick rundown of my setup:

  • WIN + ESC – Opens Launchy.
  • I have two folders added to the “Catalogue”:
    1. A local folder for shortcuts specific to that machine (useful for programs that are work/home specific).
    2. A folder that is shared via Live Mesh which syncs to all my computers. Great for shared applications with common paths etc.
  • From the Launchy Plugins I use:
    • Weby to set location-specific favourites.
    • Runner to set location-specific command line shortcuts.

“Runner” is the one that we are interested in at this point.

Setting Up Runner in Launchy to Run Git Bash

Pretty simple for this one:

  • Open Launchy, right click > “Options” > “Plugins” > “Runner”.
  • Click the “+” button to add a new item.
  • Enter the following:
    • NameGit Bash
    • ProgramC:\WINDOWS\system32\cmd
      (Obviously change the path as required to point to your Windows directory).
    • Arguments
      /c "pushd $$ && "C:\Program Files\Git\bin\sh.exe" --login -i"
      (Again, alter the path as appropriate to point to your Git install) – Also note you need ALL of the above (including the “/c” and the quotation marks).

Using the New Shortcut

Now that we have created our Git runner, lets use it!

  • Press WIN + ESC (or whatever your shortcut is to bring up Launchy).
  • Type “Git – “Git Bash” should appear or will appear in the dropdown if you have similarly-named items in Runner already (the reason I say only type “Git” is that Launchy remembers what you use).
  • Press “TAB” – A small “>” should appear next to “Git Bash”.
  • Start typing in the path to your “working folder” (the one with a “.git” directory in it). Notice you get the autocomplete support from Launchy.
  • Hit “Enter” – BAM! The Git Bash prompts fires up, in your working directory and you are ready to rock and roll with source control! :D

Hope this little nugget comes in useful. I use it like 600 times a day* :)

* Yes, these figures are massively inflated, but I do use it a LOT.

1 comment:

  1. This is awesome, never knew pushd exsisted. I used '/c cd "C:\Project\" && pushd && sh.exe --login -i' (provided sh.exe is in your path) without the single quotes and it opened bash right to the directory I wanted.

    Thanks Rob, have just made my life a lot easier :).

    ReplyDelete