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

Re: "Branch objects" (was: Re: cherry picking and merge)

From
NWNico Williams <nico@cryptonector.com>
Date
Aug 7, 2014, 17:22 UTC
Message-ID
<20140807172207.GP23449@localhost>
In-Reply-To
<alpine.LSU.2.00.1408071735410.23775@hermes-1.csi.cam.ac.uk>
On Thu, Aug 07, 2014 at 05:42:34PM +0100, Tony Finch wrote:
Show 13 quoted lines
> Nico Williams <nico@cryptonector.com> wrote:
> > On Thu, Aug 07, 2014 at 12:38:48PM +0100, Tony Finch wrote:
> > > But [a rebasing workflow] is inconvenient for deploying the patched
> > > version to production (which is the point of developing the fixes) - I
> > > want a fast-forwarding branch for that.
> >
> > I'm not sure I follow this.  You deploy what you build, and you build
> > the HEAD of the production branch, whatever that is.  If it gets
> > rebased, so it it does.
> 
> The problem is that the production branch gets copied around: pushed to
> the repo server, pulled by other team members, etc. Forced pushes
> are accident-prone, as is resetting a rebased branch after a pull.
When I rebase and I need the old HEAD around I do something like this:

$ git checkout $branch_to_rebase $ ver=${branch_to_rebase##*-} $ git checkout -b ${branch_to_rebase%-${ver}}-$((ver+1)) $ git rebase ...

or like this:

$ git checkout $branch_to_rebase $ git branch ${branch_to_rebase}-$(date +%Y-%m-%d) $ git rebase ...

Either way I retain the old HEAD with some name. This requires discipline, so scripting it is useful. But if you want discipline then you want git to know that "for this branch, don't prune/gc old HEADs orphaned after rebases" and "push the rebase history for this branch".

Show 5 quoted lines
> > > https://git.csx.cam.ac.uk/x/ucs/git/git-repub.git
> >
> > Yeah, that's useful.
> 
> Glad you think so :-)
Thank you.
Nico
Previous: Tony FinchNext: Tony Finch
Message 6 of 9 in “"Branch objects" (was: Re: cherry picking and merge)”
  1. Jakub NarębskiAug 6, 2014
  2. Nico WilliamsAug 6, 2014
  3. Tony FinchAug 7, 2014
  4. Nico WilliamsAug 7, 2014
  5. Tony FinchAug 7, 2014
  6. Nico WilliamsAug 7, 2014
  7. Tony FinchAug 7, 2014
  8. Nico WilliamsAug 7, 2014
  9. Nico WilliamsAug 7, 2014

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.