From: Andreas Schwab Date: Sat, 28 Dec 2024 19:39:55 GMT Subject: Re: connecting the local main branch to the remote origin/main without pushing Message-ID: <87cyhbk35g.fsf@igel.home> In-Reply-To: <20241228190827.GB815586@coredump.intra.peff.net> On Dez 28 2024, Jeff King wrote: > On Sat, Dec 28, 2024 at 06:15:01PM +0100, Andreas Schwab wrote: > >> On Dez 28 2024, crstml@libero.it wrote: >> >> > My question is: >> > Is it possible when applying the method 2 to have (without pushing) >> > the local main branch connected to the remote origin/main branch as >> > in the case of method 1 which by cloning connects these branches. >> >> You can establish the effect by setting two config entries: >> >> $ git config branch.main.remote origin >> $ git config branch.main.merge refs/heads/main > > Also: > > git branch --set-upstream-to=origin/main main > > (sets the same config variables, but maybe a little more ergonomic). That does not work if origin/main does not exist yet. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."