About
git stash 1) stashes the changes in a dirty working directory away before a pull/merge to bring them back later with a local merge.
Example: Before a pull or a merge to integrate the remote changes
git stash # keep the modification in a stash branch
Saved working directory and index state WIP on branch name: 17e7b33 Commit message
git pull # get the last one
git stash pop # Destash the modification and merge them
Merge strategy
git stash pop pops the top stash off of the stack and merges it with your working environment. ?
The merge can be also done with cherry-pick to specify the strategy.
git cherry-pick -n -m1 -Xtheirs stash
where:
- -m1 specifies the first parent as the merge base
- -n specifies not to commit the result.