We can squash the last N commits in Git
. As I understand, we can squash last N commits using git rebase -i HEAD~N
or git reset --soft HEAD~N
.
In the answers for this question (Squash my last X commits together using Git) most upvoted answer advices to use git reset --soft HEAD~N
, which is not the accepted one. Accepted answer recommends git rebase -i HEAD~N
. Hence I get confused, which one would be prefered to be used.
How those these approaches differ from each other? Which one is recommended or safe to be used?