1
0
mirror of https://github.com/namibia/tips.git synced 2024-11-13 16:56:30 +00:00

Merge pull request #17 from samarpanda/git_stash

Git stash
This commit is contained in:
hemanth.hm 2015-07-28 12:08:58 +05:30
commit 5c7049059c
2 changed files with 64 additions and 0 deletions

View File

@ -26,6 +26,11 @@
* [Pick commits across branches using cherry-pick](https://github.com/git-tips/tips#pick-commits-across-branches-using-cherry-pick)
* [Find out branches containing commit-hash](https://github.com/git-tips/tips#find-out-branches-containing-commit-hash)
* [Git Aliases](https://github.com/git-tips/tips#git-aliases)
* [Saving current state of tracked files without commiting](https://github.com/git-tips/tips#saving-current-state-of-tracked-files-without-commiting)
* [Show list of all saved stashes](https://github.com/git-tips/tips#show-list-of-all-saved-stashes)
* [Apply any stash without deleting from the stashed list](https://github.com/git-tips/tips#apply-any-stash-without-deleting-from-the-stashed-list)
* [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)
* [Delete all stored stashes](https://github.com/git-tips/tips#delete-all-stored-stashes)
<!-- Dont remove or change the comment below that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
<!-- @doxie.inject end toc -->
@ -161,5 +166,42 @@ git config --global alias.<handle> <command>
git config --global alias.st status
```
## Saving current state of tracked files without commiting
```sh
git stash
```
## Show list of all saved stashes
```sh
git stash list
```
## Apply any stash without deleting from the stashed list
```sh
git stash apply <stash@{n}>
```
## Apply last stashed state and delete it from stashed list
```sh
git stash pop
```
__Alternatives:__
```sh
git stash apply stash@{0} && git stash drop stash@{0}
```
## Delete all stored stashes
```sh
git stash clear
```
__Alternatives:__
```sh
git stash drop <stash@{n}>
```
<!-- Dont remove or change the comment below that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
<!-- @doxie.inject end -->

View File

@ -92,5 +92,27 @@
{
"title": "Git Aliases",
"tip": "git config --global alias.<handle> <command> \ngit config --global alias.st status"
},
{
"title":"Saving current state of tracked files without commiting",
"tip": "git stash"
},
{
"title":"Show list of all saved stashes",
"tip": "git stash list"
},
{
"title": "Apply any stash without deleting from the stashed list",
"tip": "git stash apply <stash@{n}>"
},
{
"title":"Apply last stashed state and delete it from stashed list",
"tip": "git stash pop",
"alternatives": ["git stash apply stash@{0} && git stash drop stash@{0}"]
},
{
"title": "Delete all stored stashes",
"tip": "git stash clear",
"alternatives": ["git stash drop <stash@{n}>"]
}
]