diff --git a/CHANGELOG b/CHANGELOG
index b5827cc128a88b4b89efd3af4ce28d5a800f59b1..da3bb75fb43c27ac47e11581edcd9cd1e5fe9ed3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@ v 8.13.0 (unreleased)
   - Fix robots.txt disallowing access to groups starting with "s" (Matt Harrison)
   - Revoke button in Applications Settings underlines on hover.
   - Add organization field to user profile
+  - Optimize GitHub importing for speed and memory
 
 v 8.12.2 (unreleased)
   - Fix Import/Export not recognising correctly the imported services.
diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb
index 1d385dba0f55fdb22549664db642984fc08f3bbb..b83212444739702a90661020ee5e4971f73d6d23 100644
--- a/lib/gitlab/github_import/importer.rb
+++ b/lib/gitlab/github_import/importer.rb
@@ -108,6 +108,8 @@ module Gitlab
             end
           end
         end
+
+        project.repository.after_remove_branch
       end
 
       def restore_source_branch(pull_request)
@@ -127,8 +129,6 @@ module Gitlab
       def clean_up_restored_branches(pull_request)
         remove_branch(pull_request.source_branch_name) unless pull_request.source_branch_exists?
         remove_branch(pull_request.target_branch_name) unless pull_request.target_branch_exists?
-
-        project.repository.after_remove_branch
       end
 
       def apply_labels(issuable, raw_issuable)