2018-02-05 02:27:07 +00:00
|
|
|
# Stashing changes
|
2019-11-23 16:05:04 +00:00
|
|
|
```bash
|
2018-08-14 19:44:29 +00:00
|
|
|
# If you can't pull/merge due to a file conflict, stashes changes, does a pull, and then puts the changes back, dropping the stash.
|
|
|
|
# git stash pop = git stash apply && git stash drop
|
2018-02-05 02:27:07 +00:00
|
|
|
git stash
|
|
|
|
git pull
|
|
|
|
git stash pop
|
|
|
|
|
2018-08-14 19:44:29 +00:00
|
|
|
# Stash changes and then apply them, keeping the stash.
|
|
|
|
git stash
|
|
|
|
git pull
|
|
|
|
git stash apply
|
|
|
|
|
|
|
|
# Drop the most recent stash.
|
|
|
|
git stash drop
|
|
|
|
|
2018-02-05 02:27:07 +00:00
|
|
|
# View all Stashes in a pretty list.
|
|
|
|
git stash list --pretty=format:'%Cblue%gd%Cred: %C(yellow)%s'
|
2018-08-14 19:44:29 +00:00
|
|
|
|
|
|
|
# Show file changes in a particular stash (0 = last one).
|
|
|
|
git stash show 'stash@{0}'
|
|
|
|
|
|
|
|
# Show individual changes in a particular stash.
|
|
|
|
git stash show -p 'stash@{0}'
|
2019-11-23 16:05:04 +00:00
|
|
|
```
|