git reset hard/soft/mixed區別

git reset --soft

回退commit信息,把之前的代碼回退到暫存區(即git add . 沒有git commit -m “”).所以回退完成之後,需要git commit -m ""或者git commit --amend 重新提交就好.

git reset --mixed或者 git reset (默認是git reset --mixed)

回退commit和暫存區(index)信息,即回退完需要重新git add . 和git commit -m ""或者git commit --amend

git reset --hard

回退所有,代碼是指定分支的,暫存區(index)和工作區的代碼都扔棄。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章