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

Re: Pitfalls in auto-fast-forwarding heads that are not checked out?

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 4, 2013, 18:51 UTC
Message-ID
<20130504185146.GD25863@elie.Belkin>
In-Reply-To
<CACPiFCK=8KFX++Bg+LhymorSMnWgrj5Js+-f=UYyZnNY=n9WiA@mail.gmail.com>
Martin Langhoff wrote:
> On Sat, May 4, 2013 at 3:34 AM, Johannes Sixt <j6t@kdbg.org> wrote:
Show 6 quoted lines
>> Since git 1.8.0 you can express this check as
>>
>>     if git merge-base --is-ancestor $production_sha1 refs/heads/master
>
> Ah, that's great! Unfortunate it's not there in earlier / more widely
> used releases of git.
Another trick is to use "git push":
	git push . $production_sha1:refs/heads/master
This advances the "master" branch if
 (1) it is not the current branch, and
 (2) that update is a fast-forward
It can be convenient sometimes.

Hope that helps, Jonathan

Previous: John SzakmeisterNext: Martin Langhoff
Message 5 of 6 in “Pitfalls in auto-fast-forwarding heads that are not checked out?”
  1. Martin LanghoffMay 3, 2013
  2. Johannes SixtMay 4, 2013
  3. Martin LanghoffMay 4, 2013
  4. John SzakmeisterMay 4, 2013
  5. Jonathan NiederMay 4, 2013
  6. Martin LanghoffMay 7, 2013

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.