What's the Difference Between "--set-upstream" and "--set-upstream-to" in Git?

Starting git v1.8.0+, the --set-upstream-to option was added to the git branch command to replace the older (and now deprecated) option, --set-upstream. Both commands set the upstream for a local branch.

--set-upstream was deprecated in favor of --set-upstream-to for the git branch command to avoid confusion with the --set-upstream option available with the git push command (which is slightly different).

This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.