125
Modern Git Commands and Features You Should Be Using
(martinheinz.dev)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
What checks? Under what situation does checkout lead to loss of changes? If I make changes and attempt to checkout a ref that would overwrite them, I get the following error:
To my knowledge it's not possible to overwrite changes when switching branches/refs (
git checkout <ref>
without any other arguments or flags) so I guess what the author really means is, "If you use checkout incorrectly you can overwrite local changes." As far as I can recall I've never accidentallygit checkout <ref> <some/file>
so I don't see a reason to retrain my muscle memory. I do usegit restore
since it's behavior is a lot more obvious than checkout/reset though sometimes I still usegit checkout <ref> -- <some/file>
because muscle memory.