From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Andy Parkins <andyparkins@gmail.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: Moving a directory with history from one repository to another while renaming
Date: Thu, 21 Jun 2007 15:05:38 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0706211504060.4059@racer.site> (raw)
In-Reply-To: <200706211457.29030.andyparkins@gmail.com>
Hi,
On Thu, 21 Jun 2007, Andy Parkins wrote:
> On Thursday 2007 June 21, Jeff King wrote:
>
> > You can do this much more efficiently by just operating on the index.
> > Something like:
> >
> > git-filter-branch --index-filter \
> > 'git-ls-files -s | sed -n 's/change/paths/p' | git-update-index
> > --index-info' \ directorymoved
>
> :-D Even better. I am definitely in the "fan of git-filter-branch" camp.
>
> Thanks for sharing that line; I've actually found it instructive for more than
> just git-filter-branch. I definitely hadn't appreciated the fact that the
> index can be so easily manipulated.
You have to adapt the line minimally: As is, it will possibly catch the
wrong names, and it does not _move_ the directory, but rather _copy_ it.
So I think something like
git-ls-files -s | sed "s-\t-&newsubdir/-" |
GIT_INDEX_FILE="$GIT_INDEX_FILE".new git-update-index --index-info &&
mv "$GIT_INDEX_FILE".new "$GIT_INDEX_FILE"
is needed.
Ciao,
Dscho
prev parent reply other threads:[~2007-06-21 14:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-21 12:37 Moving a directory with history from one repository to another while renaming Andy Parkins
2007-06-21 13:01 ` Jeff King
2007-06-21 13:57 ` Andy Parkins
2007-06-21 14:05 ` Johannes Schindelin [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=Pine.LNX.4.64.0706211504060.4059@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=andyparkins@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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).