Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/topics/git/unstage.md')
-rw-r--r--doc/topics/git/unstage.md27
1 files changed, 21 insertions, 6 deletions
diff --git a/doc/topics/git/unstage.md b/doc/topics/git/unstage.md
index 028f34b2433..95958600fb4 100644
--- a/doc/topics/git/unstage.md
+++ b/doc/topics/git/unstage.md
@@ -1,28 +1,43 @@
---
stage: Create
group: Source Code
-info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
+info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
---
# Unstage a file in Git **(FREE ALL)**
When you _stage_ a file in Git, you instruct Git to track changes to the file in
-preparation for a commit. To instruct Git to disregard changes to a file, and not
+preparation for a commit. To disregard changes to a file, and not
include it in your next commit, _unstage_ the file.
-- To remove files from stage use `reset HEAD`, where HEAD is the last commit of
- the current branch. This unstages the file but maintains the modifications.
+## Unstage a file
+
+- To remove files from staging, but keep your changes:
```shell
git reset HEAD <file>
```
-- To revert the file back to the state it was in before the changes:
+- To unstage the last three commits:
+
+ ```shell
+ git reset HEAD^3
+ ```
+
+- To unstage changes to a certain file from HEAD:
```shell
- git checkout -- <file>
+ git reset <filename>
```
+After you unstage the file, to revert the file back to the state it was in before the changes:
+
+```shell
+git checkout -- <file>
+```
+
+## Remove a file
+
- To remove a file from disk and repository, use `git rm`. To remove a directory, use the `-r` flag:
```shell