0

I created by mistake a local repository and then I cloned my remote repository inside of that repository. Therefore, now my cloned repo is trapped in this outer repository. is there a way I can extract it?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437

1 Answers1

1

Inspired by @jonrsharpe's comment, just move the cloned directory.

On unix-like systems:

$ cd /base/path/repoA/some/repoB
$ git remote -v     ## shows the inner repoB
$ cd ..
$ git remote -v     ## shows the outer repoA
$ git status        ## shows repoB/ as untracked
$ mv repoB /base/path

Then you can push/commit/etc as needed

$ cd /base/path/repoB
$ git commit . . .
$ git push

You don't have to move it to push changes (git will detect which repo you are working in by searching up your directory path and using the first one).

qneill
  • 1,643
  • 14
  • 18