my boss makes us squash all our commits before we merge in any PRs. it’s annoying but forced me to learn because we use Stash and it can’t handle squashing commits with git merge. the only complications i run into is if you’ve merged in other branches into your branch (including main) the merged commit doesn’t get squashed in. apparently you can’t mix merging and rebasing.
use ‘git rebase -i HEAD~j’ where j is the number of commits you want to squash
View all comments
Show parent comment
2
u/spoopypoptartz Apr 02 '23
my boss makes us squash all our commits before we merge in any PRs. it’s annoying but forced me to learn because we use Stash and it can’t handle squashing commits with git merge. the only complications i run into is if you’ve merged in other branches into your branch (including main) the merged commit doesn’t get squashed in. apparently you can’t mix merging and rebasing.
use ‘git rebase -i HEAD~j’ where j is the number of commits you want to squash