Yes. Make sure you are using the Create a merge commit option when accepting the pull request. This will merge the original commits unchanged.
On the other hand, the Squash and merge and Rebase and merge options will create new (but equivalent) commits with different hashes than the original commits.
Reference: https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/merging-a-pull-request
You asked in the comments:
I want only commits from develop to master on PR completion (same commit number, no extra commits). Is that possible?
In principle, this is possible in Git, by doing a fast-forward merge. However, as the above mentioned page states,
Pull requests are merged using the --no-ff
option
so this is not possible by using the GitHub UI. As the maintainer of the source repository, you would have to manually do this by using the corresponding Git commands:
In your local copy of the repository,
- fetch the new commits from the forked repository,
- do the fast-forward merge (you can enforce it by using the
--ff-only
option for the git merge
command),
- and then push them to GitHub.
Further reading: What is the difference between `git merge` and `git merge --no-ff`?