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 7000493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:40:44+00:00 2026-05-27T20:40:44+00:00

I have a repository within a subdirectory, and now I would like to have

  • 0

I have a repository within a subdirectory, and now I would like to have the parent directories
under version control too, but keep the current history of the repository.

So with the following tree:

a/b/c

c is currently holding a repository, but I would like to have a repository in a, and include all the history within c.

I’m sure there is a way to go around doing this, perhaps with some git filter-branch? I do not want to use submodules, I would like to have a single repository in the end.

  • 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-27T20:40:45+00:00Added an answer on May 27, 2026 at 8:40 pm

    You have a choice:

    You can simply move the current structure into what will be the new structure. Then move the whole repo a level up. git add -A will add all the changes which is a bunch of deletions and new file adds. git status will show them as moved. Each object is stored once, no matter what path it’s on so this won’t be an expensive operation. This would be the simplest option. At this time you can also put in the other high level directories.

    while in c:

    mkdir b
    cd b
    mkdir c
    mv <all other objects from top level> c
    git add -A
    git commit -m "moved everything"
    mv c a
    # clean up
    

    git will determine the fact that a file was moved if you are doing merges and help you.

    Or, you can use filter branch to change history if you like, but all your commits will have different SHA1s. This may be undesireable.

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

Sidebar

Related Questions

I have a subversion repository, and I would like to create a branch, but
Running on Windows I have a repository for a project, I would now like
I have created an SVN repository for project but now realise that the files
I have a repository on my PC. Now I want to move some project
I have a repository that looks something like this: foo/ subrepo/ a_file_in_subrepo another.ext unrelated_file
I have a big repository in a shared folder. I use git from within
We have a git repository managed by gitosis under Ubuntu, which has worked well
Currently, I have a large SVN repository with a bunch of different projects within
I would like to obtain a list of files from a git repository that
I have two repository classes ( RepositoryFactory and BaseRepository ) implementing different interfaces within

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.