暫存修改
項目中會遇到這麼一種情況,就是當你在自己的分支修改了一些文件,但是別人的在這個時候上傳了一些工具類,放在develop分支,普通的解決方案時commit然後Checkout到develop,然後pull,然後merge。
但是有了stash,我們就可以不用這樣做了。
git stash
暫存修改
git checkout develop
切到develop分支
git pull
與遠程develop同步
git checkout your_own_branch
切回自己的branch
git merge develop
從develop分支merge最新代碼
git stash list
察看暫存在棧中的列表
git stash apply
檢回已暫存
修改最後一次commit的Log
git commit --amend
推送本地branch到遠程branch
git push origin [local_branch]:[remote_branch]
也可以簡寫爲: git push origin [local_branch]
刪除遠程Branch
git push origin :[remote_branch]