Skip to content

Commit 9c740a9

Browse files
authored
Create name_a_stash_and_apply_it.md
1 parent a60192a commit 9c740a9

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

git/name_a_stash_and_apply_it.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Naming a `git stash` and re-applying it later
2+
3+
> Disclaimer: Not a git expert.
4+
5+
Helped out by this [StackOverflow](https://stackoverflow.com/a/49559472) and the [`git stash docs`](https://git-scm.com/docs/git-stash#Documentation/git-stash.txt-push-p--patch-k--no-keep-index-u--include-untracked-a--all-q--quiet-m--messageltmessagegt--ltpathspecgt82308203)
6+
7+
## Name the code in your `git stash`
8+
9+
`git stash push -m "message"`
10+
11+
## See your stashes
12+
13+
`git stash list`
14+
15+
This command will output something like:
16+
17+
```
18+
stash@{0}: On develop: perf-spike
19+
stash@{1}: On develop: node v10
20+
```
21+
22+
## Apply a stash
23+
24+
`git stash apply {n}`
25+
26+
Where `n` corresponds to the integer in `stash@{n}` from your `git stash list` output.
27+
28+
## Delete a single stash
29+
30+
`git stash drop {n}`
31+
32+
## Delete all stashes
33+
34+
All means all.
35+
36+
`git stash clear`
37+

0 commit comments

Comments
 (0)