I made 2 commits B and C and then I did
git reset soft HEAD~2
then I did some some changes and added the modified files back with git add and then I did git commit but these changes went onto the previous commit A. Why is this happening and how can I fix this.
CodePudding user response:
git reset soft will just point HEAD to previous commit but didn't change index location. index will still point to latest commit.
git reset --soft HEAD~2
You should use git reset hard this will move HEAD & index both to previous commit.
git reset --hard HEAD~2