diff --git a/composer.json b/composer.json
index 2276dcd5bee3d36ecb0a690a3039a2728b281a08..b2466eab971f7490750f6cb2816d9d4846da9dbd 100644
--- a/composer.json
+++ b/composer.json
@@ -168,7 +168,8 @@
   },
   "config": {
     "bin-dir": "bin/",
-    "secure-http": false
+    "secure-http": false,
+    "preferred-install": "dist"
   },
   "autoload": {
     "psr-4": {
@@ -181,11 +182,13 @@
     "pre-update-cmd": ["Varbase\\composer\\ScriptHandler::checkComposerVersion"],
     "post-install-cmd": [
       "Varbase\\composer\\ScriptHandler::createRequiredFiles",
+      "Varbase\\composer\\ScriptHandler::removeGitDirectories",
       "@composer drupal-scaffold",
       "./bin/phing push"
     ],
     "post-update-cmd": [
       "Varbase\\composer\\ScriptHandler::createRequiredFiles",
+      "Varbase\\composer\\ScriptHandler::removeGitDirectories",
       "./bin/phing push"
     ],
     "post-drupal-scaffold-cmd": ["Varbase\\composer\\ScriptHandler::postDrupalScaffoldProcedure"],
diff --git a/src/composer/ScriptHandler.php b/src/composer/ScriptHandler.php
index c04e68f36f92a1527302f25c080d70e444301742..1d2974f67a104da0b23db095870f00994c335ab0 100644
--- a/src/composer/ScriptHandler.php
+++ b/src/composer/ScriptHandler.php
@@ -101,6 +101,14 @@ class ScriptHandler {
       exit(1);
     }
   }
+  
+  /**
+   * Remove .git folder from modules, themes, profiles of development branches.
+   */
+  public static function removeGitDirectories() {
+    $drupal_root = static::getDrupalRoot(getcwd());
+    exec('find ' . $drupal_root . ' -name \'.git\' | xargs rm -rf');
+  }
 
   /**
    * Post Drupal Scaffold Procedure.