Re: Can't checkout branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 14, 2020 at 2:18 PM Chris Torek <chris.torek@xxxxxxxxx> wrote:
>
> On Tue, Jul 14, 2020 at 10:04 AM Larry Martell <larry.martell@xxxxxxxxx> wrote:
> [snippage]
> > $ git fetch --all
> > Fetching origin
> >  * [new branch]      deploy     -> origin/deploy
> >
> > $ git checkout deploy
> > $ git branch
> > * master
> >
> > $ git checkout origin/deploy
> > Note: checking out 'origin/deploy'.
> >
> > You are in 'detached HEAD' state.
> >
> > I tried deleting the local repo and recloning, but I got the same
> > results. I see the branch on github. I can checkout other branches,
> > just not this one.
> >
> > What could be going on?
>
> This happens in Git versions prior to 2.23 (what Git version are
> you using?) when there is a *file or directory* named `deploy`.
>
> What is happening is that since there is no *branch* named
> deploy (yet), you can't check it out (yet).  So `git checkout
> deploy` initially fails.  The checkout command then goes on
> to try two alternatives:
>
>  1. Treat this as `git checkout -- deploy`, i.e.,
>     extract the file or subtree named `deploy` from
>     the index (discarding changes to that file or
>     subtree).
>
>  2. Treat this as `git checkout -b deploy origin/deploy`
>     or `git checkout -t origin/deploy`, i.e., create the
>     branch `deploy` from `origin/deploy`.
>
> If *both* of these alternatives work, pre-2.23 Git *assumes* you
> meant alternative number 1.  In 2.23 or later, `git checkout`
> tells you that this is ambiguous and makes you pick which one you
> want.
>
> To work around this in all versions of Git, you can just be
> more explicit.  For instance:
>
>     git checkout deploy --
>
> forces Git to treat it as a branch name.

Thanks for the reply - that was indeed the issue - I had a dir named deploy.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux