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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
commit43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch)
treedceebdc68925362117480a5d672bcff122fb625b /doc/topics/git/unstage.md
parent20c84b99005abd1c82101dfeff264ac50d2df211 (diff)
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'doc/topics/git/unstage.md')
-rw-r--r--doc/topics/git/unstage.md15
1 files changed, 10 insertions, 5 deletions
diff --git a/doc/topics/git/unstage.md b/doc/topics/git/unstage.md
index 142a80a9ad9..3f509cdacef 100644
--- a/doc/topics/git/unstage.md
+++ b/doc/topics/git/unstage.md
@@ -2,18 +2,22 @@
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
-comments: false
---
-# Unstage **(FREE)**
+# Unstage a file in Git **(FREE)**
-- To remove files from stage use reset HEAD where HEAD is the last commit of the current branch. This unstages the file but maintain the modifications.
+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
+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.
```shell
git reset HEAD <file>
```
-- To revert the file back to the state it was in before the changes we can use:
+- To revert the file back to the state it was in before the changes:
```shell
git checkout -- <file>
@@ -26,7 +30,8 @@ comments: false
git rm -r <dirname>
```
-- If we want to remove a file from the repository but keep it on disk, say we forgot to add it to our `.gitignore` file then use `--cache`:
+- To keep a file on disk but remove it from the repository (such as a file you want
+ to add to `.gitignore`), use the `rm` command with the `--cache` flag:
```shell
git rm <filename> --cache