Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Squashing commits: combining multiple existing commits

...

I have three commits on my branch for a single Jira ticket. I would like to squash them into a single commit before pushing to my branch and creating a pull request.

While on my branch, type:

...

Code Block
languagebash
pick afb581 IGBF-3379: Fix DAS annotations
squash 643d0e IGBF-3379: Fix typo
squash 87871a IGBF-3379: Fix second typo

Save and then close the editor.

The editor will open again showing the commits and their messages. 

Code Block
languagebash
# This is a combination of 3 commits.
# This is the 1st commit message:

IGBF-3379: Fix DAS annotations

# This is the commit message #2:

IGBF-3379: Fix typo

# This is the commit message #3:

IGBF-3379: Fix second typo

My preference is to remove the commit messages for the two squashed commits. You can also update the initial commit message if needed.

Code Block
languagebash
# This is a combination of 3 commits.
# This is the 1st commit message:

IGBF-3379: Fix DAS annotations and typos

# This is the commit message #2:


# This is the commit message #3:

Save and then close the editor.