Created
May 7, 2019 10:59
Star
You must be signed in to star a gist
ZSH Helpers for git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List with git branch next to them (requires gawk). (brew install gawk) | |
ls-git () { | |
ls -alF "$@" | gawk '{ | |
match($0,/^(\S+\s+){8}(.+)$/, f); | |
b = ""; | |
c = "git -C \""f[2]"\" branch 2>/dev/null"; | |
while ((c|getline g) > 0) { | |
if (match(g,/^\* (.+)$/,a)) { | |
b="("a[1]")" | |
} | |
}; | |
close(c); | |
print $0,b | |
}'; | |
} | |
# Update all repositories (inside ~/Sites) | |
alias git-refresh="find ~/Sites -maxdepth 1 -type d -print -execdir git -C {} pull \;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment