Somebody pushed a branch called test
with git push origin test
to a shared repository. I can see the branch with git branch -r
.
You can start tracking all remote branches with the following Bash script:
#!/bin/bash
git fetch --all
for branch in `git branch -r --format="%(refname:short)" | sed 's/origin\///'`
do git branch -f --track "$branch" "origin/$branch"
done
Here is also a single-line version:
git fetch --all; for branch in `git branch -r --format="%(refname:short)" | sed 's/origin\///'`; do git branch --track "$branch" "origin/$branch" ; done ;