Skip to content

Instantly share code, notes, and snippets.

@pawcik
Created September 20, 2018 07:21
Show Gist options
  • Select an option

  • Save pawcik/37877158e8ba46742633132c2689becf to your computer and use it in GitHub Desktop.

Select an option

Save pawcik/37877158e8ba46742633132c2689becf to your computer and use it in GitHub Desktop.
Set fish "bgr" abbreviations that expands to current git branch
function __set_gbr_abbr --on-variable PWD
# Check if we are in a git repository
if command git rev-parse --is-inside-work-tree >/dev/null 2>&1
set base_command "gbr=git commit --message \"#"
set branch (git symbolic-ref --short HEAD 2>/dev/null)
abbr gbr $branch
else
abbr -e gbr 2>/dev/null
end
end
# vim: set ts=2 sw=2 tw=0 et ft=sh :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment