Stash
Use to save current work temporally
git stash list // list all stashed files
// saving Stash
git stash ( stash current commited work( not staged) )
git stash save // same as above
git stash save "Stash title"
git stash -u ( -u used to stash even untracked changes)
// check changes on particular stash
git stash show stash@{2} // got stash@{2} from `git stash list`
// Retrieve Stash
git stash apply // get recent/latest stash
git stash apply stash@{2} // get specific stash
// remove stash
git stash drop // drop recent stash
git stash drop stash@{3}
// Retrieve & remove stash in one command
git stash pop stash@{3}
// remove all stash in one go
git stash clear
Branch from stash
git stash branch my-branch
// it will get recent/latest/stash@{1}
// and create a branch out of it
// and remove stash
// do changes & commit
git checkout master
git merge my-branch
git branch -d my-branch
Last updated
Was this helpful?