git stash和git stash pop


轉自:http://blog.csdn.net/wh_19910525/article/details/7784901

git stash 可用來暫存當前正在進行的工作, 比如想pull 最新代碼, 又不想加新commit, 或者另外一種情況,為了fix 一個緊急的bug,  先stash, 使返回到自己上一個commit, 改完bug之后再stash pop, 繼續原來的工作。
基礎命令:
$git stash
$do some work
$git stash pop


進階:

git stash save "work in progress for foo feature"

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

git stash list’ 命令可以將當前的Git棧信息打印出來,你只需要將找到對應的版本號,例如使用’git stash apply stash@{1}’就可以將你指定版本號為stash@{1}的工作取出來,當你將所有的棧都應用回來的時候,可以使用’git stash clear’來將棧清空。


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM