Re: Working with forks: git-checkout(1) options -b and -t

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sun, 10 Sep 2023 16:18:34 UTC

On Sep 10, 2023, at 08:58, Graham Perrin <grahamperrin@gmail.com> wrote:

On 08/09/2023 03:51, Warner Losh wrote:

> … Or 'git checkout -t jlduran/nanobsd-embedded-use-makefs' …


> A doc tree example, now. Colour me confused.
> 
> % git -C /usr/doc remote add outpaddling https://github.com/outpaddling/freebsd-doc.git
> % git -C /usr/doc checkout -b outpaddling-main --track outpaddling/main
> fatal: 'outpaddling/main' is not a commit and a branch 'outpaddling-main' cannot be created from it
> % git -C /usr/doc checkout -b outpaddling-main --track outpaddling
> fatal: 'outpaddling' is not a commit and a branch 'outpaddling-main' cannot be created from it
> % git -C /usr/doc checkout -b outpaddling-main -t outpaddling/main
> fatal: 'outpaddling/main' is not a commit and a branch 'outpaddling-main' cannot be created from it
> % git -C /usr/doc checkout -t outpaddling/main
> fatal: 'outpaddling/main' is not a commit and a branch 'main' cannot be created from it
> %
> 
> <https://github.com/outpaddling/freebsd-doc/branches> there's only one branch, main.
> 

From man git-remote:

       add
           Add a remote named <name> for the repository at <URL>. The command
           git fetch <name> can then be used to create and update
           remote-tracking branches <name>/<branch>.

So it looks like the next step after "git -C /usr/doc remote add  . . ." is:

% git -C /usr/doc fetch outpaddling

Prior to that no interaction with the remote has happened for
the local git to have found what branches exist and the like.

===
Mark Millard
marklmi at yahoo.com