this post was submitted on 05 Apr 2024
127 points (96.4% liked)
Programming
17479 readers
320 users here now
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
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.