From: Johannes Sixt <j.sixt@viscovery.net>
To: Joshua Jensen <jjensen@workspacewhiz.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Following history of a copied file from another indirect branch
Date: Fri, 22 Oct 2010 08:35:17 +0200 [thread overview]
Message-ID: <4CC130A5.6050802@viscovery.net> (raw)
In-Reply-To: <4CC08AA5.8070502@workspacewhiz.com>
Am 10/21/2010 20:47, schrieb Joshua Jensen:
> It has become a necessity to copy a file from one long-lived branch to
> another. It is not possible to merge the branches at this time.
>
> I would like to have 'git gui blame' follow the copy back through its
> original history, but I don't believe Git has metadata for storing this.
> Something along the lines of a 'followparent' in the commit object, for
> instance, would allow the revision walking code to wander the history down
> an alternate line.
You can branch off one commit form that long-lived branch that undoes
everything except the file F you are interested in since the last
merge-base. Then you merge that single commit into the other branch.
---o--o--B <- long-lived
/ / \
/ / U <- the-file
/ / \
-o--A----------M <- master (the other branch)
i.e. 'git diff A..B' shows a lot of changes, but 'git diff A..U' shows
only changes to the file you are interested in. 'git diff -R B..U' differs
from 'git diff A..B' only in the changes to the file you are intersted in.
When you later find that you need new changes to F that were made on
long-lived, but you still cannot merge long-lived, then you can merge
long-lived into the-file (resolve conflicts by removing the conflicted
files and also remove newly added files), and then you merge the-file into
master again.
WARNING: When you later merge long-lived into master, the merge will lose
all changes made on long-lived. You work it around by temporarily grafting
away the merge parents that point to commits listed by
long-lived..the-file. After you complete the merge, you can remove the
grafts again.
-- Hannes
prev parent reply other threads:[~2010-10-22 6:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-21 18:47 Following history of a copied file from another indirect branch Joshua Jensen
2010-10-21 19:39 ` Brian Gernhardt
2010-10-21 20:06 ` Joshua Jensen
2010-10-22 6:35 ` Johannes Sixt [this message]
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=4CC130A5.6050802@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=jjensen@workspacewhiz.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.