Closed tracyone closed 6 years ago
I didn't realize that the checkout logic is kind of messed up in general (I suspect it worked better with older versions of git... this part of the code hasn't been updated since the initial release almost 4 years ago).
I have most of a fix ready, but have zero experience working with multiple remotes in collaborative projects. I have a good idea of how I would expect this to work but need a little clarification. To outline, this was my original intended behaviour:
c
on a local branch: plain ol' checkout
c
on a remote branch: checkout a new local tracking branch (or nothing if one already exists)
C
on a local branch: if it is tracking a remote branch, checkout in detached HEAD
C
on a remote branch: checkout in detached HEAD
So now I'm realizing c
needs a special case: If local master
is tracking origin/master
and you hit c
on upstream/master
, it should be checked-out in detached HEAD.
Is that the behaviour you'd expect?
So now I'm realizing c needs a special case: If local master is tracking origin/master and you hit c on upstream/master, it should be checked-out in detached HEAD.
Do you mean C
?
No I meant c
—I'm suggesting C
and c
would do the same thing in this case. c
on a remote branch would normally create a local branch and track the remote, but if master
is already tracking origin/master
and you hit c
on on upstream/master
then obviously it shouldn't do something like make the local now track upstream/remote
, it should just checkout the remote, detached. Yeah?
I've pushed to https://github.com/sodapopcan/vim-twiggy/tree/fix-checkout if you just want to try it out.
Yes.
I expect: In the screenshot, cureent local branch is master(from origin):
c
on r:origin:master
will do nothing,c
on r:upstream:master` should be checked-out in detached .C
on r:origin:master
or r:upstream:master
should be checked-out in detached .Yes, perfect. I just wanted to clarify and make sure my line of thinking was correct.
If you don't mind playing around with it a bit first that would be much appreciated. If not, that's cool, I just don't want to put this on master just yet as I want to test a little more. It won't be long, though.
Thanks for reporting!
It's in master now. Let me know if you find anything else!
I want to
git checkout remotes/upstream/master
,but it is not work.I have to checkout branch
assets
first