From b90789d369c5500fa85a0954869626e8aa3566ce Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 4 Aug 2020 18:22:40 +0300 Subject: [PATCH] Feat(fix-detached-head): Replace `branch -r` by `for-each-ref` Use `git for-each-ref` instead of `git branch -r | sed`. --- detached-head/fix-detached-head | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detached-head/fix-detached-head b/detached-head/fix-detached-head index bb75941..44b9844 100755 --- a/detached-head/fix-detached-head +++ b/detached-head/fix-detached-head @@ -12,7 +12,7 @@ if [ "${#branches[*]}" -eq 0 ]; then fi if [ "${#branches[*]}" -eq 0 ]; then - branches=(`git branch --points-at=HEAD -r | sed 's!^ *origin/!!'`) + branches=(`git for-each-ref --format="%(refname:lstrip=3)" --points-at=HEAD refs/remotes | sort -u`) fi if [ "${#branches[*]}" -eq 0 ]; then -- 2.39.5