How can I merge multiple commits onto another branch as a single squashed commit?

Say your bug fix branch is called bugfix and you want to merge it into master: This will take all the commits from the bugfix branch, squash them into 1 commit, and merge it with your master branch. Explanation: Switches to your master branch. Takes all commits from the bugfix branch and groups it for a 1 commit with your current branch.(no merge commit appears; you … Read more

Squash my last X commits together using Git

Use git rebase -i <after-this-commit> and replace “pick” on the second and subsequent commits with “squash” or “fixup”, as described in the manual. In this example, <after-this-commit> is either the SHA1 hash or the relative location from the HEAD of the current branch from which commits are analyzed for the rebase command. For example, if … Read more

tech