Add unstage files

This commit is contained in:
Chalarangelo
2021-04-06 19:38:51 +03:00
parent aed3d78bb1
commit 5e3f93ba9d
2 changed files with 25 additions and 1 deletions

View File

@ -6,7 +6,7 @@ tags: commit,beginner
Adds files to the staging area.
- Use `git add <pathspec>` to add files to the staging area.
- `<patcspec>` can be a filename or a fileglob.
- `<pathspec>` can be a filename or a fileglob.
```sh
git add <pathspec>

24
snippets/unstage-files.md Normal file
View File

@ -0,0 +1,24 @@
---
title: Remove files from the staging area
tags: commit,beginner
---
Removes files from the staging area.
- Use `git restore --staged <pathspec>` to remove files from the staging area.
- `<pathspec>` can be a filename or a fileglob.
```sh
git restore --staged <pathspec>
```
```sh
git restore --staged "30seconds.txt"
# Remove the file `30seconds.txt` from the staging area
git restore --staged src/*.json
# Remove all files with a `.json` extension in the `src` directory
git restore --staged .
# Remove all changes from the staging area
```