xxxxxxxxxx
git stash save "description of the changes being stashed"
xxxxxxxxxx
# You can always retrieve stashed changes using `git stash`
git stash # To add changes to stash stack
git stash list # Shows list of stashed changes
git stash apply stash@{0} # Retrieve stash
git stash clear # Clear stash list
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
git stash save "WIP: Work in progress"
git stash list
git stash apply stash@{0}
git stash drop stash@{0}
xxxxxxxxxx
git stash save "Stash message for reference" #To add changes to stash stack
git stash list #Shows all the stashed change list
git stash clear #clears stash list
To apply the stash changes :
a) git stash apply stash @{n}
you can reapply the changes to your working copy and keep them in your stash with git stash apply
b) git stash pop stash@{n}
-> Popping your stash removes the changes from your stash and reapplies them to your working copy
n - stash number to be applied #Applying stash changes
git stash -u -u optiontells git stash to also stash your untracked files
git stash drop stash@{1} #Cleaning up your stash
xxxxxxxxxx
# List of git stash commands
git stash save "optional message for yourself" # Stash a copy of your current changes
git stash list # Show list of stashed changes
git stash show -p STASH-NAME # Preview changes that would occur when applying stash
git stash apply STASH-NAME # Apply changes and leaves a copy in the stash
git stash pop STASH-NAME # Apply changes and removes from stash
git stash drop STASH-NAME # Delete a particular saved item
git stash clear # Clear everything from stash
xxxxxxxxxx
# To save a stash with a message:
git stash push -m "my_stash_name"
# list stashes:
git stash list
# To pop (i.e. apply and drop) the nth stash:
git stash pop stash@{n}
#To apply the nth stash:
git stash apply stash@{n}
# To apply a stash by name:
git stash apply stash^{/my_stash_name}
xxxxxxxxxx
if you for get to switch your main branch to another and
now you wanted to move your all changes to new brnack
just follow these steps:
Steps:
1) git stash -m 'your comment'
it will save directory
2) now in which branch you want to switch or checkout just checkout
let's say: git checkout -b 'new_branch_name' <it will create branch from current branch>
3) git stash list (it will list all stash comments, our comment will be on top))
4) git stash apply stash@{0} (0 is the index number which our stash is)
5)now all your changes is in currently branch
xxxxxxxxxx
git stash push -m "my_stash_name"
git stash list
git stash pop stash@{n} //for nth stash
git stash pop stash^{/my_stash_name} #for stash name
git stash apply stash@{n} // apply to only apply and not remove stashex.(ex. pop removes stash)
git stash apply stash^{/my_stash_name}
git stash drop
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