From 11dab14da355133926aa6ae0c6936f20c5eaf3aa Mon Sep 17 00:00:00 2001 From: druckdev Date: Wed, 17 Nov 2021 01:23:33 +0100 Subject: [PATCH] git:alias:track: Shorten command Shorten command by always printing a `,` as separator and differentiating between remote and head refs by a leading slash. --- .config/git/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/git/config b/.config/git/config index d30807f..2055fd3 100644 --- a/.config/git/config +++ b/.config/git/config @@ -16,7 +16,7 @@ [alias] root = rev-parse --show-toplevel spull = "!__git_spull() { git pull \"$@\" && git submodule sync --recursive && git submodule update --init --recursive; }; __git_spull" - track = "!track() { git for-each-ref --format='%(upstream)%(if)%(upstream)%(then),%(end)%(refname)' refs/heads refs/remotes | sort | sed -Ez 's:(refs/remotes/[^\\n]*)\\n\\1:\\1:g' | sed -E 's/(.*),(.*)/\\2,\\1/; s:(heads/[^,]*)$:\\1,:; s:^refs/remotes/:,:; s:refs/[^/]*/::g' | column -ts,; }; track" + track = "!track() { git for-each-ref --format='%(upstream),%(refname)' refs/heads refs/remotes | sort -d | sed -Ez 's:,([^\\n]*)\\n\\1:\\1:g' | sed -E 's:(^|,)refs/(heads|remotes/):\\1:g; s:^,([^/].*):\\1,:; s:(.*),(.*):\\2,\\1:; s:^/::' | column -ts,; }; track" [status] submodulesummary = true [diff]