PSA: git worktree

I just found out that the latest gits have a command called git-worktree: https://git-scm.com/docs/git-worktree

I know that several people who hack on rustc have told me in the past that they have multiple checkouts. Seems like it’d help a lot.

4 Likes

Thanks! For anyone trying at home, it appears to have been added in Git 2.5.

FWIW, similar functionality existed previously in the form of git-new-workdir, so people with older git’s can still get the functionality (I believe the script was available by default, at least on some Linuxes, under /usr/share/git-core/contrib/..., but I’m now on git 2.5, so I can’t check).

The script did in fact come with the distribution, but wasn’t by default placed on the path (at least for me). I must say that git-new-workdir has been an extremely useful tool for me, and I’m definitely looking forward to switching to git-worktree (assuming it’s better :smile:)

Note that the submodule support is still incomplete, according to the manual: “Multiple checkout in general is still experimental, and the support for submodules is incomplete. It is NOT recommended to make multiple checkouts of a superproject.”

Regarding submodules, ./configure still pulls out all of them, so they exist in two (or more) copies. Also, worktree confuses git-gui for some reason.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.