This will add a new command to git called recent-branches.
It will list the last 10 branches you looked at and allow you to switch to them by number.
- Clone the repository
- Make a symlink to
git-recent-branchessomewhere in your $PATH (i.e./usr/bin/git-recent-branches) - Type
git recent-branchesinside a git working directory
- Ruby 1.9+
- Grep
- Awk
NOTE: I've only tested this on Linux - it almost certainly won't work on Windows, but might work on OSX
git recent-brancheswill show you the list and allow to type in a branch number to check it outgit recent-branches Xwill switch to branch X in your history
It uses git config for configuration and currently has only two options:
recent.limit Xwill limit the number of branches shown in the recent list to Xrecent.showcurrent 1will include the currently checked out branch in the list. Defaults to 0
I tend to add the following aliases to my git configuration to make this command easier to use:
[alias]
rb = recent-branches
lb = recent-branches 0