diff --git a/README.md b/README.md index 9bc058e..3087fe0 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ I shamelessly stole this idea from - [Intent To Add](git/intent-to-add.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) ## rails diff --git a/git/stashing-untracked-files.md b/git/stashing-untracked-files.md new file mode 100644 index 0000000..abdc0ab --- /dev/null +++ b/git/stashing-untracked-files.md @@ -0,0 +1,20 @@ +# Stashing Untracked Files + +Normally when stashing changes, using `git stash`, git is only going to +stash changes to *tracked* files. If there are any new files in your project +that aren't being tracked by git, they will just be left lying around. + +You might not want these *untracked* files left behind, polluting your +working copy. Perhaps these files change your projects functionality or +affect the outcome of tests. You just want them out of the way, for the +moment at least. + +And so along comes the `-u` or `--untracked` flag. + +```bash +$ touch new_file.rb +$ git stash +No local changes to stash +$ git stash -u +Saved working directory and index state WIP ... +```