git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jeff King <peff@peff.net>
Date
Jun 21, 2007, 13:01 UTC
Message-ID
<20070621130137.GB4487@coredump.intra.peff.net>
In-Reply-To
<200706211337.32978.andyparkins@gmail.com>
On Thu, Jun 21, 2007 at 01:37:30PM +0100, Andy Parkins wrote:
>  git checkout directoryonly
>  git-filter-branch --tree-filter "mkdir -p sub/dir/repoB_directory; \
>     mv file1 file2 file3 sub/dir/repoB_directory" directorymoved

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
-Peff
Previous: Andy ParkinsNext: Andy Parkins
Message 2 of 4 in “Moving a directory with history from one repository to another while renaming”
  1. Andy ParkinsJun 21, 2007
  2. Jeff KingJun 21, 2007
  3. Andy ParkinsJun 21, 2007
  4. Johannes SchindelinJun 21, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.