Git Stash
Last updated
Last updated
Git provides ab easy way of shashing these uncommited changes so that we can return to them later , without having to make unnecessary commits .
git stash
git stash
is super useful command that helps you save changes that you are not yet ready to commit . you can stash changes and then come back to them later .
Running git stash will take all uncommited changes (staged and unstaged) and stash them , reverting the changes in your working copy .
git stash pop
use git stash pop
to remove the most recently stashed changes in your stash and re-apply them them your working you
git stash apply
you can use git stash apply
to apply whatever is stashed away, without removing it from stash . this can be useful if you want to apply stashed changes to mutiple branches
git stash -options
if you have untracked files (files that you have never checked in to Git) , they wil not include in the stash
fortunately , you can use the -u options to tell git stash to include thouse untracked files .
You can add mutiple command git stash
You can add mutiple stashed onto the stack of stashes . They will all be stashed in the order you added them
idea
: stashed will create a queue . each time create use git stash
, it will add resource into queue .
run git stash list
to view all stashes
git assumes you want to apply the most recent stash when you run git stash apply
aplly , but you can also specify a pacticular stash like git stash apply stash@{2}
to delete a particular can use git stash drop <stash-id>
to clear out all stashes, run git stash clear