Re: '2021Q3' does not appear to be a git repository

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sun, 18 Jul 2021 01:38:42 +0200
On 18 Jul 2021, at 00:16, Thierry Thomas <thierry_at_FreeBSD.org> wrote:
> 
> Le sam. 17 juil. 21 à 21:30:39 +0200, Dimitry Andric <dim_at_FreeBSD.org>
> écrivait :
> 
>>> I’d like to MFH some commits, but I cannot get the branch 2021Q3.
>>> 
>>> Trying `git checkout 2021Q3' gives:
>>> error: pathspec '2021Q3' did not match any file(s) known to git
> 
>> Try "git fetch origin" first, and then you should see the 2021Q3 branch
>> (note: it is *not* a remote!) appear:
> 
> Thanks, that did it!
> 
> Strangely, previously `git checkout 2021Q2' had been sufficient…

This isn't strange really, but just how git works. If the remote
repository called 'origin' acquires any new objects, such as branches
(for example because somebody creates the 2021Q3 branch and pushes it)
your local repository will not automatically know about this.

You first "fetch" the remote repository, by running 'git fetch origin'
(note that the default remote is usually called origin, so you can leave
it off and run 'git fetch' instead), and only then the local repository
knows about any new commits, branches, tags, etc.

Most people use 'git pull' to update their local repository, and this is
simply a shorthand for 'git fetch', followed by 'git merge' or 'git
rebase', depending on your git configuration. But this is really only
appropriate for existing branches such as main, not new ones.

-Dimitry


Received on Sat Jul 17 2021 - 23:38:42 UTC

Original text of this message