git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Tracking parent branches in Git

From
Andreas Krey <a.krey@gmx.de>
Date
Jul 2, 2019, 06:42 UTC
Message-ID
<20190702064252.GA26953@inner.h.apk.li>
In-Reply-To
<CAGyf7-EBs_cRB5R7RyQhX0ZDNqLZWVJEYEtqkGRGJykRqKKTvA@mail.gmail.com>

On Mon, 01 Jul 2019 12:48:16 +0000, Bryan Turner wrote: ...

Show 6 quoted lines
> In other words, when I locally do:
> git checkout --no-track -b bturner-some-bugfix origin/release/5.16
> 
> release/5.16 is the "parent branch" of my bugfix branch and, when I
> push my branch and try to open a pull request, release/5.16 is a
> _likely_ target for where I'd want to merge it.

We have simply conventionalized this - the parent relation is in the branch names. Your bugfix branch would be release/5.16/bturner-some-bugfix (in the central repo; we don't care how you name it locally), and, because ref storage, the parent would be release/5.16/master.

You'd just do
  git create-br release/5.16/bturner-some-bugfix

and it would be branched off the corresponding /master, be checked out, and tracking already been set up. Likewise we have a

  git update

which looks at the upstream name, deduces the parent, and pulls that in, with a suitable commit message. Finally,

  git mkpullreq
creates a pull request from the current to the parent branch.

(I would like to have a way to make bitbucket server use the same convention for the default pull request target.)

- Andreas
-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800
Previous: Eric Kulcyk
Message 13 of 13 in “Tracking parent branches in Git”
  1. Eric KulcykJul 1, 2019
  2. Junio C HamanoJul 1, 2019
  3. Bryan TurnerJul 1, 2019
  4. rsbecker@nexbridge.comJul 1, 2019
  5. Philip OakleyJul 2, 2019
  6. Junio C HamanoJul 2, 2019
  7. Bryan TurnerJul 2, 2019
  8. Theodore Ts'oJul 2, 2019
  9. Philip OakleyJul 3, 2019
  10. Eckhard MaaßJul 1, 2019
  11. Eric KulcykJul 1, 2019
  12. Eric KulcykJul 1, 2019
  13. Andreas KreyJul 2, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.