Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
Scenario: I’m in the middle of writing a new feature.
Boss, to me: “Shit broke. Go figure it out.”
Me, thinking: I’m in the middle of doing some complex work. If I commit/stash and close the open files, it will take a day for me to remember WTF I was doing.
Me: “Oh look, worktrees! I can leave my workspace intact with all the files open, pending changes, test results, terminal output, everything! And just create a new worktree to checkout the production version and debug! I’m saved!”
Also setting up a worktree is really easy. git worktree add ../hotfix prod-branch && cd ../hotfix and get working. Though in reality it’s cd ../hotfix && git checkout prod-branch because I’ve never needed more than one secondary worktree.
Also setting up a worktree is really easy.
git worktree add ../hotfix prod-branch && cd ../hotfix
and get working. Though in reality it’scd ../hotfix && git checkout prod-branch
because I’ve never needed more than one secondary worktree.