I have two git clones of same remote repository. I have created several stashes in clone A and now want to move those stashes to clone B.
[Clone A] ---- stashes ---> [Clone B]
One workaround I could think of is creating branch for each stash and push that branch to remote through Clone A, and then pull these branches into Clone B. But this is not I would prefer to do.
Could anyone suggest any easier and cleaner way (like copying) of doing it?
You should be able to copy over .git/refs/stash
for the latest stash and .git/logs/refs/stash
for all others up in the stack. Actually you should even be able to pull refs/stash
for the latest one I think.
But this will probably not work correctly, as the commit objects for the stashes will not be present in the copy target. You can maybe set up .git/objects/info/alternates
so that missing objects will be searched in your A repository to make the copy work in the target.
You should probably use git worktree
to have multiple worktrees for the same remote repository instead of multiple clones. You will save much space and I think you should be able to share the stashes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With