sunmingtao / sample-code

3 stars 4 forks source link

How to squash last N git commits? #342

Closed sunmingtao closed 1 year ago

sunmingtao commented 1 year ago
git reset --soft HEAD~2 
git commit -m "new commit message"
git push -f

2 means the last two commits will be squashed. You can replace it by any number