Skip to content

Instantly share code, notes, and snippets.

@skywinder

skywinder/gitkraken.zsh

Forked from dersam/gitkraken.zsh
Last active Apr 12, 2021
Embed
What would you like to do?
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'!
@skywinder

This comment has been minimized.

Copy link
Owner Author

@skywinder skywinder commented Dec 30, 2019

or same with function, if you like it more:

kraken () {
	/Applications/GitKraken.app/Contents/MacOS/GitKraken -p "$(git rev-parse --show-toplevel)" &>/dev/null &
}
@eengstrom

This comment has been minimized.

Copy link

@eengstrom eengstrom commented Jun 3, 2020

Does this still work for you under Catalina? I used something similar for a long time and now it opens GK, but not the repo/folder.

@skywinder

This comment has been minimized.

Copy link
Owner Author

@skywinder skywinder commented Jun 4, 2020

Does this still work for you under Catalina? I used something similar for a long time and now it opens GK, but not the repo/folder.

yes, it works

@eengstrom

This comment has been minimized.

Copy link

@eengstrom eengstrom commented Jun 4, 2020

I should have been more specific. It works if GK is not open, but if the app is open, it this will no longer cause GK to acquire focus and change or open a tab for the repository given on the command line. Does that work for you?

@AnsonT

This comment has been minimized.

Copy link

@AnsonT AnsonT commented Jun 16, 2020

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

@eengstrom

This comment has been minimized.

Copy link

@eengstrom eengstrom commented Jul 27, 2020

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

This comment has been minimized.

Copy link

@eengstrom eengstrom commented Apr 12, 2021

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