All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Bailey <charles@hashpling.org>
To: Jeff King <peff@peff.net>
Cc: Caleb Cushing <xenoterracide@gmail.com>, git@vger.kernel.org
Subject: Re: merge, keeping the remote as a new file?
Date: Mon, 2 Mar 2009 06:36:04 +0000	[thread overview]
Message-ID: <20090302063604.GA17245@hashpling.org> (raw)
In-Reply-To: <20090302041113.GA3094@coredump.intra.peff.net>

On Sun, Mar 01, 2009 at 11:11:13PM -0500, Jeff King wrote:
> On Sun, Mar 01, 2009 at 07:16:10PM -0500, Caleb Cushing wrote:
> 
> >  I have an unmerged file... the resolution I'd like to have is
> > checkout the local one for the current file name. take the remote
> > version and give it a new file name. what's the best way to do that?
> 
> I would use:
> 
>   $ git show :2:file >file
>   $ git show :3:file >newfile
>   $ git add file newfile
> 
> You can do the first with "git checkout --ours", but I don't think there
> is a way with "checkout" to say "checkout this path, but put it in a
> different place".
> 
> -Peff

You can use git checkout-index --temp --stage=3 and then move it from
the auto-generated temporary name into its new place.

The shell function checkout_staged_file in git-mergetool.sh does this
programmatically, it's not very beautiful as the output of
checkout-index --temp requires a bit of expr magic to get the
temporary file name out.

Using a checkout variant instead of a show or a cat-file might be
important if you are doing autocrlf or some other smudging.

-- 
Charles Bailey
http://ccgi.hashpling.plus.com/blog/

  reply	other threads:[~2009-03-02  6:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-02  0:16 merge, keeping the remote as a new file? Caleb Cushing
2009-03-02  4:11 ` Jeff King
2009-03-02  6:36   ` Charles Bailey [this message]
2009-03-02  6:45     ` Jeff King
2009-03-02  6:59       ` Björn Steinbrink
2009-03-02  7:04         ` Jeff King
2009-03-02 13:05           ` Jay Soffian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090302063604.GA17245@hashpling.org \
    --to=charles@hashpling.org \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=xenoterracide@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.