Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 1 KB

STASH.md

File metadata and controls

60 lines (41 loc) · 1 KB

README

Demonstrate how to use stash

Common uses

Stash a single file

# stash
git stash push -m stash-my-file ./my-file.txt

# unstash 
git restore --source=stash@{0} -- ./my-file.txt

View stashes

# list the stashes
git stash list 

# show the patch diff of the stash
git stash show --patch 0
git stash show --patch 1

# show stashes with untracked files
git stash show -u --patch 0   

Create stashes

# create stash
git stash 

# create single file stash 
git stash push -m "adding stash readme" 36_git/sections/STASH.md

# add unindexed file
git stash push -u -m "adding readme" 55_dotsourcing/README.md

# include untracked
git stash -u 

Apply

# pop, apply and remove from list
git stash pop 0 

# apply and retain on list
git stash apply 0 

Resources

  • Git stash here
  • Git-Tools-Stashing-and-Cleaning here