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

Re: I want "fast forward my workdir to upstream if it's safe"

From
Jeff King <peff@peff.net>
Date
May 8, 2009, 07:01 UTC
Message-ID
<20090508070119.GA12989@coredump.intra.peff.net>
In-Reply-To
<4A03D6E2.2050708@op5.se>
On Fri, May 08, 2009 at 08:53:22AM +0200, Andreas Ericsson wrote:
Show 17 quoted lines
>> (2b) is a bit harder, but do-able:
>>
>>   git diff-tree --name-only HEAD $upstream | sort >them
>>   (git diff-files --name-only; git diff-index --name-only) | sort >us
>>   test -z "`comm -12 us them`"
>>
>> (2c) is the trickiest (and of course, therefore probably the one you
>> want ;) ).  I'm not sure there is a simple way to do it short of hacking
>> git-merge to actually try the merge and roll it back. Because you really
>> have to deal not just with merging actual text file content but with
>> custom merge drivers.
>>
>
> The "rolling back" part is about as simple as
> * never touch the worktree (only use in-index merge)
> * preserve the last HEAD commit object name
> * preserve the index

If you are just doing in-index merge, then (2b) works fine. You know you aren't doing any file-level merging. The advantage of (2c) is that non-conflicting merges in files would are "safe".

-Peff
Previous: Andreas EricssonNext: Eyvind Bernhardsen
Message 6 of 12 in “I want "fast forward my workdir to upstream if it's safe"”
  1. Randal L. SchwartzMay 7, 2009
  2. Wincent ColaiutaMay 7, 2009
  3. Randal L. SchwartzMay 7, 2009
  4. Jeff KingMay 8, 2009
  5. Andreas EricssonMay 8, 2009
  6. Jeff KingMay 8, 2009
  7. Eyvind BernhardsenMay 8, 2009
  8. Randal L. SchwartzMay 8, 2009
  9. Junio C HamanoMay 8, 2009
  10. Jakub NarebskiMay 8, 2009
  11. Eyvind BernhardsenMay 11, 2009
  12. Miles BaderMay 8, 2009

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.