A branch without an upstream gives you There is no tracking information for the current branch on every git pull. You can fix that without pushing.
git branch -u origin/main
-u is short for --set-upstream-to. It sets the upstream of the current branch to origin/main, and git confirms with branch 'fix' set up to track 'origin/main'. From then on, git pull and git status compare with that branch. To set it for another branch, name it at the end: git branch -u origin/develop topic.
I’d use this in two cases. One is when a branch was created from a local commit and later turns out to belong to a remote branch someone else pushed. The other is when I want a local branch to follow a different remote branch than the one it was made from, for example the upstream repository in a fork instead of your own copy.
To remove the link again, there’s git branch --unset-upstream.
The remote branch must already exist in your clone, so fetch first. Setting it doesn’t push or pull anything; it only changes the config. That also means git push may still go elsewhere, since push follows its own rules in push.default. With the default simple, a push is refused when the names don’t match.
Further reading: git-branch documentation