docs:git:stash

git stash

  • create a stash
    git stash save ["name of stash"]
  • view list of stashes
    git stash list
  • view diff of stash
    git stash show --unified stash@{0}
  • see which commit the stash was based on (note if you don't give a stash a specific custom name, it tells you this in the name by default)
    git show-branch master stash@{0}
  • apply stash to current working directory, removing the stash if successful
    git stash pop [optional stash reference such as stash@{0}]
  • delete a stash
    git stash drop [optional stash reference]
  • I prefer to make branches, then just type git stash save; then, when I run git stash list it shows me WIP on <branchname> so I know what that stash was about, rather than staying on master and naming a stash
  • I prefer bash aliases for working with stashes
    • gss = git stash save
    • gsl = git stash list
    • gsp = git stash pop
    • gsa = git stash apply
  • docs/git/stash.txt
  • Last modified: 2012/11/14 16:20
  • by billh