Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Sep 2023 20:51:34 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Graham Perrin <grahamperrin@gmail.com>
Cc:        Alan Somers <asomers@freebsd.org>, freebsd-git <freebsd-git@freebsd.org>
Subject:   Re: Working with forks
Message-ID:  <CANCZdfqBUbbdLGdZJT55LdJvNuZ8okF50Xs0i7C1HbRSKsa43g@mail.gmail.com>
In-Reply-To: <543e12ed-bc12-ee0e-4ddf-4423fe704d78@gmail.com>
References:  <7e6a3a98-80a8-c787-fda5-65e924dbad34@gmail.com> <CAOtMX2h1tZ3oC0a%2BMbizW9xK4Ryt5AaPtA%2B1C3g%2BTO4=vYo65A@mail.gmail.com> <543e12ed-bc12-ee0e-4ddf-4423fe704d78@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000a45d8c0604d00ec1
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, Sep 7, 2023, 8:39 PM Graham Perrin <grahamperrin@gmail.com> wrote:

> On 07/09/2023 20:03, Alan Somers wrote:
> > On Thu, Sep 7, 2023 at 11:49=E2=80=AFAM Graham Perrin <grahamperrin@gma=
il.com>
> wrote:
> >> With a clone of e.g. https://github.com/freebsd/freebsd-src.git (in
> the FreeBSD project) as a starting point: when the times come to work,
> locally, with other people's forks, does Git (at the command line) allow =
an
> easy way to temporarily use the same local directory?
> > I do this all the time, if I understand the question correctly.  You
> > just need to add a separate git remote for each fork.  For example,
> > this sequence of commands will clone the FreeBSD source.  Then it will
> > fetch grahamperrin's fork.  Then it will checkout a copy of
> > grahamperrin's feature branch.  Finally, it will rebase that feature
> > branch onto a branch from the original FreeBSD repo.
> >
> > git clone git@github.com/freebsd/freebsd-src.git
> > cd freebsd-src
> > git remote add grahamperrin git@github.com/grahamperrin/freebsd-src.git
> > git fetch grahamperrin
> > git branch grahamperrin/featureX featureX
> > git checkout featureX
> > git rebase origin/stable/13
>
> Thanks.
>
> Below (an abbreviated list of branches), what am I doing wrong?
>
> % git -C /usr/src config --get remote.origin.url
> https://github.com/grahamperrin/freebsd-src.git
> % git -C /usr/src remote add jlduran
> https://github.com/jlduran/freebsd-src.git
> % git -C /usr/src fetch jlduran
>  From https://github.com/jlduran/freebsd-src
>   * [new branch] D37210                                  -> jlduran/D3721=
0
> =E2=80=A6
>   * [new branch] nanobsd-embedded-use-makefs             ->
> jlduran/nanobsd-embedded-use-makefs
> =E2=80=A6
>   * [new branch] wip-fix-comment-blah                    ->
> jlduran/wip-fix-comment-blah
> % git -C /usr/src branch jlduran/nanobsd-embedded-use-makefs
> nanobsd-embedded-use-makefs
> fatal: not a valid object name: 'nanobsd-embedded-use-makefs'
> %
>
> If it's relevant: my /usr/src originated from my fork.
>


I never use -C... but 'git checkout nanobsd-embedded-use-makefs' may work.
Or 'git checkout -t jlduran/nanobsd-embedded-use-makefs' if not. The latter
will definitely work. The git branch command never does what I want so I
never use it  (except for variants like -d or --sort).

Warner

>

--000000000000a45d8c0604d00ec1
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" =
class=3D"gmail_attr">On Thu, Sep 7, 2023, 8:39 PM Graham Perrin &lt;<a href=
=3D"mailto:grahamperrin@gmail.com">grahamperrin@gmail.com</a>&gt; wrote:<br=
></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-=
left:1px #ccc solid;padding-left:1ex">On 07/09/2023 20:03, Alan Somers wrot=
e:<br>
&gt; On Thu, Sep 7, 2023 at 11:49=E2=80=AFAM Graham Perrin &lt;<a href=3D"m=
ailto:grahamperrin@gmail.com" target=3D"_blank" rel=3D"noreferrer">grahampe=
rrin@gmail.com</a>&gt; wrote:<br>
&gt;&gt; With a clone of e.g. <a href=3D"https://github.com/freebsd/freebsd=
-src.git" rel=3D"noreferrer noreferrer" target=3D"_blank">https://github.co=
m/freebsd/freebsd-src.git</a> (in the FreeBSD project) as a starting point:=
 when the times come to work, locally, with other people&#39;s forks, does =
Git (at the command line) allow an easy way to temporarily use the same loc=
al directory?<br>
&gt; I do this all the time, if I understand the question correctly.=C2=A0 =
You<br>
&gt; just need to add a separate git remote for each fork.=C2=A0 For exampl=
e,<br>
&gt; this sequence of commands will clone the FreeBSD source.=C2=A0 Then it=
 will<br>
&gt; fetch grahamperrin&#39;s fork.=C2=A0 Then it will checkout a copy of<b=
r>
&gt; grahamperrin&#39;s feature branch.=C2=A0 Finally, it will rebase that =
feature<br>
&gt; branch onto a branch from the original FreeBSD repo.<br>
&gt;<br>
&gt; git clone <a href=3D"http://git@github.com/freebsd/freebsd-src.git" re=
l=3D"noreferrer noreferrer" target=3D"_blank">git@github.com/freebsd/freebs=
d-src.git</a><br>
&gt; cd freebsd-src<br>
&gt; git remote add grahamperrin <a href=3D"http://git@github.com/grahamper=
rin/freebsd-src.git" rel=3D"noreferrer noreferrer" target=3D"_blank">git@gi=
thub.com/grahamperrin/freebsd-src.git</a><br>
&gt; git fetch grahamperrin<br>
&gt; git branch grahamperrin/featureX featureX<br>
&gt; git checkout featureX<br>
&gt; git rebase origin/stable/13<br>
<br>
Thanks.<br>
<br>
Below (an abbreviated list of branches), what am I doing wrong?<br>
<br>
% git -C /usr/src config --get remote.origin.url<br>
<a href=3D"https://github.com/grahamperrin/freebsd-src.git" rel=3D"noreferr=
er noreferrer" target=3D"_blank">https://github.com/grahamperrin/freebsd-sr=
c.git</a><br>
% git -C /usr/src remote add jlduran <br>
<a href=3D"https://github.com/jlduran/freebsd-src.git" rel=3D"noreferrer no=
referrer" target=3D"_blank">https://github.com/jlduran/freebsd-src.git</a><=
br>
% git -C /usr/src fetch jlduran<br>
=C2=A0From <a href=3D"https://github.com/jlduran/freebsd-src" rel=3D"norefe=
rrer noreferrer" target=3D"_blank">https://github.com/jlduran/freebsd-src</=
a><br>
=C2=A0=C2=A0* [new branch] D37210=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0 -&gt; jlduran/D37210<br>
=E2=80=A6<br>
=C2=A0=C2=A0* [new branch] nanobsd-embedded-use-makefs=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 -&gt; <br>
jlduran/nanobsd-embedded-use-makefs<br>
=E2=80=A6<br>
=C2=A0=C2=A0* [new branch] wip-fix-comment-blah=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 -&gt; <br>
jlduran/wip-fix-comment-blah<br>
% git -C /usr/src branch jlduran/nanobsd-embedded-use-makefs <br>
nanobsd-embedded-use-makefs<br>
fatal: not a valid object name: &#39;nanobsd-embedded-use-makefs&#39;<br>
%<br>
<br>
If it&#39;s relevant: my /usr/src originated from my fork.<br></blockquote>=
</div></div><div dir=3D"auto"><br></div><div dir=3D"auto"><br></div><div di=
r=3D"auto">I never use -C... but &#39;git checkout nanobsd-embedded-use-mak=
efs&#39; may work. Or &#39;git checkout -t jlduran/nanobsd-embedded-use-mak=
efs&#39; if not. The latter will definitely work. The git branch command ne=
ver does what I want so I never use it=C2=A0 (except for variants like -d o=
r --sort).</div><div dir=3D"auto"><br></div><div dir=3D"auto">Warner=C2=A0<=
/div><div dir=3D"auto"><div class=3D"gmail_quote"><blockquote class=3D"gmai=
l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left=
:1ex">
</blockquote></div></div></div>

--000000000000a45d8c0604d00ec1--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqBUbbdLGdZJT55LdJvNuZ8okF50Xs0i7C1HbRSKsa43g>