git restore --staged?example.txt. You run git restore --staged example.txt. What happens to the file's state?Using git restore --staged removes the file from the staging area (index) but keeps your changes in the working directory. It does not delete or commit the file.
config.yaml. Which command will unstage it without losing your changes?git restore --staged removes the file from staging but keeps changes. git reset --hard discards changes. git commit --amend changes commits. git rm --cached removes the file from staging but keeps it in the working directory.
git restore --staged not remove changes from the working directory?git restore --staged README.md but your changes in the file are still visible. Why?git restore --staged unstages the file but does not touch your actual file changes in the working directory. To discard changes, a different command is needed.
app.js. You want to unstage it and also remove all changes, restoring it to the last commit. Which sequence is correct?First, git restore --staged app.js unstages the file. Then, git restore app.js discards changes in the working directory, restoring the last committed version.
git restore --staged . unstages all files in the current directory and below, keeping your changes. git reset --hard discards all changes. git clean -fd removes untracked files. git rm --cached -r . removes files from staging but keeps them in the working directory.