1
0
mirror of https://github.com/tiimgreen/github-cheat-sheet.git synced 2025-08-13 03:13:58 +02:00

Add 'Remove All Deleted Files from the Working Tree' command (see #104)

This commit is contained in:
Rafal Chmiel
2015-02-18 22:04:12 +00:00
parent dda655e494
commit 53e3a65c73

View File

@@ -49,6 +49,7 @@ A collection of cool hidden and not so hidden features of Git and GitHub. This c
- [GitHub Resources](#github-resources)
- [GitHub Talks](#github-talks)
- [Git](#git)
- [Remove All Deleted Files from the Working Tree](#remove-all-deleted-files-from-the-working-tree)
- [Previous Branch](#previous-branch)
- [Stripspace](#stripspace)
- [Checking out Pull Requests](#checking-out-pull-requests)
@@ -578,6 +579,33 @@ GitHubs icons (Octicons) have now been open sourced.
| More Git and GitHub Secrets | https://www.youtube.com/watch?v=p50xsL-iVgU |
## Git
### Remove All Deleted Files from the Working Tree
When you delete a lot of files using `/bin/rm` you can use the following command to remove them from the working tree and from the index, eliminating the need to remove each one individually:
```bash
$ git rm $(git ls-files -d)
```
For example:
```bash
$ git status
On branch master
Changes not staged for commit:
deleted: a
deleted: c
$ git rm $(git ls-files -d)
rm 'a'
rm 'c'
$ git status
On branch master
Changes to be committed:
deleted: a
deleted: c
```
### Previous Branch
To move to the previous branch in Git: