Skip to content

Instantly share code, notes, and snippets.

@motin
Last active January 10, 2023 18:57
Show Gist options
  • Save motin/5896c5b04d039aac48e6a2985d12171b to your computer and use it in GitHub Desktop.
Save motin/5896c5b04d039aac48e6a2985d12171b to your computer and use it in GitHub Desktop.
Add as SourceTree custom action: Open in Seperate Window (checked), Script to run `/path/to/commit-using-commitizen-in-new-iterm-window.sh` (this path MUST NOT contain spaces due to long-standing SourceTree bug https://jira.atlassian.com/browse/SRCTREE-2150), Parameters: `$REPO`
on run argv
set repoPath to (item 1 of argv)
tell application "iTerm"
set newWindow to (create window with default profile)
tell current session of newWindow
write text "cd " & quoted form of repoPath & " && npx git-cz"
end tell
end tell
end run
#!/bin/bash
# this wrapper makes sure that $REPO is the only argument
# specified in the custom action's Parameters field and is necessary
# due to https://jira.atlassian.com/browse/SRCTREEWIN-2291
osascript /path/to/commit-using-commitizen-in-new-iterm-window.scpt $@
exit 0
@GlennM
Copy link

GlennM commented Mar 27, 2020

Could you help please? Getting the following error in SourceTree while using these scripts and running the custom action:

launch path not accessible

@jason-fischer-fp
Copy link

Could you help please? Getting the following error in SourceTree while using these scripts and running the custom action:

launch path not accessible

Make sure to make the .sh file is executable:

chmod u+x commit-using-commitizen-in-new-iterm-window.sh

@doubleLLL3
Copy link

💯

@rinogo
Copy link

rinogo commented Jan 10, 2023

Note to others: Ensure you set permissions for the .sh script (as described above) and set the Custom Action settings as described in the Description of this Gist!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment