Switch cleanup of test repo to after spec again so we leave nothing behind.
Make switching active branch also reset the index to the branch
Improve dereference method to use internal Git commands
Add merge method that does a 3-way merge between the current branch and the given branch.
Move all merge methods together in file.