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

Re: merge, keeping the remote as a new file?

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Mar 2, 2009, 06:59 UTC
Message-ID
<20090302065949.GD6289@atjola.homenet>
In-Reply-To
<20090302064519.GA5635@coredump.intra.peff.net>
On 2009.03.02 01:45:19 -0500, Jeff King wrote:
Show 15 quoted lines
> On Mon, Mar 02, 2009 at 06:36:04AM +0000, Charles Bailey wrote:
> 
> > You can use git checkout-index --temp --stage=3 and then move it from
> > the auto-generated temporary name into its new place.
> 
> Hmm. I was hoping there was something that would use the name "--theirs"
> instead of the mysterious "stage level 3". But it's still nicer than the
> "git show" I gave because of:
> 
> > Using a checkout variant instead of a show or a cat-file might be
> > important if you are doing autocrlf or some other smudging.
> 
> Right. For some reason I was thinking that cat-file did not handle this
> but "git show" did, but I just tested and it clearly doesn't. So yes,
> you should definitely use checkout-index if you care about conversions.

Hm, how about this? git checkout --theirs file git mv file newname git checkout HEAD file # Can't use --ours here due to the mv

Should work with the CRLF stuff, uses no plumbing, no stage numbers, there's no messing with random temp file names and it's still just three commands.

Björn
Previous: Jeff KingNext: Jeff King
Message 5 of 7 in “merge, keeping the remote as a new file?”
  1. Caleb CushingMar 2, 2009
  2. Jeff KingMar 2, 2009
  3. Charles BaileyMar 2, 2009
  4. Jeff KingMar 2, 2009
  5. Björn SteinbrinkMar 2, 2009
  6. Jeff KingMar 2, 2009
  7. Jay SoffianMar 2, 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.