Sometimes I find the need to work on multiple branches in the same repository at
once. This can be caused by many different scenarios; waiting for tests to
finish, running two versions of an application at the same time etc. In short,
anywhere where a regular git stash/branch workflow falls short. I also wanted
a solution where I didn’t have to manage multiple
Git workdir to the rescue
I found a useful script in
git-workdir which enables having the same repository in multiple states. Since
it’s just a bash script, there are many ways to install it, I’ve done it like
With the script installed, you can now create a ‘clone’ of your checkout like this:
The script achieves having multiple states on the same checkout by using some arcane symlinking which I will not go into detail with here. For more information about the script, have a look at the source.
Having multiple states on the same checkout can easily create problems if you’re not paying attention. I recommend strong coffee and/or sufficient sleep beforehand.