Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6698163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:32:42+00:00 2026-05-26T06:32:42+00:00

I have looked at several threads addressing this. Combining multiple git repositories Combining multiple

  • 0

I have looked at several threads addressing this.

Combining multiple git repositories

Combining multiple git repositories having a space in their name

I also looked at the git filter-branch manpage.


update

I have changed to a 2 script system:

#!/bin/bash
git filter-branch --index-filter '~/doit.sh' HEAD

and doit.sh

#!/bin/bash
git ls-files -s | \ 
    sed "s-\t-&data/perl_modules/-" | \ 
    GIT_INDEX_FILE="$GIT_INDEX_FILE.new" git update-index --index-info && \
    mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"

This avoids the previous error, but now gets this (replaced path with […]):

Rewrite c35e4ef0626fb2045f57fa5b605e7663b8d06196 (1/10977)mv: cannot stat `[...]/.git-rewrite/t/../index.new': No such file or directory
index filter failed: ~/doit.sh

When I run the

ls-files- s | sed ... | git update-index ...

I get the index file it should generate. As well when I change the doit.sh file to output the result of sed instead of piping it to git update-index it appears to produce the proper output… it seems git update-index is simply not creating the file when run under –index-filter….


Update again:

When I change

mv “$GIT_INDEX_FILE.new” “$GIT_INDEX_FILE”

to

mv “$GIT_INDEX_FILE.new” “$GIT_INDEX_FILE” || true

It fails the first mv, but all the others (so far) are working.


All of this culminated in this script:

git filter-branch --index-filter \
    'git ls-files -s | sed "s-\t\"*-&data/perl_modules/-" |
            GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
                    git update-index --index-info &&
     mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD

Theoretically this script should take all the files in the repository, shove them into data/perl_modules/, and rewrite history so that it appears the files have always been in that directory.

However I get this error:

fatal: ambiguous argument 'ls-files': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions

Not sure how to proceed, I don’t understand the script well enough to debug it, and it is taken directly from the git filter-branch manpage.

I have tried this both before and after manually moving the files to the subdir in case it required they be moved, or required they not be moved.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:32:43+00:00Added an answer on May 26, 2026 at 6:32 am

    There were a couple problems.

    1) git filter-branch –index filter was not using the ‘…’ properly.

    I am not sure why this is, a bug with git-filter, an environment problem? who knows. But I was able to fix it by moving everything out of the ‘…’ and putting it into a script file. I then called the script inside the ”

    git filter-branch --index-filter '~/doit.sh' HEAD
    

    And doit.sh:

    #!/bin/bash
    
    git ls-files -s | \ 
        sed "s-\t-&data/perl_modules/-" | \ 
        GIT_INDEX_FILE="$GIT_INDEX_FILE.new" git update-index --index-info
    
    mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE" || true
    

    2) The first commit was empty, so there was no index.new to mv

    This git repo was imported from svn using git-svn. As such the first commit was completely empty simply saying initial svn repo initialization. As such there were no files moved, and no index.new to move. This was solved by adding || true to the mv command. Note however that if more than one mv command fails you have other problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've looked at several objects in the root\virtualization name space but I have not
I have looked around on the Internet trying to answer this question. It seems
I have looked all of the place for this and I can't seem to
I have looked at several variations on the Reachability example such as the Donoho
I have looked through several answers for loading CSS pages. http://docs.djangoproject.com/en/dev/howto/static-files/ Basically, I believe
I have looked at several possible solutions to my issue but did not find
I have looked at several tutorials involving rails 3 and jquery. The tutorial at
I have looked at several code snippets where people suggest that the AcceptsReturn property
I have looked at several tutorials using android and ksoap2. My service works fine
I have a common problem, and have looked at several solutions but haven't seen

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.