Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Sep 2023 22:30:24 -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:  <CANCZdfqON9z_sA4gc6=iwg3RXfNPs62ZmxUfuJcs1u3ib5n7yw@mail.gmail.com>
In-Reply-To: <CANCZdfqBUbbdLGdZJT55LdJvNuZ8okF50Xs0i7C1HbRSKsa43g@mail.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> <CANCZdfqBUbbdLGdZJT55LdJvNuZ8okF50Xs0i7C1HbRSKsa43g@mail.gmail.com>

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

On Thu, Sep 7, 2023 at 8:51=E2=80=AFPM Warner Losh <imp@bsdimp.com> wrote:

>
>
> 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@gm=
ail.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.gi=
t
>> > 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/D372=
10
>> =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 latt=
er
> will definitely work. The git branch command never does what I want so I
> never use it  (except for variants like -d or --sort).
>

My typical work flow looks more like:

% git remote add bruno httpsg:ithub.com/seanbruno/qemu-bsd-user.git
% git fetch bruno
% git checkout -t bruno/gerbils
(to get the gerbils branch from bruno created as well, to track the remote,
but this
 specific one is ancient history at this point).
or sometimes
% git worktree add ../qemu-bruno bruno/gerbils

Warner

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

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Thu, Sep 7, 2023 at 8:51=E2=80=AFP=
M Warner Losh &lt;<a href=3D"mailto:imp@bsdimp.com">imp@bsdimp.com</a>&gt; =
wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0=
px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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"mail=
to:grahamperrin@gmail.com" target=3D"_blank">grahamperrin@gmail.com</a>&gt;=
 wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 07/09=
/2023 20:03, Alan Somers wrote:<br>
&gt; On Thu, Sep 7, 2023 at 11:49=E2=80=AFAM Graham Perrin &lt;<a href=3D"m=
ailto:grahamperrin@gmail.com" rel=3D"noreferrer" target=3D"_blank">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></blockquote><div><br></div><div>My typical work flow=
 looks more like:</div><div><br></div><div>% git remote add bruno httpsg:<a=
 href=3D"http://ithub.com/seanbruno/qemu-bsd-user.git">ithub.com/seanbruno/=
qemu-bsd-user.git</a></div><div>% git fetch bruno</div><div>% git checkout =
-t bruno/gerbils</div><div>(to get the gerbils branch from bruno created as=
 well, to track the remote, but this</div><div>=C2=A0specific one is ancien=
t history at this point).</div><div>or sometimes</div><div>% git worktree a=
dd ../qemu-bruno bruno/gerbils</div><div><br></div><div>Warner</div></div><=
/div>

--0000000000001cdbfb0604d17052--



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