tldr/pages/common/git-stash.md

28 lines
473 B
Markdown
Raw Normal View History

2013-12-09 11:12:24 +00:00
# git stash
> Stash local Git changes in a temporary area.
2013-12-09 11:12:24 +00:00
- Stash current changes (except new files):
2013-12-09 11:12:24 +00:00
`git stash save {{optional_stash_name}}`
2013-12-09 11:12:24 +00:00
- Include new files in the stash (leaves the index completely clean):
2013-12-09 11:12:24 +00:00
`git stash save -u {{optional_stash_name}}`
2013-12-09 11:12:24 +00:00
- List all stashes:
2013-12-09 11:12:24 +00:00
`git stash list`
- Re-apply the latest stash:
2013-12-09 11:12:24 +00:00
`git stash pop`
- Re-apply a stash by name:
2013-12-09 11:12:24 +00:00
`git stash apply {{stash_name}}`
2014-05-24 21:05:35 +01:00
- Drop a stash by an index:
2014-05-24 21:05:35 +01:00
`git stash drop stash@{index}`