> "git branch --set-upstream" is deprecated and may be removed in a relatively distant future. "git branch [-u|--set-upstream-to]" has been introduced with a saner order of arguments.
It would be great if changes to the git CLI were thoroughly thought through instead of one-off fixes like this. This is the reason the interface is such a mess.
git branch foo --track origin/foo
But if you forgot --track:
git branch foo
then it's:
git branch foo --set-upstream-to origin/foo
and don't you dare do
git branch --set-upstream-to origin/foo
Upstream and track are the same - why two different words?
And now we have --set-upstream-to and --set-upstream, which will be fun for git newbies to distinguish.
It does occasionally feel like the CLI development happens with a very short time scale imagined rather than planning it out, which is slightly odd given Linus' involvement.
This counter-intuitively creates a LOCAL (!) branch named origin/foo which tracks the current branch. I would expect this to set the upstream of the current branch, given that most commands operate on the current branch unless otherwise specified. Instead it does something completely unexpected and useless.
So why are you unhappy about this option being deprecated? Have you tried it in this release? It tells you it's deprecated and which options exist. If you do what you show in this command, it tells you how to undo it with the new more sensible option.
It's deprecated in the next release not this one, and it will be around for years to come. People will google and find the old way documented and have to read up on the difference, adding to the cognitivie baggage of git.
Regardless, my point is the interface is horrible and this is just adding to the patchwork. Why not add --track semantics or unify these flags?
This is what deprecated means. You can't just remove an API that's existed for years and scripts may depend on without giving them time to adapt. This shows a warning when it's used so it's clear which scripts should be changed.
It would be great if changes to the git CLI were thoroughly thought through instead of one-off fixes like this. This is the reason the interface is such a mess.
But if you forgot --track: then it's: and don't you dare do Upstream and track are the same - why two different words?And now we have --set-upstream-to and --set-upstream, which will be fun for git newbies to distinguish.