4 printf $
"Usage: %s\n" "git track-same [[REMOTE]#[BRANCH]]"
5 echo $
"REMOTE defaults to 'origin'; BRANCH is the one pointed to by HEAD."
6 printf $
"Example: $s" \
7 'git show-ref --heads | while read sha b; do git track-same "#$b"; done'
20 if ! [[ "$REMOTE" ]]; then
25 *#*) BRANCH="${1##*#}"
28 if ! [[ "$BRANCH" ]]; then
29 BRANCH
="$(git symbolic-ref HEAD)"
32 readonly BRANCHNAME
="${BRANCH##refs/heads/}"
35 git config
--add branch.
"$BRANCHNAME".remote
"$REMOTE" \
36 && git config
--add branch.
"$BRANCHNAME".merge
"$BRANCH" \
37 && echo $
"Options set."