If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
many git disasters are caused by accidentally running a command while on the wrong branch…
Illustration of a stick figure with a neutral expression.
person: git commit
person, thinking: UGH I didn’t mean to do that on main
… or by forgetting you’re in the middle of a multistep operation
smiling stick figure with curly hair: la la la just writing code
same person, now distressed and surrounded by exclamation marks: OMG I FORGOT I WAS IN THE MIDDLE OF A MERGE CONFLICT
I always keep track of 2 things
- am I on a branch, or am I in detached
HEAD
state? - am I in the middle of some kind of multistep operation? (
rebase
,merge
,bisect
, etc)
I keep my current branch in my shell prompt
~/work/homepage (main) $
to me it’s as important as knowing what directory I’m in
git comes with a script to do this in bash/zsh called git-prompt.sh
decoder ring for the default git shell prompt
(main)
on a branch, everything is normal
((2e832b3...))
((v1.0.13))
the double brackets (( )) mean detached HEAD state
. this prompt can only happen if you explicitly git checkout
a commit/tag/remote-tracking branch
(main|CHERRY-PICK)
(main|REBASE 1/1)
(main|MERGING)
(main|BISECTING)
in the middle of a cherry-pick/rebase/merge/bisect
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!