Git · Junior · Question 29 of 75

How do you unstage a file but keep its changes?

Explanation

--staged resets the index entry to the last commit, while the working copy stays as is. git reset file.js does the same.

Further reading

Problem with a question

Git · Junior · question 29

Test yourself

Take the Git · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz