🤓
Thomas lab
Git&Github
Git&Github
  • Fetching & Pulling
  • Git alias
  • Git & Github : What is in .git ?
  • Git Rebase
  • Git reflog
  • Git Stash
  • Git tags
  • Git Workflow(Collaboration)
  • Quick High-Level
  • Git diff
  • Git installer
  • Reset & Revert commit
  • Github Collaborators
  • Github Basics
  • Introducing Git
  • Merging Branch
  • How to use multiple account
Powered by GitBook
On this page
  • Stashing
  • Stash pop
  • Stash Apply
  • Stash options
  • Stash work with mutiple times
  • Stash Viewing Stashes
  • Apply specific stashes
  • Dropping Stashes
  • Clear the stash

Git Stash

PreviousGit reflogNextGit tags

Last updated 8 months ago

Stashing

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 .

Stash pop

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

Stash Apply

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

Stash options

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 .

Stash work with mutiple times

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 .

Stash Viewing Stashes

run git stash list to view all stashes

Apply specific 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}

Dropping Stashes

to delete a particular can use git stash drop <stash-id>

Clear the stash

to clear out all stashes, run git stash clear