Both .git
repositories are on the same machine but different folders, and belong esentially to the same project. To keep it simple, let's say both copies have two branches:
- The
master
(or Alpha) branch. Last commits to this branch were made infolderA
's.git
repository. - The
stable
(or Beta) branch. Last commits to this branch were made infolderB
's·git repository
So, I want to make both branches hold the last changes in both git
folders again. So, after cleaning both working directories, I guess I just could copy the whole directory project's files from folderB
and make a single commit to the stable
branch inside folderA
. However, I'd like to conserve all the commits from folderB
as well instead. (next time I should not forget to copy the master .git
directory to the beta folder before making any hotfixes to the Beta version so I would not have this problem anymore; but what is done is done ^^')
If it was "local to remote", making a "pull request" would be the way to go I guess. But in my case, both copies of the repository are on the same machine.
Is there any git command to perform such a thing?
CodePudding user response:
You can add a local repository as a remote and use git pull
and handle merge conflicts, etc. as usual
For example
$ cd /path/to/folderB/
$ git remote add localA /path/to/folderA
$ git checkout master
$ git pull localA master