cm0002@mander.xyz to Programmer Humor@programming.dev · 3 months agoWhen you have to checkout the master branchlemmy.worldimagemessage-square20fedilinkarrow-up1388arrow-down14
arrow-up1384arrow-down1imageWhen you have to checkout the master branchlemmy.worldcm0002@mander.xyz to Programmer Humor@programming.dev · 3 months agomessage-square20fedilink
minus-squareEager Eagle@lemmy.worldlinkfedilinkEnglisharrow-up39·3 months 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-up9·3 months agoSwitch and restore came later because checkout was problematic.
minus-squareSleeplessCityLights@programming.devlinkfedilinkarrow-up2·3 months 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.