Is it possible to have two working trees (two different branches) on the same local repository (== shared .git directory)?
Probably alternates could be helpful here to share one object store among multiple .git/-directories. Check for 'objects/info/alternates' at:
http://www.kernel.org/pub/software/scm/git/docs/gitrepository-layout.html
Yes. But you need to place the second branches workdir in a second directory, and hand manage the swap.
see Git man page:
--work-tree=<path>
Set the path to the working tree. It can be an absolute path or a path relative
to the current working directory. This can also be controlled by setting the
GIT_WORK_TREE environment variable and the core.worktree configuration variable
(see core.worktree in git-config(1) for a more detailed discussion).
This allows you to checkout to as many work tree/directories as you require, and check them back in in any order, against what ever branch you claim to have already checked out.
But don't be surprised if you make a few mistakes. It's a bit like running with scissors.
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