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

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

From
Jay Soffian <jaysoffian@gmail.com>
Date
Mar 2, 2009, 13:05 UTC
Message-ID
<76718490903020505j4c4f2df2i379632158f1c80bf@mail.gmail.com>
In-Reply-To
<20090302070406.GA12937@coredump.intra.peff.net>
On Mon, Mar 2, 2009 at 2:04 AM, Jeff King <peff@peff.net> wrote:
Show 16 quoted lines
> On Mon, Mar 02, 2009 at 07:59:49AM +0100, Björn Steinbrink wrote:
>
>> 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
>
> Actually, you can use --ours if you don't "git mv":
>
>  git checkout --theirs file
>  mv file newfile
>  git checkout --ours file
>  git add file newfile
>
> One more command, but I think more obvious about what is going on (and I
> think both are better than the other suggestions).

This is a superior answer as well because it avoids plumbing in a situation where plumbing ought not be needed.

j.
Previous: Jeff King
Message 7 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.