What's the difference between git reset --mixed, --soft, and --hard?

后端 未结 15 1504
野的像风
野的像风 2020-11-22 14:39

I\'m looking to split a commit up and not sure which reset option to use.

I was looking at the page In plain English, what does "git reset" do?, but I real

15条回答
  •  庸人自扰
    2020-11-22 14:58

    mkarasek's Answer is great, in simple terms we can say...

    • git reset --soft : set the HEAD to the intended commit but keep your changes staged from last commits
    • git reset --mixed : it's same as git reset --soft but the only difference is it un stage your changes from last commits
    • git reset --hard : set your HEAD on the commit you specify and reset all your changes from last commits including un committed changes.

提交回复
热议问题