I was wondering if anyone had built a script or had a way to list git branches with numbers so that instead of this (preferably in bash)
git checkout #4
This sounds like it would be quite easy to create. A simplistic implementation could work with two one-line scripts/aliases.
git-lbr (list branch):
#!/bin/bash git branch --no-color | cat -n
git-coid (checkout id)
#!/bin/bash git checkout $(git lbr | egrep "^\s+$1\s+" | egrep -o '\S*$')
But that's a simplistic implementation with no error handling for cases with missing input / non-numeric input / out of range branch ids.
Example of use:
$ git lbr 1 branch_42 2 feature/super-feature 3 foo/bar 4 * master $ git coid 1 Switched to branch 'branch_42' Your branch is up-to-date with 'master'.