xxxxxxxxxx
git stash ==> simply add your changes to save location and allow to run diff commands
git stash list ==> to view all the stashed
git stash show ==> to view recent stash
git stash show stash@{2} ==> to view specific stash
git stash apply ==> will get your most recent stash and apply them to your repo while preserve the stash
git stash pop ==> similar to apply but clean up the latest stash
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
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
git stash list [<log-options>]
git stash show [-u|--include-untracked|--only-untracked] [<diff-options>] [<stash>]
git stash drop [-q|--quiet] [<stash>]
git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
git stash branch <branchname> [<stash>]
git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [-m|--message <message>]
[--pathspec-from-file=<file> [--pathspec-file-nul]]
[--] [<pathspec>…•]]
git stash clear
git stash create [<message>]
git stash store [-m|--message <message>] [-q|--quiet] <commit>
xxxxxxxxxx
git stash save "WIP: Work in progress"
git stash list
git stash apply stash@{0}
git stash drop stash@{0}
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
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
# 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
# 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 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