xxxxxxxxxx
# Stash your changes
git stash
# Optionally, you can provide a message to describe your stash
git stash save "Work in progress - feature XYZ"
# List all stashes
git stash list
# Apply a specific stash (by index)
git stash apply stash@{0}
# Drop a specific stash (by index)
git stash drop stash@{0}
# Apply and drop the most recent stash
git stash pop
# Apply and keep the stash (do not remove it)
git stash branch new-feature-branch
xxxxxxxxxx
# Stash a tracked file
git stash push -m "stash message" <fil_path>
# Stash all tracked files
git stash -m "stash message"
# If file is not tracked you have to add it first "git add <fil_path>"
xxxxxxxxxx
# To stash the changes
git stash
# To see the list of stashes
git stash list
# To apply the most recent stash
git stash apply
# To apply a specific stash
git stash apply stash@{<stashNumber>}
# To remove the most recent stash
git stash drop
# To remove a specific stash
git stash drop stash@{<stashNumber>}
# To apply and remove the most recent stash
git stash pop
# To apply and remove a specific stash
git stash pop stash@{<stashNumber>}
xxxxxxxxxx
$ git stash
Saved working directory and index state WIP on master:
2dfe283 Implement the new login box
HEAD is now at 2dfe283 Implement the new login box
xxxxxxxxxx
// What is stash changes in git?
// git stash temporarily shelves (or stashes) changes you've made to your working copy
// so you can work on something else, and then come back and re-apply them later on.
git stash