cm0002@mander.xyz to Programmer Humor@programming.dev · 16 days agoWhen you have to checkout the master branchlemmy.worldimagemessage-square14linkfedilinkarrow-up1328
arrow-up1328imageWhen you have to checkout the master branchlemmy.worldcm0002@mander.xyz to Programmer Humor@programming.dev · 16 days agomessage-square14linkfedilink
minus-squareEager Eagle@lemmy.worldlinkfedilinkEnglisharrow-up36·16 days agoit has always bothered me that checkout is overloaded: it can switch branches or discard pending changes in an unrecoverable way. so, PSA, you can replicate the safe part of checkout with git switch and the unsafe with git restore.
minus-squaresik0fewl@lemmy.calinkfedilinkarrow-up7·16 days agoSwitch and restore came later because checkout was problematic.
minus-squareSleeplessCityLights@programming.devlinkfedilinkarrow-up3·16 days agoJust alias stuff like that, make it coherent.
it has always bothered me that checkout is overloaded: it can switch branches or discard pending changes in an unrecoverable way.
so, PSA, you can replicate the safe part of checkout with
git switchand the unsafe withgit restore.Ah, I love coherent software.
Switch and restore came later because checkout was problematic.
Just alias stuff like that, make it coherent.