Bounty short description
Is there a portable way to use a single repository w/ multiple checkouts? As an alternative to ha
If I understand correctly, you are looking for the ability to CopyOut
a specific branch head or commit on a branch, onto an independent directory, for investigation and comparison purposes, while still having your current development/bugfix branch still checked out as your main git 'reference'.
You expect that the independently 'copied out' directory would be unlikely to be re-committed directly to git.
An untested approach would be to use the base git
command with its [--git-dir=<path>] [--work-tree=<path>]
options, and to, through a careful script, adjust/correct your HEAD / Index as you do the CopyOut
and step back to your current branch.
The usual caveats apply..
This would definately need careful testing, and probably needs adjustment around steps 3 & 5, such that step 6-7 is true.
The git work-tree option could give a mechanism for bring in changes from the copyout directory if it had bug fixes that needed committing into the appropriate branch.
UPDATE --------------------------------
The clunx instructions are based on a Windows user's view.
# this is run from your main work dir (that contains .git)
Copy .git/HEAD MyBackup
# HEAD will contain the line similar to "ref: refs/heads/master"
mkdir <path>
# the path should be 'somewhere else', not in your existing directory
# If the path doesn't exist the following checkout will fail
Git --work-tree=<path> checkout <branch>
# this will extract the latest commit on that branch to the work tree path
# or use a commit sha1 instead of <branch>, if you want an exact commit
# Note: your index will be updated to reflect the checked out files, as will HEAD.
Copy MyBackup .git/HEAD
# set the HEAD back to where it was
Git reset
# reset the index appropriate for the previous Head.
# note we dropped the --work-tree parameter
A similar technique can be used to grab any revisions from the extracted path by pointing --work-tree
at the right place at the right time and making sure the index is correctly set. Don't forget the usual caveats [backup, backup, and backup].
This worked for me on a test repo I have. Some of the actions were in Windows.