Reputation: 2122
At work, we always generate 2 commits when merging a PR. The first one would be a commit for a feature and a separate commit for the merge.
Personally, I find having merge commits would clutter the git log. So I wonder what's the convention or best practices for this?
Upvotes: 4
Views: 2202
Reputation: 29266
You can squash while merging pull request, it will create a single commit. Switch to branch in which you have to merge (let's assume it's master), merge it using squash, commit and push, as follows:
git checkout master
git merge pull-request-branch --squash
git commit -m "Pull request merged in master"
git push origin master
Upvotes: 4