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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:51:30+00:00 2026-05-31T01:51:30+00:00

I have two git repositories: git_repo_A: https://github.com/gnychis/coexisyst git_repo_B: https://github.com/gnychis/android-wireless-monitor I want to move everything

  • 0

I have two git repositories:

git_repo_A: https://github.com/gnychis/coexisyst
git_repo_B: https://github.com/gnychis/android-wireless-monitor

I want to move everything in git_repo_A in to a subdirectory in git_repo_B called: application. I want to preserve all commits and file history.

So, after the move, git_repo_A would look like this:

git_repo_A/application/git_repo_B

I found this website that described basically the exact operation that I wanted: http://www.nomachetejuggling.com/2011/09/12/moving-one-git-repo-into-another-as-subdirectory/

So I gave it a shot, but I don’t think it did what I wanted it to.

What looks like ended up happening is two .* files in the main directory got added to git_repo_A/ … and then everything I wanted to show up as git_repo_A/application ended up as a delete operation. Here are the relevant two operations which got moved in to git_repo_A:

https://github.com/gnychis/android-wireless-monitor/commit/23e6639221733158d197bf7c29df8998e8a5c2ef

https://github.com/gnychis/android-wireless-monitor/commit/455ba86a80d8300b16bdd9527c444ebad78f7a9a

I followed the instructions exactly, but that doesn’t mean the instructions were correct. I think it is odd they moved the entire directory without re-adding it. However, I fear if you move it and then re-add it, it doesn’t preserve the file history.

I am the only person who uses these repositories. So it would also be good to hard reset everything that occurred on March 9 and start over: https://github.com/gnychis/android-wireless-monitor/commits/

  • 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-31T01:51:31+00:00Added an answer on May 31, 2026 at 1:51 am

    I’ve done something very similar to this before. It’s almost identical to the process listed in your link, except this allows you to clean things up before committing your merge.

    1) In RepoB (the one you want to keep) add a remote to RepoA
    git remote add RepoA <path_to_repo>

    2) Fetch RepoA history into RepoB
    git fetch RepoA

    3) Merge your relevant branches (assuming you’re on RepoB/master)
    git merge RepoA/master

    4) Move the RepoA files to the appropriate subfolder and commit
    git add .
    git commit -a


    If you haven’t done anything to your RepoB since following the instructions you posted you can do this:
    git reset HEAD~
    Now move any files and clean up what you need.
    git add .
    git commit -a


    As far as moving files and keeping history is concerned, git will track renames for a small number of files by default, since doing so is slow. If you want it to track everything you can use the following command
    git config --global diff.renamelimit 0

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

Sidebar

Related Questions

I have a git repository (at github.com) with two branches: master and gh-pages. I
I have two git repositories: report.git (Master on remote location) cloned.git (Local) I lost
I have two separate git repositories for the same version of a single website.
I have two git repositories that are tangentially related. Namely, content of one was
How can we get the difference between two git repositories? The scenario: We have
I have two repositories on github, and my usernames on github and my local
I have two git repositories on different PCs. I have some local branches on
I have two unrelated (not sharing any ancestor check in) Git repositories, one is
I have two separate git repositories. One is mine, and has Branch A, the
I have two git repositories, like this: proj1 proj2 proj1 has a tag v1.0.0

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.