DEV Community

Discussion on: Git tips for trunk-based development

Collapse
 
sivaraam profile image
Kaartic Sivaraam

Just wanted to post a little note about the following point:

Both commands accept a stash reference (in the form of stash@{}) which you can use to unstash specific changes.

You don't have to explicitly specify git stash apply stash@{1} (or) git stash pop stash@{0}. Just passing the number would work fine too i.e., you can use them as follows:

# Pops (apply and drop) the last stashed change
git stash pop 0

# Applies the last stashed change
git stash apply 0
Collapse
 
alediaferia profile image
Alessandro Diaferia

Love it, thank you!