diff --git a/snippets/stage-files.md b/snippets/stage-files.md index d168836e8..eb1c1e173 100644 --- a/snippets/stage-files.md +++ b/snippets/stage-files.md @@ -6,7 +6,7 @@ tags: commit,beginner Adds files to the staging area. - Use `git add ` to add files to the staging area. -- `` can be a filename or a fileglob. +- `` can be a filename or a fileglob. ```sh git add diff --git a/snippets/unstage-files.md b/snippets/unstage-files.md new file mode 100644 index 000000000..e30682a08 --- /dev/null +++ b/snippets/unstage-files.md @@ -0,0 +1,24 @@ +--- +title: Remove files from the staging area +tags: commit,beginner +--- + +Removes files from the staging area. + +- Use `git restore --staged ` to remove files from the staging area. +- `` can be a filename or a fileglob. + +```sh +git restore --staged +``` + +```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 +```