this post was submitted on 05 Apr 2024
126 points (96.3% liked)

Programming

17417 readers
38 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] firelizzard@programming.dev 2 points 7 months ago
  • 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.