From ba88c82f94b853ab0a8665f54ef4934eb4044d2e Mon Sep 17 00:00:00 2001 From: joseph Date: Sun, 4 Nov 2018 21:35:56 +0000 Subject: [PATCH] added a section for unstaging a staged file. (#243) I have accidentally staged many files in my working copy, and was looking for a way to unstage them by filename as I had some staged files that I wanted to keep. Didn't see anything that addressed my specific issue on the README, so thought of adding it here. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index b234fdd..47cada2 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ All commands should work for at least git version 2.13.0. See the [git website]( - [I want to discard specific unstaged files](#i-want-to-discard-specific-unstaged-files) - [I want to discard only my unstaged local changes](#i-want-to-discard-only-my-unstaged-local-changes) - [I want to discard all of my untracked files](#i-want-to-discard-all-of-my-untracked-files) + - [I want to unstage a specific staged file](#i-want-to-unstage-a-specific-staged-file) - [Branches](#branches) - [I want to list all branches](#i-want-to-list-all-branches) - [Create a branch from a commit](#create-a-branch-from-a-commit) @@ -512,6 +513,17 @@ When you want to get rid of all of your untracked files $ git clean -f ``` + +### I want to unstage a specific staged file + +Sometimes we have one or more files that accidentally ended up being staged, and these files have not been committed before. To unstage them: + +```sh +$ git reset -- +``` + +This results in unstaging the file and make it look like it's untracked. + ## Branches ### I want to list all branches