Skip to content

Instantly share code, notes, and snippets.

@skywinder
Forked from dersam/gitkraken.zsh
Last active October 25, 2022 15:37
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skywinder/39d4d0708d291f40a97d45e82653f127 to your computer and use it in GitHub Desktop.
Save skywinder/39d4d0708d291f40a97d45e82653f127 to your computer and use it in GitHub Desktop.
Here is a single line to add kraken support in `.zshrc`
# Open GitKraken using the current repo directory in the cli.
alias kraken='open -na "GitKraken" --args -p "$(git rev-parse --show-toplevel)"'
# Now you can 'git kraken'!
@AnsonT
Copy link

AnsonT commented Jun 16, 2020

This seems to have been broken with recent updates to GitKraken 7.0.1

@eengstrom
Copy link

I happened to typo this and found a workaround that works with GitKraken 7.1.0 - I added a blank ('', but can be anything) argument before the `-p 'PATH``. I'm going to guess it has to do with argument parsing that GK is doing and they are stripping too many arguments before beginning parsing. My current git alias:

  kraken = !open -na "GitKraken" --args '' -p "$(cd "${1:-.}" && git rev-parse --show-toplevel) && open -a GitKraken; :"

@eengstrom
Copy link

Slight update for anyone who cares - if you happen to have a subrepo or other git-repo inside of another repo this requires a slight fix to use the current working directory instead of just the root of the current repository, so this is my current alias:

  kraken = !open "gitkraken://repo$(cd "${GIT_PREFIX:-.}/${1:-.}" && git rev-parse --show-toplevel); :"

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