In Git a file lives in three places: the working folder (how it is on disk), the stage (how it will go into the next commit) and the last commit. Undoing means bringing one of these back from another; to know which you want, you look at git status first.
git restore settings.jsongit restore --staged keys.txtgit branch -d fix/login
git restore file throws away the change on disk and puts the file back to how it is in the last commit. git restore --staged file only takes the file off the stage; it does not touch the file on disk. git branch -d deletes a branch whose work has been merged.Deleting a merged branch loses no work: the commits are in the history of main, and only the label is removed. Dozens of old branches left open make it hard to tell which are still alive; closing a branch when the work is done is a good habit.