A customer wanted to know which of the git tricks I’ve shared still work if you use a squash instead of a true merge. For example, in the case of splitting a file in two while preserving line history, can this be done with squashing?
Many of the git tricks exploit the way git walks the commit graph, and squashing creates a different graph from merging. Specifically, squashing throws away all our hard work in building a specific commit graph. Instead, squashing takes all the changes and squashes them together into a single commit. It’s as if you made all the changes at one sitting and committed them as a unit.
On the other hand, squashing works just fine with the tricks that involve a single non-merge commit. It just replaces one non-merge commit with an identical one.
0 comments