{"thread":{"id":"60732","subject":"Help: Trying to setup triangular workflow","startedAt":"2024-01-12T02:24:21Z","lastAt":"2024-01-13T00:45:46Z","messageCount":3,"participants":["Matthew B. Gray","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"486681","messageId":"b59c59f6-29e1-4d67-bace-13adcc108454@app.fastmail.com","threadId":"60732","inReplyTo":null,"subject":"Help: Trying to setup triangular workflow","fromName":"Matthew B. Gray","fromEmail":"hey@matthew.nz","sentAt":"2024-01-12T02:23:58Z","receivedAt":"2024-01-12T02:24:21Z","isPatch":false,"sender":{"key":"hey@matthew.nz","avatar":null},"body":" Hello\n\nI am trying to set up a triangular workflow against a fork. The example I'm\nusing is documented here: https://git-scm.com/docs/gitrevisions\n\nHere's the example:\n\n  $ git config push.default current\n  $ git config remote.pushdefault myfork\n  $ git switch -c mybranch origin/master\n  $ git rev-parse --symbolic-full-name @{upstream}\n  refs/remotes/origin/master\n  $ git rev-parse --symbolic-full-name @{push}\n  refs/remotes/myfork/mybranch\n\nMy setup looks like this:\n\n  λ git -v\n  git version 2.43.0\n  λ git remote -vv\n  myfork git@github.com:heymatthew/dactyl-configurator-fork (fetch)\n  myfork git@github.com:heymatthew/dactyl-configurator-fork (push)\n  origin https://github.com/rianadon/dactyl-configurator (fetch)\n  origin https://github.com/rianadon/dactyl-configurator (push)\n\nHere's what I get from running the documented example:\n\n  λ git config push.default current\n  λ git config remote.pushdefault myfork\n  λ git switch -c mybranch origin/main\n  λ git push\n  * [new branch]          mybranch -> mybranch\n  branch 'mybranch' set up to track 'myfork/mybranch'.\n  λ git rev-parse --symbolic-full-name @{upstream}\n  refs/remotes/myfork/mybranch\n  λ git rev-parse --symbolic-full-name @{push}\n  refs/remotes/myfork/mybranch\n\nI was expecting @{upstream} to be origin/main, but it appears that @{u} and\n@{p} are the same.\n\nAm I doing something wrong?\nAre there better examples someone can point me at to do this?\n\nThanks in advance :)\n\nNgā mihi,\nMatthew\n"},{"id":"486691","messageId":"20240112073136.GG618729@coredump.intra.peff.net","threadId":"60732","inReplyTo":"b59c59f6-29e1-4d67-bace-13adcc108454@app.fastmail.com","subject":"Re: Help: Trying to setup triangular workflow","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2024-01-12T07:31:36Z","receivedAt":"2024-01-12T07:31:37Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 12, 2024 at 03:23:58PM +1300, Matthew B. Gray wrote:\n\n> Here's what I get from running the documented example:\n> \n>   λ git config push.default current\n>   λ git config remote.pushdefault myfork\n>   λ git switch -c mybranch origin/main\n>   λ git push\n>   * [new branch]          mybranch -> mybranch\n>   branch 'mybranch' set up to track 'myfork/mybranch'.\n\nThis push step is rewriting your upstream config. Do you have\npush.autoSetupRemote configured? In general you wouldn't want that for a\ntriangular flow.\n\nThough I think it also is only supposed to kick in if there is no\ntracking configured already. Why did the \"git switch\" invocation not set\nup tracking itself? When I run those commands it does. Do you have\nbranch.autoSetupMerge turned off in your config?\n\n-Peff\n"},{"id":"486748","messageId":"bf59af5d-1a59-41bb-b693-087b940e266b@app.fastmail.com","threadId":"60732","inReplyTo":"20240112073136.GG618729@coredump.intra.peff.net","subject":"Re: Help: Trying to setup triangular workflow","fromName":"Matthew B. Gray","fromEmail":"hey@matthew.nz","sentAt":"2024-01-13T00:45:22Z","receivedAt":"2024-01-13T00:45:46Z","isPatch":false,"sender":{"key":"hey@matthew.nz","avatar":null},"body":"Hi Peff,\n\n> This push step is rewriting your upstream config. Do you have\n> push.autoSetupRemote configured? In general you wouldn't want that for a\n> triangular flow.\n \nThanks for the pointer, yes have both push.autoSetupRemote and\nbranch.autoSetupMerge set. Turning these off has fixed my problem.\n\nWith neither option set the example yields:\n\n  @{upstream}: refs/remotes/origin/main\n  @{push}: refs/remotes/myfork/mybranch\n\nWith push.autosetupremote=true set:\n\n  @{upstream}: refs/remotes/origin/main\n  @{push}: refs/remotes/myfork/mybranch\n\nWith branch.autoSetupMerge=simple set:\n\n  @{upstream}:\n  @{push}: refs/remotes/myfork/mybranch\n\nWith branch.autoSetupMerge=simple and push.autosetupremote=true:\n\n  @{upstream}: refs/remotes/myfork/mybranch\n  @{push}: refs/remotes/myfork/mybranch\n\n> Though I think it also is only supposed to kick in if there is no\n> tracking configured already. Why did the \"git switch\" invocation not set\n> up tracking itself? When I run those commands it does. Do you have\n> branch.autoSetupMerge turned off in your config?\n\nIf you're interested in looking at my full gitconfig it's hosted here:\nhttps://github.com/heymatthew/dotfiles/blob/trunk/softlinks/.gitconfig\n\nHowever looks like taking those out of global config has fixed my issue.\nThanks for the help!\n\nNgā mihi,\nMatthew\n"}]}