Skip to content

Latest commit

 

History

History
55 lines (41 loc) · 1.38 KB

File metadata and controls

55 lines (41 loc) · 1.38 KB

Git Stash (Advanced)

Stashing allows you to save your messy state on a stack so you can retrieve it later. These commands allow you to interact with the stash stack beyond just the default push and pop.

Apply a specific stash

Applying a stash brings its changes into your working directory, but unlike pop, it leaves the stash on the stack. #keep-stash

git stash apply $stash

Drop a specific stash

git stash drop $stash

Clear all stashes

git stash clear

Show stash diff

See exactly what files are changed in a stash. #diff-stash #view-stash

git stash show -p $stash

Create a branch from a stash

If you stashed some work and the main branch has moved on significantly, applying it might cause conflicts. You can create a new branch directly from the commit where you originally created the stash. #branch-from-stash

git stash branch $branch_name $stash