i mistakenly cloned a repo in two different folders on git bash one is located on the root folder while the other is in a folder I created, now all my recent commits and push doesn't show up on the one on the root folder even though both of them are the same, now i want to merge both together to become one repo and be on the root folder
Asked
Active
Viewed 22 times
1
-
1Why don't you create a temporary branch? – MadProgrammer Sep 20 '22 at 20:40
-
One repo cloned into two places equals three repos. Not to worry though: separate repositories can share *commits*. They all have separate *branch names*, but you can easily send the *commits* from one repository to another, just be sure to use a *different branch name* if and as necessary. – torek Sep 21 '22 at 04:52
1 Answers
0
You can add a remote to reference your second local repository from your first:
cd /path/to/root/folder
git remote add secondrepo /path/to/subfolder
git fetch secondrepo
git switch main
git merge secondrepo/main
This assumes you were committing on branch main
in both repositories.

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