Re: Working with forks
- Reply: Warner Losh : "Re: Working with forks"
- In reply to: Warner Losh : "Re: Working with forks"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 08 Sep 2023 04:30:24 UTC
On Thu, Sep 7, 2023 at 8:51 PM 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 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). > 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