Skip to content

Instantly share code, notes, and snippets.

@pavelfomin
Last active February 19, 2025 20:03
Show Gist options
  • Save pavelfomin/1048c1a39e6805aefed5b14d9a71bdf0 to your computer and use it in GitHub Desktop.
Save pavelfomin/1048c1a39e6805aefed5b14d9a71bdf0 to your computer and use it in GitHub Desktop.
Advantages of using merge instead of squash in Git

Advantages of using merge instead of squash

  • If there are commits that logically address separate issues it's easier to understand such changes as individual commits in the history rather than squashed result
  • Ability to check if the commits from other branches have been merged to main (using git branch -r --no-merge) which is especially useful for release/* deployment strategies
  • If a file was first renamed and then modified in more than one commit (recommended approach for git to retain history), if these commits are merged then the history is retained. Otherwise, if squashed, git might consider the rename and update as old file deletion and new file addition (depending of the percentage of the changes).

However, there is definitely a case for squashing PRs when individual commits do not provide extra value and just create more "noise".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment