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>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
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 AM Graham Perrin <grahamperrin@gmail.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/D37210
> …
>   * [new branch] nanobsd-embedded-use-makefs             ->
> jlduran/nanobsd-embedded-use-makefs
> …
>   * [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

>

[-- Attachment #2 --]
<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 7, 2023, 8:39 PM Graham Perrin &lt;<a href="mailto:grahamperrin@gmail.com">grahamperrin@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 07/09/2023 20:03, Alan Somers wrote:<br>
&gt; On Thu, Sep 7, 2023 at 11:49 AM Graham Perrin &lt;<a href="mailto:grahamperrin@gmail.com" target="_blank" rel="noreferrer">grahamperrin@gmail.com</a>&gt; wrote:<br>
&gt;&gt; With a clone of e.g. <a href="https://github.com/freebsd/freebsd-src.git" rel="noreferrer noreferrer" target="_blank">https://github.com/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 local directory?<br>
&gt; I do this all the time, if I understand the question correctly.  You<br>
&gt; just need to add a separate git remote for each fork.  For example,<br>
&gt; this sequence of commands will clone the FreeBSD source.  Then it will<br>
&gt; fetch grahamperrin&#39;s fork.  Then it will checkout a copy of<br>
&gt; grahamperrin&#39;s feature branch.  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="http://git@github.com/freebsd/freebsd-src.git" rel="noreferrer noreferrer" target="_blank">git@github.com/freebsd/freebsd-src.git</a><br>
&gt; cd freebsd-src<br>
&gt; git remote add grahamperrin <a href="http://git@github.com/grahamperrin/freebsd-src.git" rel="noreferrer noreferrer" target="_blank">git@github.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="https://github.com/grahamperrin/freebsd-src.git" rel="noreferrer noreferrer" target="_blank">https://github.com/grahamperrin/freebsd-src.git</a><br>;
% git -C /usr/src remote add jlduran <br>
<a href="https://github.com/jlduran/freebsd-src.git" rel="noreferrer noreferrer" target="_blank">https://github.com/jlduran/freebsd-src.git</a><br>;
% git -C /usr/src fetch jlduran<br>
 From <a href="https://github.com/jlduran/freebsd-src" rel="noreferrer noreferrer" target="_blank">https://github.com/jlduran/freebsd-src</a><br>;
  * [new branch] D37210                                  -&gt; jlduran/D37210<br>
…<br>
  * [new branch] nanobsd-embedded-use-makefs             -&gt; <br>
jlduran/nanobsd-embedded-use-makefs<br>
…<br>
  * [new branch] wip-fix-comment-blah                    -&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="auto"><br></div><div dir="auto"><br></div><div dir="auto">I never use -C... but &#39;git checkout nanobsd-embedded-use-makefs&#39; may work. Or &#39;git checkout -t jlduran/nanobsd-embedded-use-makefs&#39; 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).</div><div dir="auto"><br></div><div dir="auto">Warner </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>
help

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