Git Worktrees a Neat Command for Working with Multiple Versions of a Repo

Posted on October 1, 2022 by Richard Goulter
Tags:

git-worktree has apparently been in git for some time, but I’ve only recently learned of it.

It lets you conveniently check out multiple versions of a repository at once.

Which may sound only marginally useful; but I find the benefit to be better than it sounds. (e.g. Without the worktree command, perhaps the easiest way to imitate it would be to clone from the local repository, and adjust the remotes).

I’ve found it’s useful to keep a checkout of the master branch, as well as using worktrees for feature branches, or other experimenting.

By keeping work-in-progress in a separate working tree, you don’t have to worry about the working tree being dirty in order to check out different versions.


Newer post Older post