Re: Moving a directory with history from one repository to another while renaming

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux