Practical uses of git reset --soft?

后端 未结 11 2021
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 16:24

I have been working with git for just over a month. Indeed I have used reset for the first time only yesterday, but the soft reset still doesn\'t make much sense to me.

11条回答
  •  被撕碎了的回忆
    2020-11-22 16:48

    I use it to amend more than just the last commit.

    Let's say I made a mistake in commit A and then made commit B. Now I can only amend B. So I do git reset --soft HEAD^^, I correct and re-commit A and then re-commit B.

    Of course, it's not very convenient for large commits… but you shouldn't do large commits anyway ;-)

提交回复
热议问题