I was happily (I had just started obviously) browsing Twitter today when I saw this tweet from the esteemed Wilfred Hughes:
git-worktree allows you to have multiple branches checked out simultaneously! https://t.co/R3ExhMNf7E— Wilfred Hughes (@wilfredh) December 4, 2017
Huh? What is
git-worktree? A quick Google landed me on the documentation for
git-worktree. The ;TLDR of
git-worktree is that it breaks time and space and lets a user check out multiple branches at the same time. No more stash-checkout-stash-pop dance between branches and fixes! The example in the documentation is really really good (except for the boss part, that's usually played by my short-attention span).
After reading the documentation, my next thought was "Does magit support this?" Yep, since last year! Let me take this moment to rave like a maniac, magit is amazing and everyone should be using it as their primary git client (irregardless of Emacs usage for text-editing). As the documentation explains, to get worktree information in the standard magit status buffer the
magit-status-sections-hook needs to be updated like so:
(add-hook 'magit-status-sections-hook 'magit-insert-worktrees).
The actions for creating or checking out a worktree are (hiding) in the branches (
b) popup. I don't know why I've never noticed them until now!
git-worktree is another example of
git not standing still. It's exceptional (even under-appreciated) software that continues to improve and that's something that doesn't get enough praise and attention.