diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb
index f9a9b767ef41383a57625ddd0d4fea7eebc58027..e14c3511e60abdcdc86044d737c4ff007cf1a002 100644
--- a/lib/gitlab/git/commit.rb
+++ b/lib/gitlab/git/commit.rb
@@ -19,13 +19,7 @@ module Gitlab
       def ==(other)
         return false unless other.is_a?(Gitlab::Git::Commit)
 
-        methods = [:message, :parent_ids, :authored_date, :author_name,
-                   :author_email, :committed_date, :committer_name,
-                   :committer_email]
-
-        methods.all? do |method|
-          send(method) == other.send(method)
-        end
+        id && id == other.id
       end
 
       class << self