app.js in your working directory. You run the command git restore app.js. What happens to the file app.js?The git restore command resets the file in the working directory to match the last commit, discarding any changes made since then.
notes.txt but never added it to git. You run git restore notes.txt. What is the result?Git cannot restore a file it does not track. It will show an error that the pathspec did not match any files.
git restore . discards all changes in tracked files in the current directory and below. git reset --hard also resets the index and HEAD, which is more than just discarding working changes.
git restore config.yaml but your changes in config.yaml remain. What is the most likely reason?If the file is untracked, git restore cannot discard changes because git does not manage it yet.
index.html both staged and unstaged. You want to discard only the unstaged changes, keeping the staged ones intact. Which command should you use?git restore index.html discards only unstaged changes in the working directory, leaving staged changes untouched. Using --staged affects the staging area instead.
