I’m using the git-new-workdir script present in contrib section of git’s codebase: https://github.com/git/git/tree/master/contrib/workdir to work with multiple branches of the same code base simultaneously. This is on windows, using msysgit and the repo is a git svn repo and not pure git.
I have no problem creating working copies using this command by saying:
git-new-workdir original-working-copy new-working-copy branch-name-to-checkout
But when I’m no longer interested in the branch and I want to get rid of the working copy, doing an rm -rfR new-working-copy also hoses the original-working-copy.
In hind sight, that is kinda obvious, given that git-new-workdir uses hard links to share the same .git repo between multiple working copies.
What is a good way to clean up working copies created this way, which I no longer want on my machine?
On normal UNIX systems,
git-new-workdiruses symlinks to share everything with the original repo, and so you can simplyrm -rf new-working-copyto delete the new workdir and everything is fine.I have no idea what might be different about msysgit that would change this.
Turns out, as noted in the comments, that the issue is that
rmon Windows usesdel, which actually recurses into symlinks. Deleting a symlink itself requiresrmdir.