Skip to content

Instantly share code, notes, and snippets.

@abcprintf
Created April 26, 2024 07:09
Show Gist options
  • Save abcprintf/1b8c82cf45ead8db82971e7dc66d05cc to your computer and use it in GitHub Desktop.
Save abcprintf/1b8c82cf45ead8db82971e7dc66d05cc to your computer and use it in GitHub Desktop.
git command line

GIT COMMAND LINE

stash

  • Listing your stashes
$ git stash list
$ git stash show

$ git stash save "command message stash"
  • Retrieving stashed changes
$ git stash pop stash@{0}
// or
$ git stash apply stash@{0}
  • Cleaning up the stash
$ git stash clear

$ git stash drop <stash_id>
  • Checking stash diffs
$ git stash show stash@{0}

$ git stash show stash@{0} --patch
  • Checking out to a new branch
$ git stash branch <new_branch> stash@{0}
  • Stashing without disturbing the stash reflog
$ git stash create "sample stash"
63a711cd3c7f8047662007490723e26ae9d4acf9

// Sometimes, you might decide to push the stash entry created via git stash create to the stash reflog:

$ git stash store -m "sample stash testing.." "63a711cd3c7f8047662007490723e26ae9d4acf9"
$ git stash list
stash @{0}: sample stash testing..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment