Git stash command

Twenty Four O Clock
1 min readAug 19, 2020

use for temporaly hide current working files in to stack repository location.

  • List stash

git stash list

  • push current all working files on staying branch to stack repository location

git stash -m”comment message”

or can use in long form command

git stash push -m “comment message”

  • push specific single or multiple file on staying branch to stack reposiotry location

git stash -m”comment message” — fileNameA.txt fileNameB.txt

  • push by specific hunk of files

git stash -m “some part of file” -p — fileBBB.txt fileee.txt

When you see question “Stash this hunk [y,n,q,a,d,e,?] “

“y” is yes hide this single hunk to stack repository

“n” is no hide this single hunk to stack repository

“q” don’t hide this single hunk and all remaining hunk and quit

“a” hide this single hunk and all later hunk in the file

“d” don’t hide this single hunk and all later hunk in then file

“e” manual edit current hunk

  • pop specific stash

git stash pop stash@{x} (stash@{x} will be apply to working and stash@{x} will be removed from stack repository)

  • apply specific stash

git stash apply stash@{x} (stash@{x} will be apply to working but not remove from stack repository)

  • Show Detail of Stash@{x}

git stash show stash@{x}

  • delete one stash

git stash drop stash@{x}

  • delete all stash

git stash clear

--

--