How to do it...

After checking the branch, we will create the first commit that we want to squash other commits to. We need to use the abbreviated commit hash from this commit to automatically create other commits that will squash to this commit by performing the following steps:

  1. Start by echoing some text into README.md:
$ echo "More information for developers" >> README.md
  1. This will append more information to README.md for developers; verify that the file has changed using the Git status as follows:
$ git status
On branch readme_update_developer
Your branch is up-to-date with 'origin/master'.
    
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
 (use "git checkout -- <file>..." to discard changes ...

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.