Git Squash Explained

Опубликовано: 07 Ноябрь 2025
на канале: A shot of code
2,594
74

In this Git tutorial we look at how and when to use Git Squash. This enables us to combine multiple commits into one as the point of merging from one branch to another. The command to use is as below:

git merge --squash

Usually we'll have a feature branch created and be looking to merge this back in to the master branch. A normal Git merge operation will result in all the commits from the feature branch being added to the history of the main/master branch. This might include commits that are not really needed in the history, for example,

Fixed Typo
Changed colors,
aligned text

Commits like this are not really of value in the main branch and we'd rather just have the single commit in history of 'Feature X added'

Happy Squashing!

00:00 Intro
01:35 Standard merge
02:00 Reset
02:20 Squash merge