Hacker News new | past | comments | ask | show | jobs | submit login

Using a modern shell like fish and cli tools like fzf, sed, sort etc together to create abbreviations (not aliases in fish) give you 100x more features than this.

I type ck and get a fzf list of local and remote branches I can fuzzy search and select to checkout.




Care to share?


Sure! Using Fish shell run the code below. abbr creates and abbreviation (slightly different from an alias and imho much more useful), see https://fishshell.com/docs/current/cmds/abbr.html

My git checkout abbr requires git,fzf to be installed

abbr --add ck 'git branch -a | string replace -a \'origin/\' \'\' | string replace -a \'remotes/\' \'\' | sort -u | fzf | read branch; git checkout $branch'

To use just type ck and then you can narrow the branch list by typing some letters, then arrow keys to select the branch hit enter, boom.


This is awesome, thanks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: