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

Re: Doing a dummy or empty merge

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 11, 2010, 20:26 UTC
Message-ID
<7vljdyzjsy.fsf@alter.siamese.dyndns.org>
In-Reply-To
<86wrxiepv3.fsf@blue.stonehenge.com>
merlyn@stonehenge.com (Randal L. Schwartz) writes:
Show 17 quoted lines
>>>>>> "Richard" == Richard Lee <richard@webdezign.co.uk> writes:
>
> Richard> At this point I want to merge this test branch into the live branch
> Richard> despite not having made any commits apart from deployment related
> Richard> changes on the test branch. I want this to be a dummy merge so that a
> Richard> merge is recorded into the live branch, but the contents of the live
> Richard> branch remain untouched. This is as if I made an empty commit on the
> Richard> live branch.
>
> I think you'll get what you want with a "merge -s ours" from test
> to live.  That says that "I've looked at test, and I've looked at
> the parents of live, and this is how I want the result to look".
>
> Further commits on test can then be merged to live automatically using
> this new merge as the (initial) base.  Of course, later commits after
> that will use subsequent bases, but that should already work the way you
> want.

After the above "merge -s ours", you obviously can never merge from live to test. You have declared that you favor the live configuration over the test configuration with that merge commit, and merging a branch that has that merge commit (i.e. live) into any branch (i.e. test) is your consent to be bound by that declaration. The resulting backmerge will wipe the test configuration and replace it with that from live.

Not that anybody would be likely to want to merge live back to test, but I thought it is worth a warning, as people who haven't thought through what it means to make a merge commit (or more generally, any commit) can get confused.

Previous: Randal L. SchwartzNext: Randal L. Schwartz
Message 3 of 5 in “Doing a dummy or empty merge”
  1. Richard LeeMar 11, 2010
  2. Randal L. SchwartzMar 11, 2010
  3. Junio C HamanoMar 11, 2010
  4. Randal L. SchwartzMar 11, 2010
  5. Richard LeeMar 15, 2010

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.