1

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.

  • May I ask why you created two repositories? Which problem was that approach trying to solve? – Lasse V. Karlsen Nov 09 '20 at 08:02
  • 1
    In the start of the project I thought lets have 2 repositories, one for organization I was working for and another for myself. But later realized it was a waste. I followed this [answer](https://stackoverflow.com/questions/436125/two-git-repositories-in-one-directory) to make 2 repositories. – Sarthak Agrawal Nov 10 '20 at 10:26

1 Answers1

1

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)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250