假设本地的 foo 分支追踪仓库 upstream 中的 foo 分支:
git branch -u upstream/foo
或
git branch --set-upstream-to=upstream/foo
git branch -u upstream/foo foo
git branch --set-upstream-to=upstream/foo foo
git branch --set-upstream foo upstream/foo