Skip to content

Commit 5c70490

Browse files
committed
Merge pull request #17 from samarpanda/git_stash
Git stash
2 parents 3ed8741 + efaba7d commit 5c70490

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
* [Pick commits across branches using cherry-pick](https://github.com/git-tips/tips#pick-commits-across-branches-using-cherry-pick)
2727
* [Find out branches containing commit-hash](https://github.com/git-tips/tips#find-out-branches-containing-commit-hash)
2828
* [Git Aliases](https://github.com/git-tips/tips#git-aliases)
29+
* [Saving current state of tracked files without commiting](https://github.com/git-tips/tips#saving-current-state-of-tracked-files-without-commiting)
30+
* [Show list of all saved stashes](https://github.com/git-tips/tips#show-list-of-all-saved-stashes)
31+
* [Apply any stash without deleting from the stashed list](https://github.com/git-tips/tips#apply-any-stash-without-deleting-from-the-stashed-list)
32+
* [Apply last stashed state and delete it from stashed list](https://github.com/git-tips/tips#apply-last-stashed-state-and-delete-it-from-stashed-list)
33+
* [Delete all stored stashes](https://github.com/git-tips/tips#delete-all-stored-stashes)
2934

3035
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
3136
<!-- @doxie.inject end toc -->
@@ -161,5 +166,42 @@ git config --global alias.<handle> <command>
161166
git config --global alias.st status
162167
```
163168

169+
## Saving current state of tracked files without commiting
170+
```sh
171+
git stash
172+
```
173+
174+
## Show list of all saved stashes
175+
```sh
176+
git stash list
177+
```
178+
179+
## Apply any stash without deleting from the stashed list
180+
```sh
181+
git stash apply <stash@{n}>
182+
```
183+
184+
## Apply last stashed state and delete it from stashed list
185+
```sh
186+
git stash pop
187+
```
188+
189+
190+
__Alternatives:__
191+
```sh
192+
git stash apply stash@{0} && git stash drop stash@{0}
193+
```
194+
195+
## Delete all stored stashes
196+
```sh
197+
git stash clear
198+
```
199+
200+
201+
__Alternatives:__
202+
```sh
203+
git stash drop <stash@{n}>
204+
```
205+
164206
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
165207
<!-- @doxie.inject end -->

tips.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,27 @@
9292
{
9393
"title": "Git Aliases",
9494
"tip": "git config --global alias.<handle> <command> \ngit config --global alias.st status"
95+
},
96+
{
97+
"title":"Saving current state of tracked files without commiting",
98+
"tip": "git stash"
99+
},
100+
{
101+
"title":"Show list of all saved stashes",
102+
"tip": "git stash list"
103+
},
104+
{
105+
"title": "Apply any stash without deleting from the stashed list",
106+
"tip": "git stash apply <stash@{n}>"
107+
},
108+
{
109+
"title":"Apply last stashed state and delete it from stashed list",
110+
"tip": "git stash pop",
111+
"alternatives": ["git stash apply stash@{0} && git stash drop stash@{0}"]
112+
},
113+
{
114+
"title": "Delete all stored stashes",
115+
"tip": "git stash clear",
116+
"alternatives": ["git stash drop <stash@{n}>"]
95117
}
96118
]

0 commit comments

Comments
 (0)