diff --git a/utils/checkstyle.py b/utils/checkstyle.py
index 0e9659e98518..cb7b2d151412 100755
--- a/utils/checkstyle.py
+++ b/utils/checkstyle.py
@@ -207,9 +207,11 @@ class Commit:

     def __parse(self):
         # Get the commit title and list of files.
-        ret = subprocess.run(['git', 'show', '--pretty=oneline',
'--name-status',
-                              self.commit],
-                             stdout=subprocess.PIPE).stdout.decode('utf-8')
+        args = ['git', 'show', '--pretty=oneline', '--name-status']
+        if self.commit != '':
+            args.append(self.commit)
+
+        ret = subprocess.run(args,
stdout=subprocess.PIPE).stdout.decode('utf-8')
         files = ret.splitlines()
