cm0002@mander.xyz to Programmer Humor@programming.dev · 1 个月前When you have to checkout the master branchlemmy.worldimagemessage-square41fedilinkarrow-up1463arrow-down16
arrow-up1457arrow-down1imageWhen you have to checkout the master branchlemmy.worldcm0002@mander.xyz to Programmer Humor@programming.dev · 1 个月前message-square41fedilink
minus-squareEager Eagle@lemmy.worldlinkfedilinkEnglisharrow-up46·1 个月前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 switch and the unsafe with git restore.
minus-squaresik0fewl@lemmy.calinkfedilinkarrow-up13·1 个月前Switch and restore came later because checkout was problematic.
minus-squarenightlily@leminal.spacelinkfedilinkEnglisharrow-up3·edit-21 个月前Has someone made a „Checkout considered harmful“ blog post yet or do we not do that anymore?
minus-squareanomnom@sh.itjust.workslinkfedilinkEnglisharrow-up1·1 个月前E we used to always stash before checkouts to try and find things in a branch
minus-squareSleeplessCityLights@programming.devlinkfedilinkarrow-up3·1 个月前Just alias stuff like that, make it coherent.
minus-squareScrollone@feddit.itlinkfedilinkarrow-up1·1 个月前I agree, I wonder why they decided to design it that way in the first place.
minus-squarepaperplane@lemmy.worldlinkfedilinkarrow-up1·21 天前In both cases, checkout updates your working tree (by checking out either all or just some files from a commit), just when you’re switching branches it moves your HEAD pointer too
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.
Has someone made a „Checkout considered harmful“ blog post yet or do we not do that anymore?
E we used to always stash before checkouts to try and find things in a branch
Just alias stuff like that, make it coherent.
I agree, I wonder why they decided to design it that way in the first place.
In both cases, checkout updates your working tree (by checking out either all or just some files from a commit), just when you’re switching branches it moves your HEAD pointer too