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

Re: Using filter-branch to move repo contents in subdirectory

From
Adam Mercer <ramercer@gmail.com>
Date
Aug 9, 2010, 19:36 UTC
Message-ID
<AANLkTi=TeJvF+swpMWddDtA7jh4XWedQ+FjigEdRYkx_@mail.gmail.com>
In-Reply-To
<AANLkTik2dL5jrEjZe0LB6Y4_PEwRt-7t_5CG7gup3pnV@mail.gmail.com>
On Thu, Jul 29, 2010 at 07:37, Adam Mercer <ramercer@gmail.com> wrote:
Show 11 quoted lines
> I'm trying to use git filter-branch to move all contents of a repo
> into a subdirectory of the repo root. The git filter-branch man page
> has the following example:
>
>       To move the whole tree into a subdirectory, or remove it from there:
>
>           git filter-branch --index-filter \
>                   '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' HEAD

I'm trying to do this with another repo now and am getting a different error message:

$ git filter-branch --index-filter \
    'git ls-files -s | gsed "s-\t\"*-&sftlib/-" |
        GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
            git update-index --index-info &&
    mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
Rewrite b3100fb24a7eb2f349801f3b87cf995dc3d14bba (1/44)mv:
/Users/ram/git/eah2/.git-rewrite/t/../index.new: No such file or
directory
index filter failed: git ls-files -s | gsed "s-\t\"*-&sftlib/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && mv
$GIT_INDEX_FILE.new $GIT_INDEX_FILE
$
Any ideas?
This is on Mac OS X 10.6.4, with git-1.7.2.1, and GNU sed 4.2.1
Cheers
Adam
Previous: Thomas RastNext: Adam Mercer
Message 10 of 13 in “Using filter-branch to move repo contents in subdirectory”
  1. Adam MercerJul 29, 2010
  2. Thomas RastJul 29, 2010
  3. Adam MercerJul 29, 2010
  4. filter-branch tests/docs: avoid \t in sed regexesThomas Rast, Jul 29, 2010
  5. Tomas CarneckyJul 29, 2010
  6. Thomas RastJul 29, 2010
  7. Tomas CarneckyJul 29, 2010
  8. t7005: fix subdirectory-filter testThomas Rast, Jul 29, 2010
  9. Thomas RastJul 29, 2010
  10. Adam MercerAug 9, 2010
  11. Adam MercerAug 11, 2010
  12. Jeff KingAug 11, 2010
  13. Adam MercerAug 11, 2010

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.