Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> "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.



Kind of related:

The usual pattern of a copy command:

copy source destination

The pattern of git push command

push destination source:destination

http://perlalchemy.blogspot.com/2011/04/git-push-and-other-c...


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.


Wait, what exactly happens in that last one that I shouldn't dare do?


I should have written:

  git branch --set-upstream origin/foo
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.


which invalidates part of your point, because --set-upstream is now _deprecated_.


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?


--set-upstream is deprecated in this release.


Deprecated, but not removed yet. It "may be removed in a relatively distant future"


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.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: