Git. How do i squash commits?

Option number one

git reset --soft HEAD~3 // number of commits back grom the head
git add -A
git commit --no-verify -m "squashed"
git push --force // or iw work in one branch with teammates git push --force-with-lease 

Option number two

In jetBrains products

Git -> popup on selected commits -> squash

Option number three

In Tortoise Git

Show Log -> Selected commits -> Squash // but here should be clean working tree

This entry was posted in Без рубрики. Bookmark the permalink.