Jeff King <peff@xxxxxxxx> writes: > I think: > > git checkout --guess origin > > would make sense to dereference origin/HEAD to "foo", as if we had said > "git checkout foo". That's the explicit part that seems safe. My > question is whether: > > git checkout origin > > should likewise do so. I see. I think "--guess" is by default true, so unless you have checkout.guess=false configured, my answer to the above question is yes. > As you note, one can always use --detach to make > their intention clear, and checkout is a porcelain, so we are OK to > change it. But would users find that annoying? I frequently use "git > checkout origin" to get a detached HEAD pointing at your master (e.g., > because I want to reproduce a bug, or do a "something like this..." > patch). I'm sure I could retrain my fingers, but I wonder if I'm not the > only one. My fingers say "git checkout X^0" instead of "--detach" when I want to detach for any value of X (e.g. "HEAD", "v2.28.0"). But I do understand people like to be implicit when they can. > Doing it for only an explicit "--guess" turns that feature into a > tri-state (explicitly off, explicitly on, or "implicit, so be a little > more conservative"). Which perhaps is harder to explain, but I think > cleanly adds the new feature in a consistent way, without really > changing any existing behavior. Hmmmm... I do not offhand know if that is a good idea or not. > Related, I assume that: > > git checkout --guess origin/foo > git checkout origin/foo > > should behave the same as their "origin" or "origin/HEAD" counterparts > for consistency (obviously making "foo" in the former case, and either > detaching or making "foo" in the second case, depending on what you > think of the earlier paragraphs). I think that is what I said in the "what would happen if we tweaked" paragraph about using origin/ prefix as a disambiguator? Then yes, I think we are in agreement. Thanks.