How do I check out a previous version of a directory under a new name?
(I have and always had a directory foo
in my repo. I want to create a directory foo_old
in my current working tree whose contents are those of HEAD~2:foo
. I need both versions at the same time, to make sure they give the same results, testing this requires quite a bit of code and requires having both results available at the same time (the results are not simply integers, say), so I cannot simply checkout HEAD~2
temporarily to do what I want)
This question asks how to check out a previous version of a file under a new name, but the accepted answer cannot be generalized to directories.