Move `git-track` into its own autoloadable function. This way it is better maintainable as in one-liner format and brings the possibility of having more complexity (e.g. for better portability). By that it is also now executable as `git-track` as well as `git track` as before.
16 lines
387 B
Bash
Executable File
16 lines
387 B
Bash
Executable File
#!/usr/bin/env zsh
|
|
|
|
git for-each-ref --format='%(upstream),%(refname)' refs/heads refs/remotes \
|
|
| sort -d \
|
|
| sed -Ez '
|
|
s:(^|\n|,)refs/(heads|remotes/):\1:g
|
|
s:(^|\n),([^/][^\n]*):\1\2,:g
|
|
s:,/:,:g
|
|
s:(^|\n)([^,]+),\n\2:\1\2:g
|
|
s:(^|\n)([^/,]*)([^\n]*\n\2(,|/))*:\n&:g
|
|
s:\n+$:\n:
|
|
' \
|
|
| (echo remote,local; cat) \
|
|
| column -tdLs, -Na,b -Ob,a \
|
|
| sed '2d; 1{p;s/./―/g}'
|