sigmavirus24: You'll need to rebase this on top of develop once #652 merges.
sigmavirus24: Closing & Reopening apparently will trigger a new merged build on Travis.
itsmemattchung: Thanks for submitting the PR.  Instead of modifying the existing test case, test_merge, please add a new test case to cover the new use case (i.e not passing in `commit_message`)
broady: I haven't forgotten about this. I'll finish this up in the next couple days. Thanks for the review.
diff --git a/github3/pulls.py b/github3/pulls.py
index e1b843cd..2511c004 100644
--- a/github3/pulls.py
+++ b/github3/pulls.py
@@ -311,7 +311,7 @@ class PullRequest(models.GitHubCore):
         return self._iter(int(number), url, IssueComment, etag=etag)
 
     @requires_auth
-    def merge(self, commit_message='', sha=None, squash=False):
+    def merge(self, commit_message=None, sha=None, squash=False):
         """Merge this pull request.
 
         :param str commit_message: (optional), message to be used for the
@@ -322,9 +322,11 @@ class PullRequest(models.GitHubCore):
             head branch.
         :returns: bool
         """
-        parameters = {'commit_message': commit_message, 'squash': squash}
+        parameters = {'squash': squash}
         if sha:
             parameters['sha'] = sha
+        if commit_message is not None:
+            parameters['commit_message'] = commit_message
         url = self._build_url('merge', base_url=self._api)
         json = self._json(self._put(url, data=dumps(parameters)), 200)
         if not json:

Allow `commit_message` default for merging
To do this, `commit_message` must be omitted from the request (not just empty).

https://github.com/sigmavirus24/github3.py/blob/7ebca532da8dcc7f22be9f7f1b13fdea3e4d34c0/github3/pulls.py#L312-L331

https://developer.github.com/v3/repos/merging/


<bountysource-plugin>
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/39229921-allow-commit_message-default-for-merging?utm_campaign=plugin&utm_content=tracker%2F183477&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F183477&utm_medium=issues&utm_source=github).
</bountysource-plugin>
diff --git a/tests/unit/test_pulls.py b/tests/unit/test_pulls.py
index a5b7480b..828c1b29 100644
--- a/tests/unit/test_pulls.py
+++ b/tests/unit/test_pulls.py
@@ -95,7 +95,7 @@ class TestPullRequest(helper.UnitHelper):
 
         self.put_called_with(
             url_for('merge'),
-            data={"squash": False, "commit_message": ""}
+            data={"squash": False}
         )
 
     def test_merge_squash_message(self):

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov
3.5
dev-requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
betamax==0.8.1
betamax-matchers==0.4.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
distlib==0.3.9
filelock==3.4.1
-e git+https://github.com/sigmavirus24/github3.py.git@e57cdf6b2f3fb3eec9bf235a1b55f2bd4bd41d85#egg=github3.py
idna==3.10
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
mock==1.0.1
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
requests==2.27.1
requests-toolbelt==1.0.0
six==1.17.0
swebench-matterhorn @ file:///swebench_matterhorn
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
uritemplate==4.1.1
urllib3==1.26.20
virtualenv==20.17.1
zipp==3.6.0

name: github3.py
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - betamax==0.8.1
      - betamax-matchers==0.4.0
      - charset-normalizer==2.0.12
      - coverage==6.2
      - distlib==0.3.9
      - filelock==3.4.1
      - idna==3.10
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - mock==1.0.1
      - packaging==21.3
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - requests==2.27.1
      - requests-toolbelt==1.0.0
      - six==1.17.0
      - swebench-matterhorn==0.0.0
      - toml==0.10.2
      - tomli==1.2.3
      - tox==3.28.0
      - typing-extensions==4.1.1
      - uritemplate==4.1.1
      - urllib3==1.26.20
      - virtualenv==20.17.1
      - wheel==0.21.0
      - zipp==3.6.0
prefix: /opt/conda/envs/github3.py

tests/unit/test_pulls.py::TestPullRequest::test_merge
tests/unit/test_pulls.py::TestPullRequest::test_close tests/unit/test_pulls.py::TestPullRequest::test_create_comment tests/unit/test_pulls.py::TestPullRequest::test_create_review_comment tests/unit/test_pulls.py::TestPullRequest::test_diff tests/unit/test_pulls.py::TestPullRequest::test_is_merged_no_requset tests/unit/test_pulls.py::TestPullRequest::test_is_merged_request tests/unit/test_pulls.py::TestPullRequest::test_issue tests/unit/test_pulls.py::TestPullRequest::test_merge_squash_message tests/unit/test_pulls.py::TestPullRequest::test_patch tests/unit/test_pulls.py::TestPullRequest::test_reopen tests/unit/test_pulls.py::TestPullRequest::test_update tests/unit/test_pulls.py::TestPullRequestRequiresAuthentication::test_close tests/unit/test_pulls.py::TestPullRequestRequiresAuthentication::test_create_review_comment tests/unit/test_pulls.py::TestPullRequestRequiresAuthentication::test_merge tests/unit/test_pulls.py::TestPullRequestRequiresAuthentication::test_reopen tests/unit/test_pulls.py::TestPullRequestRequiresAuthentication::test_update tests/unit/test_pulls.py::TestPullRequestIterator::test_commits tests/unit/test_pulls.py::TestPullRequestIterator::test_files tests/unit/test_pulls.py::TestPullRequestIterator::test_issue_comments tests/unit/test_pulls.py::TestPullRequestIterator::test_review_comments tests/unit/test_pulls.py::TestReviewComment::test_reply tests/unit/test_pulls.py::TestReviewComment::test_reply_requires_authentication tests/unit/test_pulls.py::TestPullFile::test_contents
github3/pulls.py
github3/pulls.py