git stash和git stash pop

git stash 可用來暫存當前正在進行的工做, 好比想pull 最新代碼, 又不想加新commit, 或者另一種狀況,爲了fix 一個緊急的bug,  先stash, 使返回到本身上一個commit, 改完bug以後再stash pop, 繼續原來的工做。
基礎命令:
$git stash
$do some work
$git stash pop
git

 

進階:app

git stash save "work in progress for foo feature"this

當你屢次使用’git stash’命令後,你的棧裏將充滿了未提交的代碼,這時候你會對將哪一個版本應用回來有些困惑,rem

git stash list’ 命令能夠將當前的Git棧信息打印出來,你只須要將找到對應的版本號,例如使用’git stash apply stash@{1}’就能夠將你指定版本號爲stash@{1}的工做取出來,當你將全部的棧都應用回來的時候,能夠使用’git stash clear’來將棧清空。it

 

 

git stash          # save uncommitted changes
# pull, edit, etc.
git stash list     # list stashed changes in this git
git show stash@{0} # see the last stash 
git stash pop      # apply last stash and remove it from the list

git stash --help   # for more info
相關文章
相關標籤/搜索