mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
feat(git): add listing latest branches
add glb function to git plugin which allows listing the latest X branches (10 by default) make it easy to work with multiple branches when it is hard remembering the names
This commit is contained in:
parent
1dc87da9e6
commit
92a9fee013
2 changed files with 7 additions and 0 deletions
|
|
@ -268,6 +268,7 @@ receive further support.
|
|||
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote. |
|
||||
| `gbda` | Deletes all merged branches |
|
||||
| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
|
||||
| `glb` | List latest switched to branches (default 10, can use glb X to get latest X branches)
|
||||
|
||||
### Work in Progress (WIP)
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,12 @@ function grename() {
|
|||
fi
|
||||
}
|
||||
|
||||
# List latest X (default 10) used branches
|
||||
glb() {
|
||||
local count=${1:-10}
|
||||
git reflog | grep 'checkout: moving' | awk '{print $8}' | awk '!seen[$0]++' | head -n "$count"
|
||||
}
|
||||
|
||||
#
|
||||
# Functions Work in Progress (WIP)
|
||||
# (sorted alphabetically by function name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue