Basic Git Integration with BBEdit
Posted by Corey Ehmke on February 1st, 2009 in General Tech & Development | Permanent Link | Share/SaveTags: BBEdit, Freeware, Git
Update: The Git script described below has been updated, improved, and folded into the BBRails Toolkit.
In the two short years since its 1.0 release, the open-source version control system Git has grown to become the SCM of choice for open source and web development projects worldwide. Last year we took the plunge and moved all of our projects to Git from SVN. I won’t say that it hasn’t been a rocky transition, but I’m hopeful that in the long run it will prove to have been the right decision.
One of the niceties of SVN was the fact that BBEdit supported it out of the box. No such support exists for Git, unfortunately, so I found myself having to make frequent trips to the command line (or the only decent Git client I can find, GitX) for anything Git-related.
One could argue that due to its complexity— think branching, one of the strong points of Git— full-fledged Git integration would be beyond the scope of an IDE. But there are definitely basic things that would be nice to do without command-tabbing out of BBEdit.
To that end, I’ve created a basic AppleScript that lets you perform the two most common (for me, anyway) Git operations from within BBEdit: git status and git pull.

If there are no conflicts with your pull operation, the script lets you know with a dialog box.
Otherwise, the results are opened in a new BBEdit window.
Similarly, ’status’ will give you a quickly dismissable dialog box if you’re up to date,
or full list of changes in a new window.
To install:
- Download git_for_bbedit.zip (5k)
- Uncompress the archive and copy the entire folder to the BBEdit script folder in
~/Library/Application Support/BBEdit/Scripts/ -
Make sure that the accompanying shell script has execute privileges:
- Open Terminal
- Type this:
chmod +x ~/Library/Application Support/BBEdit/Scripts/Git/find_enclosing_project.sh
-
In BBEdit, assign a keyboard shortcut to the script:
- Click on Window > Palettes > Scripts
- Highlight Git, and click Set Key….
Now, with any file open in your Project window, you can activate the Git script using the keyboard shortcut you assigned. The script determines the location of your local Git repository and performs the command you select (status or pull).
Robert Hanviriyapunt’s UNIX wizardry was critical for creating the shell script to determine the current Git repository for the selected file— many thanks, Robert!
If you have any suggestions on how to improve the script, please let me know by leaving a comment below. Happy hacking…
February 1st, 2009 at 2:04 pm
I’ve got to share gitx in any git post:
http://gitx.frim.nl/
Its a a gitk that doesn’t suck!
February 24th, 2009 at 10:17 pm
Bugger off you git.
February 24th, 2009 at 10:35 pm
Peter– er, Jon– you’ve got a memory like an elephant! Thanks for the chuckle.