Showing posts with label stash. Show all posts
Showing posts with label stash. Show all posts

Thursday, October 8, 2009

Stash changes away in Git to work on urgent matters first

Ref: http://ariejan.net/2008/04/23/git-using-the-stash/


Suppose:
- you've made some changes in your current branch but realized you're in the wrong branch
- you've gone off track in making changes that doesn't relate to the branch story
- you need to drop whatever you're doing right now and apply some urgent patch

Git stash to the rescue!

# Stash changes
git stash save "message for later reference"

# List stashes
git stash list

# Apply stash
git stash apply stash@{STASH_ID}

# Drop/delete a stash
git stash drop stash@{STASH_ID}

# Drop/delete last stash
git stash pop

# Clear all stashes
git stash clear

# Quick & dirty stashing
git stash
...
git stash pop