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:
@@ -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)
|
- [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 Changes Within Vim](git/staging-changes-within-vim.md)
|
||||||
- [Staging Stashes Interactively](git/staging-stashes-interactively.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)
|
- [Stashing Untracked Files](git/stashing-untracked-files.md)
|
||||||
- [Verbose Commit Message](git/verbose-commit-message.md)
|
- [Verbose Commit Message](git/verbose-commit-message.md)
|
||||||
|
|
||||||
|
|||||||
30
git/stashing-only-unstaged-changes.md
Normal file
30
git/stashing-only-unstaged-changes.md
Normal 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)
|
||||||
Reference in New Issue
Block a user