Created
September 20, 2018 07:21
-
-
Save pawcik/37877158e8ba46742633132c2689becf to your computer and use it in GitHub Desktop.
Set fish "bgr" abbreviations that expands to current git branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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