This is an old revision of the document!
working copies of multiple branches
Sometimes during development we need to have working copies of more than one branch at the same time. With svn this was simple, because working copies of each branch (and/or trunk) would exist at the same time after a checkout.
A single working copy using git would only reflect the active branch. My preference for doing this with git was to have a “master” working copy with my repo that would hold all changes, and another cloned copy that would act as the alternate branch.
(assume master working copy/repo is at /foo/base/.git)
mkdir /foo/alt cd /foo/alt git clone /foo/base . git branch alt git checkout alt git config remote.origin.push alt:alt # work work work git push
Output should be something similar to this:
Counting objects: 5, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 424 bytes, done. Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. To /foo/base/ * [new branch] alt -> alt