I have a Git repository, let’s call it Foo
, which I have cloned twice on the same Windows machine. Let’s call the two local repositories Foo1
(in C:reposFoo1
) and Foo2
(in C:reposFoo2
).
Now the reason I have two clones is that I sometimes need to work on different branches at the time: for instance, I may be working on a feature branch on the “working” local repo Foo1
, but then I need to release a urgent hotfix on main
and I don’t want (or cannot) switch away from the feature branch, so I just move to Foo2
and use that for the urgent hotfix. However, the actual reason is irrelevant: I just explained it to clarify the setup.
I have a branch I’m working on in Foo1
, and another one I’m working on in Foo2
. None of these branches are ready to be published, and since I may want to rebase them on main
in the future I’d rather not push them to the remote origin
(i.e., Foo
) that they share.
I want to check if the changes in the branch2
branch from Foo2
can fix the problems that developed because of the changes in the branch1
branch from Foo1
. I want to “push” branch2
to Foo1
and rebase branch1
onto it. However, none of the two repos is bare, and they’re also on a Windows machine, so I don’t know if it’s even possible (let alone recommended) to do such a thing.
Can I somehow “share” a branch between the two local repos without pushing/pulling it to/from the remote?