Squash Merge
merge --squash combines a branch into one staged change you commit yourself.
Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
git switch -q -c feat
echo 1 > f.txt && git add f.txt && git commit -qm 'f1'
echo 2 >> f.txt && git commit -qam 'f2'
git switch -q main
git merge --squash feat >/dev/null
git commit -qm 'Add feature'
git log --format=%sResult
Add feature first
Exercise
Squash.
git merge feat
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.