Re:Things I wish everyone knew about Git (Part I)
by cryptonector on Thursday June 30, 2022 @02:28PM
(#31936526)
> The GP was talking about "moving the branch pointer",
Not explicitly.
`git checkout ref path` implies `--force`, since you're being specific.
I would prefer if Git could keep a GCed pile of saved workspace changes every time you force checkout/reset.
But for the love of all that is good, stop using `git checkout`/`git reset` in the few ways they hurt.
git checkout can also nuke changes from both working copy and staging area. `git checkout <path>` will nuke working copy (and auto-completion is likely to give you a path when you were looking for a branch), `git checkout <ref> <path>` will nuke both. No --force required in either case, so let's not pretend that you can't lose changes without a scary-looking flag like --force or --hard.