Re: merge, keeping the remote as a new file?
- From
Charles Bailey <charles@hashpling.org>
- Date
- Mar 2, 2009, 06:36 UTC
- Message-ID
- <20090302063604.GA17245@hashpling.org>
- In-Reply-To
- <20090302041113.GA3094@coredump.intra.peff.net>
On Sun, Mar 01, 2009 at 11:11:13PM -0500, Jeff King wrote:
Show 17 quoted lines
> 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/