1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 15:18:01 +00:00

Add Stashing Only Unstaged Changes as a git til.

This commit is contained in:
jbranchaud
2015-05-22 09:04:52 -05:00
parent 4c5a0274d8
commit b3d4535e83
2 changed files with 31 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
- [Single Key Presses in Interactive Mode](git/single-key-presses-in-interactive-mode.md)
- [Staging Changes Within Vim](git/staging-changes-within-vim.md)
- [Staging Stashes Interactively](git/staging-stashes-interactively.md)
- [Stashing Only Unstaged Changes](git/stashing-only-unstaged-changes.md)
- [Stashing Untracked Files](git/stashing-untracked-files.md)
- [Verbose Commit Message](git/verbose-commit-message.md)

View File

@@ -0,0 +1,30 @@
# Stashing Only Unstaged Changes
If you have both staged and unstaged changes in your project, you can
perform a stash on just the unstaged ones by using the `-k` flag. The
staged changes will be left intact ready for a commit.
```
$ git status
On branch master
...
Changes to be committed:
modified: README.md
Changes not staged for commit:
modified: app/models/user.rb
$ git stash -k
Saved working directory and index state ...
$ git status
On branch master
...
Changes to be committed:
modified: README.md
```
h/t [Chris Erin](https://twitter.com/MCNormalMode)