From: David Reitter <david.reitter@gmail.com>
To: Miklos Vajna <vmiklos@frugalware.org>
Cc: git@vger.kernel.org
Subject: Re: How to merge by subtree while preserving history?
Date: Fri, 27 Mar 2009 12:56:43 -0400 [thread overview]
Message-ID: <BA69E81F-C93F-4AD8-8486-A27B0A284D9A@gmail.com> (raw)
In-Reply-To: <20090327073847.GE27459@genesis.frugalware.org>
On Mar 27, 2009, at 3:38 AM, Miklos Vajna wrote:
> Now do a 'git log f474c52..52b8ea9' and you'll see the merged commits.
Sure :)
Needless to say, this is not practical and doesn't support people's
workflow.
For simple renames, "git log --follow" helps, but as soon as you want
to do a "diff" in one of the listed revisions, filtering for just this
one file, then history becomes invisible again. Concretely, this
breaks the common workflow with C-x C-v l, then "d" in Emacs.
I'm aware of the content-tracking vs. file-tracking discussion; it's
all fine, except that file names are meaningful meta-data for some
content, at least in some projects. Is there a command that gives me
the diff for a revision pair, restricted to what happened to content
in a given file in the current tree?
> But you are right about that 'git log -- path' will find the merge
> commits only (which is right, as the tree objects are not modified
> when
> merging, just the resulting tree has the original tree in a
> subdirectory).
>
> If this is a one-time operation then I would just use git filter-
> branch
> to move the code to a subdir.
For the record:
In the meantime, I managed to move the original file in the CVS
repository (by just moving all the ",v" files and getting rid of
CVSROOT/history, which doesn't seem needed). The I re-ran cvsimport,
mitigating a bunch of problems with "cvsps". For the record, cvsps /
cvsimport could not handle the case where my repository named "foo"
had a subdirectory also called "foo", in which I moved all the
stuff. I had to rename the directory to "bar". I also had to
delete cvsps's cache file with the -x argument (or delete it from the
surprising location ~/.cvsps).
Then, I merged with "git pull", noting the rev ID before the merge.
Next, I used "git filter-branch" to rename the directory again from
BAR to FOO as follows:
git filter-branch --index-filter \
'git ls-files -s | sed "s-BAR/-FOO/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' <last-rev-before-
merge>..
Finally, I had to "git gc" to prune a 200MB worth of objects (it told
me I had 500k objects overall).
--
http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
next prev parent reply other threads:[~2009-03-27 16:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-26 22:59 How to merge by subtree while preserving history? David Reitter
2009-03-27 7:38 ` Miklos Vajna
2009-03-27 16:56 ` David Reitter [this message]
2009-03-27 17:20 ` Junio C Hamano
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=BA69E81F-C93F-4AD8-8486-A27B0A284D9A@gmail.com \
--to=david.reitter@gmail.com \
--cc=git@vger.kernel.org \
--cc=vmiklos@frugalware.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).