Open in Tower
Summary: Opens the Git file history of the current file in Tower.
Requires: Tower
Install Location: ~/Library/Scripts/Applications/
Last Modified: 2026-10-06
Description
This script opens in Tower the Git file history of the current file. The current file is the active document in BBEdit or Xcode or the selection in Finder, depending on which app is frontmost.
Installation Instructions · Download in Compiled Format · Download in Text Format
Script
if my isFrontmost("BBEdit") then
tell application "BBEdit"
my openFileHistory(text document 1's file)
end tell
else if my isFrontmost("Xcode") then
tell application "Xcode"
my openFileHistory(file document 1's file)
end tell
else if my isFrontmost("Finder") then
tell application "Finder"
my openFileHistory(selection as alias)
end tell
end if
on isFrontmost(_appName)
-- Check without launching app
tell application "System Events"
return (exists process _appName) and (frontmost of process _appName)
end tell
end isFrontmost
on openFileHistory(_file)
set _quotedPath to _file's POSIX path's quoted form
-- Tower will complain if the CWD isn't set to a folder in the file's repo
set _script to "cd $(dirname " & _quotedPath & ") && "
set _script to _script & "/usr/local/bin/gittower history " & _quotedPath
do shell script _script
end openFileHistory