themactep.com

A home of miscellaneous projects by Paul Philippov.

Notes

How to track all remote git branches

git fetch --all
git branch -r | grep -v '\->' | while read remote; do
    branch=${remote#origin/}
    if [ "$branch" != "HEAD" ] && ! git show-ref --verify --quiet refs/heads/$branch; then
        echo "Creating local branch: $branch"
        git branch $branch $remote
    fi
done
git branch -a