diff --git a/README.md b/README.md index 3a6539c..87a0bcd 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Delete All Untracked Files](git/delete-all-untracked-files.md) - [Dry Runs in Git](git/dry-runs-in-git.md) - [Intent To Add](git/intent-to-add.md) +- [List Untracked Files](git/list-untracked-files.md) - [Staging Changes Within Vim](git/staging-changes-within-vim.md) - [Stashing Untracked Files](git/stashing-untracked-files.md) - [Verbose Commit Message](git/verbose-commit-message.md) diff --git a/git/list-untracked-files.md b/git/list-untracked-files.md new file mode 100644 index 0000000..9cc7d19 --- /dev/null +++ b/git/list-untracked-files.md @@ -0,0 +1,21 @@ +# List Untracked Files + +Git's `ls-files` command is a plumbing command that allows you to list +different sets of files based on the state of the working directory. So, if +you want to list all untracked files, you can do: + +``` +$ git ls-files --others +``` + +This includes files *ignored* by the `.gitignore` file. If you want to +exclude the ignored files and only see *untracked* and *unignored* files, +then you can do: + +``` +$ git ls-files --exclude-standard --others +``` + +There are some other flags worth checking at at `git help ls-files`. + +[source](http://stackoverflow.com/questions/2657935/checking-for-a-dirty-index-or-untracked-files-with-git)