go get -u github.com/giannimassi/git-checkout-interactiveIf $GOBIN is available in your $PATH the command can be used as git checkout-interactive.
You can also add the following to your .gitconfig to provide a simpler to use alias for this command:
[alias]
cb = checkout-interactive --sort=-committerdateAfter adding this alias you can simply call this to choose a branch from the latest ones:
git cbThis is just an example, you can add flags and arguments as needed in the alias.
git checkout-interactive <git branch arguments and flags>Displays the current branch and allows to circle through branches listed with git branch and the provided flag and arguments.
- press down/left/j to select next branch
- press up/right/h to select previous branch
- press enter to checkout selected branch
- press ESC or ctrl-c to exit without any changes
git checkout-interactiveChoose a branch to checkout among the local branches.
git checkout-interactive -aChoose a branch to checkout among all branches, both local and remote.
git checkout-interactive --sort=-committerdateChoose a branch to checkout among the local branches listed by most recent commit.