"Git" more than one branch
May 19, 2019

Patent image

At a previous job I had to review my coworkers code and continue developing a feature. For that I used to just checkout a whole new clone of the project in a review/ folder. From there I could safely review the code locally.

Now I'm working on a large rewrite. This time I need to review how the current system operates. Here is an alternative way to do that:

# git worktree add <path> [<branch>]
git worktree add legacy develop

If you cd to legacy, your git commands will be in the context of that branch. A nice pro-tip to keep in your back pocket!

Get updates