Tip: Have two checkouts of the repo

It can be handy to have two checkouts of a repo. One is the primary one (A) for working in. And the other is the “spare” (B).

This can be useful in a number of situations:

  • You’re in the middle of a rebase in A and want to quickly reference something in another branch. Instead of having to mess up your rebase state, or go to github, you just go to B.
  • You’re code reviewing an intense refactor of an API. It can be handy to quickly flip back and forth between the versions of the codebase before and after the API change to get a better sense of what changes. Sometimes the diff isn’t quite enough.
  • You’re code reviewing one branch and want to quickly code review another in a way that’s “immutable” to your work environment.
  • If you want to quickly flip back and forth between builds of two different branches.

3 thoughts on “Tip: Have two checkouts of the repo

    1. Mark Post author

      I would so like to use this feature, but always got tripped up in the past because two worktrees cannot be on the same branch iirc.

  1. Martin

    Fair. I guess it depends on ones mental model, for me branches are simple pointers to commits.

    Either way, multiple checkouts or multiple worktrees are definitely a productivity increase.


Any thoughts?