git set remote tracking branch

C++
git branch --set-upstream-to <remote-branch>

// example
git branch --set-upstream-to origin feature-branch

// show up which remote branch a local branch is tracking
git branch -vv

// short version to set upstream with very first push
git push -u origin local-branchgit branch --set-upstream-to=origin/branch
git branch --set-upstream foo upstream/foo
git remote add upstream [email protected]:some-gatekeeper-maintainer/some-project.gitgit config --edit
git branch -u upstream/foo

Source

Also in C++: