Why are there two ways to git unstage file: git rm --cached vs git reset HEAD? When should each be used?

I’ve been using Git for a while, and I remember being tripped up early on by the two ways to git unstage file, git reset HEAD <file> vs git rm --cached <file>. The way I understand it now is pretty simple: If you just want to remove the file from the staging area — maybe you staged it by mistake — then git reset HEAD <file> is the go-to. It keeps the file in your working directory, unchanged. You’re just telling Git, “Don’t commit this yet.”

But if you want Git to stop tracking the file entirely, like in cases where you accidentally added something that should be in .gitignore, then git rm --cached <file> is the move. It removes the file from version control in the next commit, but keeps it safely on your disk.