gitgithubrepositorymultiple-repositories

I have made 2 git repositores in one directory. Now I want to get rid of one of them. How do I go about that?


These are the commands I used to create 2 repositories in 1 folder.

git init .
mv .git .gitone
git init .
mv .git .gittwo 

Now my folder structures looks like

.gitone
.gittwo
all_other_files
.gitignore

I want to delete the second repository such that my new folder structure looks something like this

.git
all_other_files
.gitignore

I am a bit confused on how to proceed with this. I have equivalent code and commits in both repositories. Any help would be appreciated.


Solution

  • From purely a shell perspective:

    rm -Rf .gittwo
    mv .gitone .git
    
    # Check with:
    git status
    git log
    

    But having two repositories in one folder is unusual.
    Any git command would have to specify its --git-dir (.gitone or .gittwo)