DEV Community

Discussion on: Git Squash Simplified

Collapse
 
drumstickz64 profile image
Drumstickz64

I'm confused. Isn't there a --squash flag for git commit?

Collapse
 
pb profile image
Pawel • Edited

Hey @drumstickz64 thanks for asking this question. There's a command git merge --squash <branchname> which can be used to squash the commits of a particular branch but it won't perform an automatic commit you've to perform the commit after squashing. This method can bring you conflicts which you have to resolve manually. This method can be used when you've to squash a large amount of commits of a particular branch into a single one and then merge it into the master branch. This method will be faster than the interactive rebase method. Although interactive rebase method provide you the flexibility to fine tuned your commits and as a beginner you won't feel intimidating as you can see what you are doing as it brings the editor for you.

Collapse
 
drumstickz64 profile image
Drumstickz64 • Edited

I see. I can definitely see situations where the interactive rebase method could be useful. Thank for the explanation. 👍