From 52cddfde8be2868aa813f7f0a0a9b625e42421fd Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sat, 4 Jul 2020 18:15:29 +0200
Subject: [PATCH] refactor: remove branch functions from platform (#6676)

---
 lib/manager/npm/post-update/index.ts          |   5 +-
 lib/platform/__snapshots__/index.spec.ts.snap |  28 --
 lib/platform/azure/index.ts                   |  44 ---
 .../__snapshots__/index.spec.ts.snap          | 310 ------------------
 lib/platform/bitbucket-server/index.spec.ts   |  42 ---
 lib/platform/bitbucket-server/index.ts        |  47 +--
 .../__snapshots__/index.spec.ts.snap          |  90 -----
 lib/platform/bitbucket/index.spec.ts          |  40 ---
 lib/platform/bitbucket/index.ts               |  39 +--
 lib/platform/common.ts                        |   7 -
 lib/platform/gitea/index.spec.ts              |  71 ----
 lib/platform/gitea/index.ts                   |  37 +--
 lib/platform/github/index.ts                  |  45 ---
 .../gitlab/__snapshots__/index.spec.ts.snap   | 110 -------
 lib/platform/gitlab/index.spec.ts             |  35 +-
 lib/platform/gitlab/index.ts                  |  37 +--
 lib/workers/branch/automerge.spec.ts          |   6 +-
 lib/workers/branch/automerge.ts               |   3 +-
 lib/workers/branch/index.spec.ts              |  62 ++--
 lib/workers/branch/index.ts                   |   4 +-
 lib/workers/branch/lock-files/index.spec.ts   |   4 +-
 lib/workers/branch/reuse.spec.ts              |  35 +-
 lib/workers/branch/reuse.ts                   |   7 +-
 lib/workers/pr/index.spec.ts                  |  15 +-
 lib/workers/pr/index.ts                       |   5 +-
 lib/workers/repository/finalise/prune.spec.ts |  37 ++-
 lib/workers/repository/finalise/prune.ts      |   5 +-
 lib/workers/repository/init/base.spec.ts      |  11 +-
 lib/workers/repository/init/base.ts           |   3 +-
 lib/workers/repository/init/index.spec.ts     |   1 +
 lib/workers/repository/init/index.ts          |   3 +-
 lib/workers/repository/init/semantic.spec.ts  |  11 +-
 lib/workers/repository/init/semantic.ts       |   4 +-
 lib/workers/repository/process/limits.spec.ts |  11 +-
 lib/workers/repository/process/limits.ts      |   3 +-
 35 files changed, 137 insertions(+), 1080 deletions(-)

diff --git a/lib/manager/npm/post-update/index.ts b/lib/manager/npm/post-update/index.ts
index 072f947eb1..093fad3a52 100644
--- a/lib/manager/npm/post-update/index.ts
+++ b/lib/manager/npm/post-update/index.ts
@@ -12,11 +12,10 @@ import upath from 'upath';
 import { SYSTEM_INSUFFICIENT_DISK_SPACE } from '../../../constants/error-messages';
 import { id as npmId } from '../../../datasource/npm';
 import { logger } from '../../../logger';
-import { platform } from '../../../platform';
 import { ExternalHostError } from '../../../types/errors/external-host-error';
 import { getChildProcessEnv } from '../../../util/exec/env';
 import { deleteLocalFile } from '../../../util/fs';
-import { getFile, getRepoStatus } from '../../../util/git';
+import { branchExists, getFile, getRepoStatus } from '../../../util/git';
 import * as hostRules from '../../../util/host-rules';
 import { PackageFile, PostUpdateConfig, Upgrade } from '../../common';
 import * as lerna from './lerna';
@@ -347,7 +346,7 @@ export async function getAdditionalFiles(
   if (
     config.updateType === 'lockFileMaintenance' &&
     config.reuseExistingBranch &&
-    (await platform.branchExists(config.branchName))
+    (await branchExists(config.branchName))
   ) {
     logger.debug('Skipping lockFileMaintenance update');
     return { artifactErrors, updatedArtifacts };
diff --git a/lib/platform/__snapshots__/index.spec.ts.snap b/lib/platform/__snapshots__/index.spec.ts.snap
index f2e74e054f..efde7b4bfc 100644
--- a/lib/platform/__snapshots__/index.spec.ts.snap
+++ b/lib/platform/__snapshots__/index.spec.ts.snap
@@ -6,7 +6,6 @@ exports[`platform has a list of supported methods for azure 1`] = `
 Array [
   "addAssignees",
   "addReviewers",
-  "branchExists",
   "commitFiles",
   "createPr",
   "deleteBranch",
@@ -17,12 +16,9 @@ Array [
   "ensureIssueClosing",
   "findIssue",
   "findPr",
-  "getAllRenovateBranches",
-  "getBranchLastCommitTime",
   "getBranchPr",
   "getBranchStatus",
   "getBranchStatusCheck",
-  "getCommitMessages",
   "getIssueList",
   "getPr",
   "getPrBody",
@@ -33,11 +29,8 @@ Array [
   "getVulnerabilityAlerts",
   "initPlatform",
   "initRepo",
-  "isBranchStale",
-  "mergeBranch",
   "mergePr",
   "setBaseBranch",
-  "setBranchPrefix",
   "setBranchStatus",
   "updatePr",
 ]
@@ -47,7 +40,6 @@ exports[`platform has a list of supported methods for gitea 1`] = `
 Array [
   "addAssignees",
   "addReviewers",
-  "branchExists",
   "commitFiles",
   "createPr",
   "deleteBranch",
@@ -58,12 +50,9 @@ Array [
   "ensureIssueClosing",
   "findIssue",
   "findPr",
-  "getAllRenovateBranches",
-  "getBranchLastCommitTime",
   "getBranchPr",
   "getBranchStatus",
   "getBranchStatusCheck",
-  "getCommitMessages",
   "getIssueList",
   "getPr",
   "getPrBody",
@@ -74,11 +63,8 @@ Array [
   "getVulnerabilityAlerts",
   "initPlatform",
   "initRepo",
-  "isBranchStale",
-  "mergeBranch",
   "mergePr",
   "setBaseBranch",
-  "setBranchPrefix",
   "setBranchStatus",
   "updatePr",
 ]
@@ -88,7 +74,6 @@ exports[`platform has a list of supported methods for github 1`] = `
 Array [
   "addAssignees",
   "addReviewers",
-  "branchExists",
   "commitFiles",
   "createPr",
   "deleteBranch",
@@ -99,12 +84,9 @@ Array [
   "ensureIssueClosing",
   "findIssue",
   "findPr",
-  "getAllRenovateBranches",
-  "getBranchLastCommitTime",
   "getBranchPr",
   "getBranchStatus",
   "getBranchStatusCheck",
-  "getCommitMessages",
   "getIssueList",
   "getPr",
   "getPrBody",
@@ -115,11 +97,8 @@ Array [
   "getVulnerabilityAlerts",
   "initPlatform",
   "initRepo",
-  "isBranchStale",
-  "mergeBranch",
   "mergePr",
   "setBaseBranch",
-  "setBranchPrefix",
   "setBranchStatus",
   "updatePr",
 ]
@@ -129,7 +108,6 @@ exports[`platform has a list of supported methods for gitlab 1`] = `
 Array [
   "addAssignees",
   "addReviewers",
-  "branchExists",
   "commitFiles",
   "createPr",
   "deleteBranch",
@@ -140,12 +118,9 @@ Array [
   "ensureIssueClosing",
   "findIssue",
   "findPr",
-  "getAllRenovateBranches",
-  "getBranchLastCommitTime",
   "getBranchPr",
   "getBranchStatus",
   "getBranchStatusCheck",
-  "getCommitMessages",
   "getIssueList",
   "getPr",
   "getPrBody",
@@ -156,11 +131,8 @@ Array [
   "getVulnerabilityAlerts",
   "initPlatform",
   "initRepo",
-  "isBranchStale",
-  "mergeBranch",
   "mergePr",
   "setBaseBranch",
-  "setBranchPrefix",
   "setBranchStatus",
   "updatePr",
 ]
diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts
index cb1c853036..51f169b63c 100644
--- a/lib/platform/azure/index.ts
+++ b/lib/platform/azure/index.ts
@@ -194,32 +194,6 @@ export /* istanbul ignore next */ async function setBaseBranch(
   return baseBranchSha;
 }
 
-export /* istanbul ignore next */ function setBranchPrefix(
-  branchPrefix: string
-): Promise<void> {
-  return git.setBranchPrefix(branchPrefix);
-}
-
-// Branch
-
-export /* istanbul ignore next */ function branchExists(
-  branchName: string
-): Promise<boolean> {
-  return git.branchExists(branchName);
-}
-
-export /* istanbul ignore next */ function getAllRenovateBranches(
-  branchPrefix: string
-): Promise<string[]> {
-  return git.getAllRenovateBranches(branchPrefix);
-}
-
-export /* istanbul ignore next */ function isBranchStale(
-  branchName: string
-): Promise<boolean> {
-  return git.isBranchStale(branchName);
-}
-
 // istanbul ignore next
 async function abandonPr(prNo: number): Promise<void> {
   logger.debug(`abandonPr(prNo)(${prNo})`);
@@ -357,18 +331,6 @@ export /* istanbul ignore next */ async function deleteBranch(
   }
 }
 
-export /* istanbul ignore next */ function getBranchLastCommitTime(
-  branchName: string
-): Promise<Date> {
-  return git.getBranchLastCommitTime(branchName);
-}
-
-export /* istanbul ignore next */ function mergeBranch(
-  branchName: string
-): Promise<void> {
-  return git.mergeBranch(branchName);
-}
-
 export /* istanbul ignore next */ function commitFiles({
   branchName,
   files,
@@ -381,12 +343,6 @@ export /* istanbul ignore next */ function commitFiles({
   });
 }
 
-export /* istanbul ignore next */ function getCommitMessages(): Promise<
-  string[]
-> {
-  return git.getCommitMessages();
-}
-
 export async function getBranchStatusCheck(
   branchName: string,
   context: string
diff --git a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap
index 3da1444b7a..b41cdd8523 100644
--- a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap
+++ b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap
@@ -1496,68 +1496,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket-server endpoint with no path getAllRenovateBranches() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket-server endpoint with no path getAllRenovateBranches() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
-exports[`platform/bitbucket-server endpoint with no path getBranchLastCommitTime() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket-server endpoint with no path getBranchLastCommitTime() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
 exports[`platform/bitbucket-server endpoint with no path getBranchPr() has no pr 1`] = `
 Array [
   Object {
@@ -2050,37 +1988,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket-server endpoint with no path getCommitMessages() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket-server endpoint with no path getCommitMessages() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
 exports[`platform/bitbucket-server endpoint with no path getPr() canRebase 1`] = `
 Object {
   "body": "* Line 1
@@ -2629,68 +2536,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket-server endpoint with no path isBranchStale() sends to gitFs 1`] = `false`;
-
-exports[`platform/bitbucket-server endpoint with no path isBranchStale() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
-exports[`platform/bitbucket-server endpoint with no path mergeBranch() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket-server endpoint with no path mergeBranch() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
 exports[`platform/bitbucket-server endpoint with no path mergePr() posts Merge 1`] = `
 Array [
   Object {
@@ -5554,68 +5399,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket-server endpoint with path getAllRenovateBranches() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket-server endpoint with path getAllRenovateBranches() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
-exports[`platform/bitbucket-server endpoint with path getBranchLastCommitTime() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket-server endpoint with path getBranchLastCommitTime() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
 exports[`platform/bitbucket-server endpoint with path getBranchPr() has no pr 1`] = `
 Array [
   Object {
@@ -6108,37 +5891,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket-server endpoint with path getCommitMessages() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket-server endpoint with path getCommitMessages() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
 exports[`platform/bitbucket-server endpoint with path getPr() canRebase 1`] = `
 Object {
   "body": "* Line 1
@@ -6687,68 +6439,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket-server endpoint with path isBranchStale() sends to gitFs 1`] = `false`;
-
-exports[`platform/bitbucket-server endpoint with path isBranchStale() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
-exports[`platform/bitbucket-server endpoint with path mergeBranch() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket-server endpoint with path mergeBranch() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
 exports[`platform/bitbucket-server endpoint with path mergePr() posts Merge 1`] = `
 Array [
   Object {
diff --git a/lib/platform/bitbucket-server/index.spec.ts b/lib/platform/bitbucket-server/index.spec.ts
index f6fb4eb626..82221e3743 100644
--- a/lib/platform/bitbucket-server/index.spec.ts
+++ b/lib/platform/bitbucket-server/index.spec.ts
@@ -400,16 +400,6 @@ describe('platform/bitbucket-server', () => {
         });
       });
 
-      describe('isBranchStale()', () => {
-        it('sends to gitFs', async () => {
-          await initRepo();
-          expect(
-            await bitbucket.isBranchStale(undefined as any)
-          ).toMatchSnapshot();
-          expect(httpMock.getTrace()).toMatchSnapshot();
-        });
-      });
-
       describe('deleteBranch()', () => {
         it('sends to gitFs', async () => {
           await initRepo();
@@ -418,14 +408,6 @@ describe('platform/bitbucket-server', () => {
         });
       });
 
-      describe('mergeBranch()', () => {
-        it('sends to gitFs', async () => {
-          await initRepo();
-          expect(await bitbucket.mergeBranch('branch')).toMatchSnapshot();
-          expect(httpMock.getTrace()).toMatchSnapshot();
-        });
-      });
-
       describe('commitFiles()', () => {
         it('sends to gitFs', async () => {
           expect.assertions(1);
@@ -447,22 +429,6 @@ describe('platform/bitbucket-server', () => {
         });
       });
 
-      describe('getAllRenovateBranches()', () => {
-        it('sends to gitFs', async () => {
-          await initRepo();
-          expect(await bitbucket.getAllRenovateBranches('')).toMatchSnapshot();
-          expect(httpMock.getTrace()).toMatchSnapshot();
-        });
-      });
-
-      describe('getBranchLastCommitTime()', () => {
-        it('sends to gitFs', async () => {
-          await initRepo();
-          expect(await bitbucket.getBranchLastCommitTime('')).toMatchSnapshot();
-          expect(httpMock.getTrace()).toMatchSnapshot();
-        });
-      });
-
       describe('addAssignees()', () => {
         it('does not throw', async () => {
           expect(await bitbucket.addAssignees(3, ['some'])).toMatchSnapshot();
@@ -1654,14 +1620,6 @@ Followed by some information.
         });
       });
 
-      describe('getCommitMessages()', () => {
-        it('sends to gitFs', async () => {
-          await initRepo();
-          expect(await bitbucket.getCommitMessages()).toMatchSnapshot();
-          expect(httpMock.getTrace()).toMatchSnapshot();
-        });
-      });
-
       describe('getVulnerabilityAlerts()', () => {
         it('returns empty array', async () => {
           expect.assertions(1);
diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts
index fa901ac28d..9fe43c99e2 100644
--- a/lib/platform/bitbucket-server/index.ts
+++ b/lib/platform/bitbucket-server/index.ts
@@ -247,25 +247,6 @@ export async function setBaseBranch(
   return baseBranchSha;
 }
 
-export /* istanbul ignore next */ function setBranchPrefix(
-  branchPrefix: string
-): Promise<void> {
-  return git.setBranchPrefix(branchPrefix);
-}
-
-// Branch
-
-// Returns true if branch exists, otherwise false
-export function branchExists(branchName: string): Promise<boolean> {
-  logger.debug(`branchExists(${branchName})`);
-  return git.branchExists(branchName);
-}
-
-export function isBranchStale(branchName: string): Promise<boolean> {
-  logger.debug(`isBranchStale(${branchName})`);
-  return git.isBranchStale(branchName);
-}
-
 // Gets details for a PR
 export async function getPr(
   prNo: number,
@@ -331,8 +312,8 @@ export async function getPr(
     }
   }
 
-  if (await branchExists(pr.branchName)) {
-    pr.isStale = await isBranchStale(pr.branchName);
+  if (await git.branchExists(pr.branchName)) {
+    pr.isStale = await git.isBranchStale(pr.branchName);
   }
 
   return pr;
@@ -421,13 +402,6 @@ export async function getBranchPr(
   return existingPr ? getPr(existingPr.number, refreshCache) : null;
 }
 
-export function getAllRenovateBranches(
-  branchPrefix: string
-): Promise<string[]> {
-  logger.debug('getAllRenovateBranches');
-  return git.getAllRenovateBranches(branchPrefix);
-}
-
 export async function commitFiles(
   commitFilesConfig: CommitFilesConfig
 ): Promise<string | null> {
@@ -461,16 +435,6 @@ export async function deleteBranch(
   return git.deleteBranch(branchName);
 }
 
-export function mergeBranch(branchName: string): Promise<void> {
-  logger.debug(`mergeBranch(${branchName})`);
-  return git.mergeBranch(branchName);
-}
-
-export function getBranchLastCommitTime(branchName: string): Promise<Date> {
-  logger.debug(`getBranchLastCommitTime(${branchName})`);
-  return git.getBranchLastCommitTime(branchName);
-}
-
 async function getStatus(
   branchName: string,
   useCache = true
@@ -504,7 +468,7 @@ export async function getBranchStatus(
     return BranchStatus.green;
   }
 
-  if (!(await branchExists(branchName))) {
+  if (!(await git.branchExists(branchName))) {
     throw new Error(REPOSITORY_CHANGED);
   }
 
@@ -1050,11 +1014,6 @@ export function getPrBody(input: string): string {
     .replace(new RegExp('<!--.*?-->', 'g'), '');
 }
 
-export function getCommitMessages(): Promise<string[]> {
-  logger.debug(`getCommitMessages()`);
-  return git.getCommitMessages();
-}
-
 export function getVulnerabilityAlerts(): Promise<VulnerabilityAlert[]> {
   logger.debug(`getVulnerabilityAlerts()`);
   return Promise.resolve([]);
diff --git a/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap b/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap
index 5bb9d7dac1..dfd3a2f8d6 100644
--- a/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap
+++ b/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap
@@ -518,42 +518,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket getAllRenovateBranches() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket getAllRenovateBranches() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "api.bitbucket.org",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://api.bitbucket.org/2.0/repositories/some/repo",
-  },
-]
-`;
-
-exports[`platform/bitbucket getBranchLastCommitTime() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket getBranchLastCommitTime() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "api.bitbucket.org",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://api.bitbucket.org/2.0/repositories/some/repo",
-  },
-]
-`;
-
 exports[`platform/bitbucket getBranchPr() bitbucket finds PR for branch 1`] = `
 Object {
   "body": "summary",
@@ -955,24 +919,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket getCommitMessages() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket getCommitMessages() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "api.bitbucket.org",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://api.bitbucket.org/2.0/repositories/some/repo",
-  },
-]
-`;
-
 exports[`platform/bitbucket getPr() canRebase 1`] = `
 Object {
   "body": "summary",
@@ -1275,42 +1221,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket isBranchStale() sends to gitFs 1`] = `false`;
-
-exports[`platform/bitbucket isBranchStale() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "api.bitbucket.org",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://api.bitbucket.org/2.0/repositories/some/repo",
-  },
-]
-`;
-
-exports[`platform/bitbucket mergeBranch() sends to gitFs 1`] = `undefined`;
-
-exports[`platform/bitbucket mergeBranch() sends to gitFs 2`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "api.bitbucket.org",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://api.bitbucket.org/2.0/repositories/some/repo",
-  },
-]
-`;
-
 exports[`platform/bitbucket mergePr() posts Merge 1`] = `
 Array [
   Object {
diff --git a/lib/platform/bitbucket/index.spec.ts b/lib/platform/bitbucket/index.spec.ts
index 826b11d4e1..e748bea7de 100644
--- a/lib/platform/bitbucket/index.spec.ts
+++ b/lib/platform/bitbucket/index.spec.ts
@@ -194,14 +194,6 @@ describe('platform/bitbucket', () => {
     });
   });
 
-  describe('isBranchStale()', () => {
-    it('sends to gitFs', async () => {
-      await initRepoMock();
-      expect(await bitbucket.isBranchStale('test')).toMatchSnapshot();
-      expect(httpMock.getTrace()).toMatchSnapshot();
-    });
-  });
-
   describe('getBranchPr()', () => {
     it('bitbucket finds PR for branch', async () => {
       const scope = await initRepoMock();
@@ -457,22 +449,6 @@ describe('platform/bitbucket', () => {
     });
   });
 
-  describe('mergeBranch()', () => {
-    it('sends to gitFs', async () => {
-      await initRepoMock();
-      expect(await bitbucket.mergeBranch('test')).toMatchSnapshot();
-      expect(httpMock.getTrace()).toMatchSnapshot();
-    });
-  });
-
-  describe('getBranchLastCommitTime()', () => {
-    it('sends to gitFs', async () => {
-      await initRepoMock();
-      expect(await bitbucket.getBranchLastCommitTime('test')).toMatchSnapshot();
-      expect(httpMock.getTrace()).toMatchSnapshot();
-    });
-  });
-
   describe('findIssue()', () => {
     it('does not throw', async () => {
       const scope = await initRepoMock({}, { has_issues: true });
@@ -826,22 +802,6 @@ describe('platform/bitbucket', () => {
     });
   });
 
-  describe('getCommitMessages()', () => {
-    it('sends to gitFs', async () => {
-      await initRepoMock();
-      expect(await bitbucket.getCommitMessages()).toMatchSnapshot();
-      expect(httpMock.getTrace()).toMatchSnapshot();
-    });
-  });
-
-  describe('getAllRenovateBranches()', () => {
-    it('sends to gitFs', async () => {
-      await initRepoMock();
-      expect(await bitbucket.getAllRenovateBranches('test')).toMatchSnapshot();
-      expect(httpMock.getTrace()).toMatchSnapshot();
-    });
-  });
-
   describe('getVulnerabilityAlerts()', () => {
     it('returns empty array', async () => {
       expect(await bitbucket.getVulnerabilityAlerts()).toEqual([]);
diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts
index 0348c5a057..f3e217b521 100644
--- a/lib/platform/bitbucket/index.ts
+++ b/lib/platform/bitbucket/index.ts
@@ -187,29 +187,6 @@ export async function setBaseBranch(
   return baseBranchSha;
 }
 
-export /* istanbul ignore next */ function setBranchPrefix(
-  branchPrefix: string
-): Promise<void> {
-  return git.setBranchPrefix(branchPrefix);
-}
-
-// Branch
-
-// Returns true if branch exists, otherwise false
-export function branchExists(branchName: string): Promise<boolean> {
-  return git.branchExists(branchName);
-}
-
-export function getAllRenovateBranches(
-  branchPrefix: string
-): Promise<string[]> {
-  return git.getAllRenovateBranches(branchPrefix);
-}
-
-export function isBranchStale(branchName: string): Promise<boolean> {
-  return git.isBranchStale(branchName);
-}
-
 // istanbul ignore next
 function matchesState(state: string, desiredState: string): boolean {
   if (desiredState === PR_STATE_ALL) {
@@ -273,14 +250,6 @@ export async function deleteBranch(
   return git.deleteBranch(branchName);
 }
 
-export function getBranchLastCommitTime(branchName: string): Promise<Date> {
-  return git.getBranchLastCommitTime(branchName);
-}
-
-export function mergeBranch(branchName: string): Promise<void> {
-  return git.mergeBranch(branchName);
-}
-
 // istanbul ignore next
 export function commitFiles(
   commitFilesConfig: CommitFilesConfig
@@ -288,10 +257,6 @@ export function commitFiles(
   return git.commitFiles(commitFilesConfig);
 }
 
-export function getCommitMessages(): Promise<string[]> {
-  return git.getCommitMessages();
-}
-
 async function isPrConflicted(prNo: number): Promise<boolean> {
   const diff = (
     await bitbucketHttp.get(
@@ -371,8 +336,8 @@ export async function getPr(prNo: number): Promise<Pr | null> {
       res.isModified = true;
     }
   }
-  if (await branchExists(pr.source.branch.name)) {
-    res.isStale = await isBranchStale(pr.source.branch.name);
+  if (await git.branchExists(pr.source.branch.name)) {
+    res.isStale = await git.isBranchStale(pr.source.branch.name);
   }
 
   return res;
diff --git a/lib/platform/common.ts b/lib/platform/common.ts
index 32e9df9841..143212a95b 100644
--- a/lib/platform/common.ts
+++ b/lib/platform/common.ts
@@ -186,12 +186,9 @@ export interface Platform {
   findIssue(title: string): Promise<Issue | null>;
   getIssueList(): Promise<Issue[]>;
   getVulnerabilityAlerts(): Promise<VulnerabilityAlert[]>;
-  getCommitMessages(): Promise<string[]>;
-  setBranchPrefix(branchPrefix: string): Promise<void>;
   initRepo(config: RepoParams): Promise<RepoConfig>;
   getPrList(): Promise<Pr[]>;
   getPrFiles(pr: Pr): Promise<string[]>;
-  getAllRenovateBranches(branchPrefix: string): Promise<string[]>;
   ensureIssueClosing(title: string): Promise<void>;
   ensureIssue(
     issueConfig: EnsureIssueConfig
@@ -202,9 +199,7 @@ export interface Platform {
   addReviewers(number: number, reviewers: string[]): Promise<void>;
   addAssignees(number: number, assignees: string[]): Promise<void>;
   createPr(prConfig: CreatePRConfig): Promise<Pr>;
-  getBranchLastCommitTime(branchName: string): Promise<Date>;
   getRepos(): Promise<string[]>;
-  isBranchStale(branchName: string): Promise<boolean>;
   getRepoForceRebase(): Promise<boolean>;
   deleteLabel(number: number, label: string): Promise<void>;
   setBranchStatus(branchStatusConfig: BranchStatusConfig): Promise<void>;
@@ -219,12 +214,10 @@ export interface Platform {
   ): Promise<void>;
   deleteBranch(branchName: string, closePr?: boolean): Promise<void>;
   ensureComment(ensureComment: EnsureCommentConfig): Promise<boolean>;
-  branchExists(branchName: string): Promise<boolean>;
   setBaseBranch(baseBranch?: string): Promise<string>;
   commitFiles(commitFile: CommitFilesConfig): Promise<string | null>;
   getPr(number: number): Promise<Pr>;
   findPr(findPRConfig: FindPRConfig): Promise<Pr>;
-  mergeBranch(branchName: string): Promise<void>;
   getBranchStatus(
     branchName: string,
     requiredStatusChecks?: string[] | null
diff --git a/lib/platform/gitea/index.spec.ts b/lib/platform/gitea/index.spec.ts
index 0df4a21569..eb213e200a 100644
--- a/lib/platform/gitea/index.spec.ts
+++ b/lib/platform/gitea/index.spec.ts
@@ -1362,77 +1362,6 @@ describe('platform/gitea', () => {
     });
   });
 
-  describe('isBranchStale', () => {
-    it('propagates call to storage class', async () => {
-      await initFakeRepo();
-      await gitea.isBranchStale('some-branch');
-
-      expect(gitvcs.isBranchStale).toHaveBeenCalledTimes(1);
-      expect(gitvcs.isBranchStale).toHaveBeenCalledWith('some-branch');
-    });
-  });
-
-  describe('setBranchPrefix', () => {
-    it('should propagate call to storage class', async () => {
-      await initFakeRepo();
-      await gitea.setBranchPrefix('some-branch');
-
-      expect(gitvcs.setBranchPrefix).toHaveBeenCalledTimes(1);
-      expect(gitvcs.setBranchPrefix).toHaveBeenCalledWith('some-branch');
-    });
-  });
-
-  describe('branchExists', () => {
-    it('should propagate call to storage class', async () => {
-      await initFakeRepo();
-      await gitea.branchExists('some-branch');
-
-      expect(gitvcs.branchExists).toHaveBeenCalledTimes(1);
-      expect(gitvcs.branchExists).toHaveBeenCalledWith('some-branch');
-    });
-  });
-
-  describe('mergeBranch', () => {
-    it('should propagate call to storage class', async () => {
-      await initFakeRepo();
-      await gitea.mergeBranch('some-branch');
-
-      expect(gitvcs.mergeBranch).toHaveBeenCalledTimes(1);
-      expect(gitvcs.mergeBranch).toHaveBeenCalledWith('some-branch');
-    });
-  });
-
-  describe('getBranchLastCommitTime', () => {
-    it('should propagate call to storage class', async () => {
-      await initFakeRepo();
-      await gitea.getBranchLastCommitTime('some-branch');
-
-      expect(gitvcs.getBranchLastCommitTime).toHaveBeenCalledTimes(1);
-      expect(gitvcs.getBranchLastCommitTime).toHaveBeenCalledWith(
-        'some-branch'
-      );
-    });
-  });
-
-  describe('getAllRenovateBranches', () => {
-    it('should propagate call to storage class', async () => {
-      await initFakeRepo();
-      await gitea.getAllRenovateBranches('some-prefix');
-
-      expect(gitvcs.getAllRenovateBranches).toHaveBeenCalledTimes(1);
-      expect(gitvcs.getAllRenovateBranches).toHaveBeenCalledWith('some-prefix');
-    });
-  });
-
-  describe('getCommitMessages', () => {
-    it('should propagate call to storage class', async () => {
-      await initFakeRepo();
-      await gitea.getCommitMessages();
-
-      expect(gitvcs.getCommitMessages).toHaveBeenCalledTimes(1);
-    });
-  });
-
   describe('getVulnerabilityAlerts', () => {
     it('should return an empty list - unsupported by platform', async () => {
       expect(await gitea.getVulnerabilityAlerts()).toEqual([]);
diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts
index f28be8edaf..5519512ac4 100644
--- a/lib/platform/gitea/index.ts
+++ b/lib/platform/gitea/index.ts
@@ -498,7 +498,7 @@ const platform: Platform = {
     // Enrich pull request with additional information which is more expensive to fetch
     if (pr.state !== 'closed') {
       if (pr.isStale === undefined) {
-        pr.isStale = await platform.isBranchStale(pr.branchName);
+        pr.isStale = await git.isBranchStale(pr.branchName);
       }
       if (pr.isModified === undefined) {
         pr.isModified = await isPRModified(config.repository, pr.branchName);
@@ -858,34 +858,6 @@ const platform: Platform = {
     return smartTruncate(prBody, 1000000);
   },
 
-  isBranchStale(branchName: string): Promise<boolean> {
-    return git.isBranchStale(branchName);
-  },
-
-  setBranchPrefix(branchPrefix: string): Promise<void> {
-    return git.setBranchPrefix(branchPrefix);
-  },
-
-  branchExists(branchName: string): Promise<boolean> {
-    return git.branchExists(branchName);
-  },
-
-  mergeBranch(branchName: string): Promise<void> {
-    return git.mergeBranch(branchName);
-  },
-
-  getBranchLastCommitTime(branchName: string): Promise<Date> {
-    return git.getBranchLastCommitTime(branchName);
-  },
-
-  getAllRenovateBranches(branchPrefix: string): Promise<string[]> {
-    return git.getAllRenovateBranches(branchPrefix);
-  },
-
-  getCommitMessages(): Promise<string[]> {
-    return git.getCommitMessages();
-  },
-
   getVulnerabilityAlerts(): Promise<VulnerabilityAlert[]> {
     return Promise.resolve([]);
   },
@@ -894,7 +866,6 @@ const platform: Platform = {
 export const {
   addAssignees,
   addReviewers,
-  branchExists,
   commitFiles,
   createPr,
   deleteBranch,
@@ -905,12 +876,9 @@ export const {
   ensureIssueClosing,
   findIssue,
   findPr,
-  getAllRenovateBranches,
-  getBranchLastCommitTime,
   getBranchPr,
   getBranchStatus,
   getBranchStatusCheck,
-  getCommitMessages,
   getIssueList,
   getPr,
   getPrBody,
@@ -921,11 +889,8 @@ export const {
   getVulnerabilityAlerts,
   initPlatform,
   initRepo,
-  isBranchStale,
-  mergeBranch,
   mergePr,
   setBaseBranch,
-  setBranchPrefix,
   setBranchStatus,
   updatePr,
 } = platform;
diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts
index 144cbcedad..f5deb861e6 100644
--- a/lib/platform/github/index.ts
+++ b/lib/platform/github/index.ts
@@ -488,32 +488,8 @@ export async function setBaseBranch(
   return baseBranchSha;
 }
 
-// istanbul ignore next
-export function setBranchPrefix(branchPrefix: string): Promise<void> {
-  return git.setBranchPrefix(branchPrefix);
-}
-
-// Search
-
 // Branch
 
-// istanbul ignore next
-export function branchExists(branchName: string): Promise<boolean> {
-  return git.branchExists(branchName);
-}
-
-// istanbul ignore next
-export function getAllRenovateBranches(
-  branchPrefix: string
-): Promise<string[]> {
-  return git.getAllRenovateBranches(branchPrefix);
-}
-
-// istanbul ignore next
-export function isBranchStale(branchName: string): Promise<boolean> {
-  return git.isBranchStale(branchName);
-}
-
 // istanbul ignore next
 export function deleteBranch(
   branchName: string,
@@ -522,22 +498,6 @@ export function deleteBranch(
   return git.deleteBranch(branchName);
 }
 
-// istanbul ignore next
-export function getBranchLastCommitTime(branchName: string): Promise<Date> {
-  return git.getBranchLastCommitTime(branchName);
-}
-
-// istanbul ignore next
-export function mergeBranch(branchName: string): Promise<void> {
-  if (config.pushProtection) {
-    logger.debug(
-      { branch: branchName },
-      'Branch protection: Attempting to merge branch when push protection is enabled'
-    );
-  }
-  return git.mergeBranch(branchName);
-}
-
 // istanbul ignore next
 export function commitFiles(
   commitFilesConfig: CommitFilesConfig
@@ -545,11 +505,6 @@ export function commitFiles(
   return git.commitFiles(commitFilesConfig);
 }
 
-// istanbul ignore next
-export function getCommitMessages(): Promise<string[]> {
-  return git.getCommitMessages();
-}
-
 async function getClosedPrs(): Promise<PrList> {
   if (!config.closedPrList) {
     config.closedPrList = {};
diff --git a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap
index 49186e996c..e265a6c591 100644
--- a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap
+++ b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap
@@ -909,60 +909,6 @@ Array [
 ]
 `;
 
-exports[`platform/gitlab getAllRenovateBranches() sends to gitFs 1`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "host": "gitlab.com",
-      "private-token": "abc123",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://gitlab.com/api/v4/projects/some%2Frepo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "host": "gitlab.com",
-      "private-token": "abc123",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://gitlab.com/api/v4/user",
-  },
-]
-`;
-
-exports[`platform/gitlab getBranchLastCommitTime() sends to gitFs 1`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "host": "gitlab.com",
-      "private-token": "abc123",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://gitlab.com/api/v4/projects/some%2Frepo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "host": "gitlab.com",
-      "private-token": "abc123",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://gitlab.com/api/v4/user",
-  },
-]
-`;
-
 exports[`platform/gitlab getBranchPr(branchName) should return null if no PR exists 1`] = `
 Array [
   Object {
@@ -1463,8 +1409,6 @@ Array [
 ]
 `;
 
-exports[`platform/gitlab getCommitMessages() passes to git 1`] = `undefined`;
-
 exports[`platform/gitlab getPr(prNo) returns the PR 1`] = `
 Object {
   "body": "a merge request",
@@ -2004,60 +1948,6 @@ Array [
 ]
 `;
 
-exports[`platform/gitlab isBranchStale() sends to gitFs 1`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "host": "gitlab.com",
-      "private-token": "abc123",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://gitlab.com/api/v4/projects/some%2Frepo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "host": "gitlab.com",
-      "private-token": "abc123",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://gitlab.com/api/v4/user",
-  },
-]
-`;
-
-exports[`platform/gitlab mergeBranch() sends to gitFs 1`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "host": "gitlab.com",
-      "private-token": "abc123",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://gitlab.com/api/v4/projects/some%2Frepo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "host": "gitlab.com",
-      "private-token": "abc123",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://gitlab.com/api/v4/user",
-  },
-]
-`;
-
 exports[`platform/gitlab mergePr(pr) merges the PR 1`] = `
 Array [
   Object {
diff --git a/lib/platform/gitlab/index.spec.ts b/lib/platform/gitlab/index.spec.ts
index fa323cbbb1..4ebdce81a2 100644
--- a/lib/platform/gitlab/index.spec.ts
+++ b/lib/platform/gitlab/index.spec.ts
@@ -387,28 +387,7 @@ describe('platform/gitlab', () => {
       expect(httpMock.getTrace()).toMatchSnapshot();
     });
   });
-  describe('getAllRenovateBranches()', () => {
-    it('sends to gitFs', async () => {
-      await initRepo();
-      await gitlab.getAllRenovateBranches('');
-      expect(httpMock.getTrace()).toMatchSnapshot();
-    });
-  });
 
-  describe('getBranchLastCommitTime()', () => {
-    it('sends to gitFs', async () => {
-      await initRepo();
-      await gitlab.getBranchLastCommitTime('');
-      expect(httpMock.getTrace()).toMatchSnapshot();
-    });
-  });
-  describe('isBranchStale()', () => {
-    it('sends to gitFs', async () => {
-      await initRepo();
-      await gitlab.isBranchStale('');
-      expect(httpMock.getTrace()).toMatchSnapshot();
-    });
-  });
   describe('getBranchPr(branchName)', () => {
     it('should return null if no PR exists', async () => {
       const scope = await initRepo();
@@ -627,13 +606,7 @@ describe('platform/gitlab', () => {
       }
     );
   });
-  describe('mergeBranch()', () => {
-    it('sends to gitFs', async () => {
-      await initRepo();
-      await gitlab.mergeBranch('branch');
-      expect(httpMock.getTrace()).toMatchSnapshot();
-    });
-  });
+
   describe('deleteBranch()', () => {
     it('sends to gitFs', async () => {
       const scope = await initRepo();
@@ -1221,12 +1194,6 @@ These updates have all been created already. Click a checkbox below to force a r
       expect(httpMock.getTrace()).toMatchSnapshot();
     });
   });
-  describe('getCommitMessages()', () => {
-    it('passes to git', async () => {
-      await initRepo();
-      expect(await gitlab.getCommitMessages()).toMatchSnapshot();
-    });
-  });
   describe('getVulnerabilityAlerts()', () => {
     it('returns empty', async () => {
       const res = await gitlab.getVulnerabilityAlerts();
diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts
index f83527d874..ea8c26f280 100644
--- a/lib/platform/gitlab/index.ts
+++ b/lib/platform/gitlab/index.ts
@@ -280,17 +280,6 @@ export async function setBaseBranch(
   return baseBranchSha;
 }
 
-export /* istanbul ignore next */ function setBranchPrefix(
-  branchPrefix: string
-): Promise<void> {
-  return git.setBranchPrefix(branchPrefix);
-}
-
-// Returns true if branch exists, otherwise false
-export function branchExists(branchName: string): Promise<boolean> {
-  return git.branchExists(branchName);
-}
-
 type BranchState = 'pending' | 'running' | 'success' | 'failed' | 'canceled';
 
 interface GitlabBranchStatus {
@@ -341,7 +330,7 @@ export async function getBranchStatus(
     return BranchStatus.red;
   }
 
-  if (!(await branchExists(branchName))) {
+  if (!(await git.branchExists(branchName))) {
     throw new Error(REPOSITORY_CHANGED);
   }
 
@@ -582,7 +571,7 @@ export function getPrBody(input: string): string {
 export async function getBranchPr(branchName: string): Promise<Pr> {
   logger.debug(`getBranchPr(${branchName})`);
   // istanbul ignore if
-  if (!(await branchExists(branchName))) {
+  if (!(await git.branchExists(branchName))) {
     return null;
   }
   const query = new URLSearchParams({
@@ -607,16 +596,6 @@ export async function getBranchPr(branchName: string): Promise<Pr> {
   return getPr(pr.iid);
 }
 
-export function getAllRenovateBranches(
-  branchPrefix: string
-): Promise<string[]> {
-  return git.getAllRenovateBranches(branchPrefix);
-}
-
-export function isBranchStale(branchName: string): Promise<boolean> {
-  return git.isBranchStale(branchName);
-}
-
 // istanbul ignore next
 export function commitFiles(
   commitFilesConfig: CommitFilesConfig
@@ -639,14 +618,6 @@ export async function deleteBranch(
   return git.deleteBranch(branchName);
 }
 
-export function mergeBranch(branchName: string): Promise<void> {
-  return git.mergeBranch(branchName);
-}
-
-export function getBranchLastCommitTime(branchName: string): Promise<Date> {
-  return git.getBranchLastCommitTime(branchName);
-}
-
 export async function getBranchStatusCheck(
   branchName: string,
   context: string
@@ -1082,10 +1053,6 @@ export async function findPr({
   );
 }
 
-export function getCommitMessages(): Promise<string[]> {
-  return git.getCommitMessages();
-}
-
 export function getVulnerabilityAlerts(): Promise<VulnerabilityAlert[]> {
   return Promise.resolve([]);
 }
diff --git a/lib/workers/branch/automerge.spec.ts b/lib/workers/branch/automerge.spec.ts
index 1e81297993..4d0b7c5c18 100644
--- a/lib/workers/branch/automerge.spec.ts
+++ b/lib/workers/branch/automerge.spec.ts
@@ -1,8 +1,10 @@
-import { defaultConfig, platform } from '../../../test/util';
+import { defaultConfig, git, platform } from '../../../test/util';
 import { RenovateConfig } from '../../config';
 import { BranchStatus } from '../../types';
 import { tryBranchAutomerge } from './automerge';
 
+jest.mock('../../util/git');
+
 describe('workers/branch/automerge', () => {
   describe('tryBranchAutomerge', () => {
     let config: RenovateConfig;
@@ -45,7 +47,7 @@ describe('workers/branch/automerge', () => {
       config.automerge = true;
       config.automergeType = 'branch';
       platform.getBranchStatus.mockResolvedValueOnce(BranchStatus.green);
-      platform.mergeBranch.mockImplementationOnce(() => {
+      git.mergeBranch.mockImplementationOnce(() => {
         throw new Error('merge error');
       });
       expect(await tryBranchAutomerge(config)).toBe('failed');
diff --git a/lib/workers/branch/automerge.ts b/lib/workers/branch/automerge.ts
index 12a6ebee00..34d310011b 100644
--- a/lib/workers/branch/automerge.ts
+++ b/lib/workers/branch/automerge.ts
@@ -2,6 +2,7 @@ import { RenovateConfig } from '../../config';
 import { logger } from '../../logger';
 import { platform } from '../../platform';
 import { BranchStatus } from '../../types';
+import { mergeBranch } from '../../util/git';
 
 export type AutomergeResult =
   | 'automerged'
@@ -32,7 +33,7 @@ export async function tryBranchAutomerge(
       if (config.dryRun) {
         logger.info('DRY-RUN: Would automerge branch' + config.branchName);
       } else {
-        await platform.mergeBranch(config.branchName);
+        await mergeBranch(config.branchName);
       }
       logger.info({ branch: config.branchName }, 'Branch automerged');
       return 'automerged'; // Branch no longer exists
diff --git a/lib/workers/branch/index.spec.ts b/lib/workers/branch/index.spec.ts
index 8dc9ba82e2..d73c3aa658 100644
--- a/lib/workers/branch/index.spec.ts
+++ b/lib/workers/branch/index.spec.ts
@@ -84,7 +84,7 @@ describe('workers/branch', () => {
     it('skips branch if not scheduled and not updating out of schedule', async () => {
       schedule.isScheduledNow.mockReturnValueOnce(false);
       config.updateNotScheduled = false;
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       const res = await branchWorker.processBranch(config);
       expect(res).toEqual('not-scheduled');
     });
@@ -93,7 +93,7 @@ describe('workers/branch', () => {
       config.unpublishSafe = true;
       config.canBeUnpublished = true;
       config.prCreation = 'not-pending';
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       const res = await branchWorker.processBranch(config);
       expect(res).toEqual('pending');
     });
@@ -112,7 +112,7 @@ describe('workers/branch', () => {
     it('processes branch if not scheduled but updating out of schedule', async () => {
       schedule.isScheduledNow.mockReturnValueOnce(false);
       config.updateNotScheduled = true;
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         state: PR_STATE_OPEN,
         isModified: false,
@@ -122,7 +122,7 @@ describe('workers/branch', () => {
     });
     it('skips branch if closed major PR found', async () => {
       schedule.isScheduledNow.mockReturnValueOnce(false);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       config.updateType = 'major';
       checkExisting.prAlreadyExisted.mockResolvedValueOnce({
         number: 13,
@@ -133,7 +133,7 @@ describe('workers/branch', () => {
     });
     it('skips branch if closed digest PR found', async () => {
       schedule.isScheduledNow.mockReturnValueOnce(false);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       config.updateType = 'digest';
       checkExisting.prAlreadyExisted.mockResolvedValueOnce({
         number: 13,
@@ -144,7 +144,7 @@ describe('workers/branch', () => {
     });
     it('skips branch if closed minor PR found', async () => {
       schedule.isScheduledNow.mockReturnValueOnce(false);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       checkExisting.prAlreadyExisted.mockResolvedValueOnce({
         number: 13,
         state: PR_STATE_CLOSED,
@@ -154,7 +154,7 @@ describe('workers/branch', () => {
     });
     it('skips branch if merged PR found', async () => {
       schedule.isScheduledNow.mockReturnValueOnce(false);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       checkExisting.prAlreadyExisted.mockResolvedValueOnce({
         number: 13,
         state: PR_STATE_MERGED,
@@ -164,7 +164,7 @@ describe('workers/branch', () => {
     });
     it('throws error if closed PR found', async () => {
       schedule.isScheduledNow.mockReturnValueOnce(false);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         state: PR_STATE_MERGED,
         isModified: true,
@@ -175,7 +175,7 @@ describe('workers/branch', () => {
     });
     it('does not skip branch if edited PR found with rebaseLabel', async () => {
       schedule.isScheduledNow.mockReturnValueOnce(false);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         state: PR_STATE_OPEN,
         isModified: true,
@@ -186,7 +186,7 @@ describe('workers/branch', () => {
     });
     it('skips branch if edited PR found', async () => {
       schedule.isScheduledNow.mockReturnValueOnce(false);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         state: PR_STATE_OPEN,
         isModified: true,
@@ -196,7 +196,7 @@ describe('workers/branch', () => {
     });
     it('skips branch if target branch changed', async () => {
       schedule.isScheduledNow.mockReturnValueOnce(false);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         state: PR_STATE_OPEN,
         isModified: false,
@@ -214,7 +214,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [],
       });
-      platform.branchExists.mockResolvedValue(false);
+      git.branchExists.mockResolvedValue(false);
       expect(await branchWorker.processBranch(config, true)).toEqual(
         'pr-hourly-limit-reached'
       );
@@ -227,7 +227,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [],
       });
-      platform.branchExists.mockResolvedValueOnce(false);
+      git.branchExists.mockResolvedValueOnce(false);
       commit.commitFilesToBranch.mockResolvedValueOnce(null);
       expect(await branchWorker.processBranch(config)).toEqual('no-work');
     });
@@ -239,7 +239,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       commit.commitFilesToBranch.mockResolvedValueOnce(null);
       automerge.tryBranchAutomerge.mockResolvedValueOnce('automerged');
       await branchWorker.processBranch(config);
@@ -256,7 +256,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(false);
+      git.branchExists.mockResolvedValueOnce(false);
       automerge.tryBranchAutomerge.mockResolvedValueOnce('automerged');
       await branchWorker.processBranch({
         ...config,
@@ -275,7 +275,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       commit.commitFilesToBranch.mockResolvedValueOnce(null);
       automerge.tryBranchAutomerge.mockResolvedValueOnce('automerged');
       await branchWorker.processBranch({ ...config, dryRun: true });
@@ -291,7 +291,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       commit.commitFilesToBranch.mockResolvedValueOnce(null);
       automerge.tryBranchAutomerge.mockResolvedValueOnce('failed');
       prWorker.ensurePr.mockResolvedValueOnce({
@@ -310,7 +310,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       commit.commitFilesToBranch.mockResolvedValueOnce(null);
       automerge.tryBranchAutomerge.mockResolvedValueOnce('failed');
       prWorker.ensurePr.mockResolvedValueOnce({
@@ -346,7 +346,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       automerge.tryBranchAutomerge.mockResolvedValueOnce('failed');
       prWorker.ensurePr.mockResolvedValueOnce({
         result: PrResult.Created,
@@ -367,7 +367,7 @@ describe('workers/branch', () => {
         artifactErrors: [{}],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       automerge.tryBranchAutomerge.mockResolvedValueOnce('failed');
       prWorker.ensurePr.mockResolvedValueOnce({
         result: PrResult.Created,
@@ -388,7 +388,7 @@ describe('workers/branch', () => {
         artifactErrors: [{}],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       automerge.tryBranchAutomerge.mockResolvedValueOnce('failed');
       prWorker.ensurePr.mockResolvedValueOnce({
         result: PrResult.Created,
@@ -410,7 +410,7 @@ describe('workers/branch', () => {
         artifactErrors: [{}],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       automerge.tryBranchAutomerge.mockResolvedValueOnce('failed');
       prWorker.ensurePr.mockResolvedValueOnce({
         result: PrResult.Created,
@@ -432,7 +432,7 @@ describe('workers/branch', () => {
         artifactErrors: [{}],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(false);
+      git.branchExists.mockResolvedValueOnce(false);
       automerge.tryBranchAutomerge.mockResolvedValueOnce('failed');
       prWorker.ensurePr.mockResolvedValueOnce({
         result: PrResult.Created,
@@ -453,7 +453,7 @@ describe('workers/branch', () => {
         updatedArtifacts: [{}],
       } as never);
       config.recreateClosed = true;
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       automerge.tryBranchAutomerge.mockResolvedValueOnce('failed');
       prWorker.ensurePr.mockResolvedValueOnce({
         result: PrResult.Created,
@@ -492,7 +492,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       automerge.tryBranchAutomerge.mockResolvedValueOnce(false as never);
       prWorker.ensurePr.mockImplementationOnce(() => {
         throw new Error('some error');
@@ -502,7 +502,7 @@ describe('workers/branch', () => {
     });
 
     it('closed pr (dry run)', async () => {
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       checkExisting.prAlreadyExisted.mockResolvedValueOnce({
         state: PR_STATE_CLOSED,
       });
@@ -512,7 +512,7 @@ describe('workers/branch', () => {
     });
 
     it('branch pr no rebase (dry run)', async () => {
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         state: PR_STATE_OPEN,
         isModified: true,
@@ -531,7 +531,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         title: 'rebase!',
         state: PR_STATE_OPEN,
@@ -562,7 +562,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         title: 'rebase!',
         state: PR_STATE_OPEN,
@@ -594,7 +594,7 @@ describe('workers/branch', () => {
         artifactErrors: [],
         updatedArtifacts: [{}],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         title: 'rebase!',
         state: PR_STATE_OPEN,
@@ -632,7 +632,7 @@ describe('workers/branch', () => {
           },
         ],
       } as never);
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         title: 'rebase!',
         state: 'open',
diff --git a/lib/workers/branch/index.ts b/lib/workers/branch/index.ts
index e5c0cdcf43..89c1554992 100644
--- a/lib/workers/branch/index.ts
+++ b/lib/workers/branch/index.ts
@@ -25,7 +25,7 @@ import { ExternalHostError } from '../../types/errors/external-host-error';
 import { emojify } from '../../util/emoji';
 import { exec } from '../../util/exec';
 import { readLocalFile, writeLocalFile } from '../../util/fs';
-import { getRepoStatus } from '../../util/git';
+import { getRepoStatus, branchExists as gitBranchExists } from '../../util/git';
 import { regEx } from '../../util/regex';
 import { BranchConfig, PrResult, ProcessBranchResult } from '../common';
 import { checkAutoMerge, ensurePr } from '../pr';
@@ -63,7 +63,7 @@ export async function processBranch(
   );
   logger.trace({ config }, 'branch config');
   await platform.setBaseBranch(config.baseBranch);
-  const branchExists = await platform.branchExists(config.branchName);
+  const branchExists = await gitBranchExists(config.branchName);
   const branchPr = await platform.getBranchPr(config.branchName);
   logger.debug(`branchExists=${branchExists}`);
   const masterIssueCheck = (config.masterIssueChecks || {})[config.branchName];
diff --git a/lib/workers/branch/lock-files/index.spec.ts b/lib/workers/branch/lock-files/index.spec.ts
index 4637d34e31..a04a153597 100644
--- a/lib/workers/branch/lock-files/index.spec.ts
+++ b/lib/workers/branch/lock-files/index.spec.ts
@@ -7,7 +7,6 @@ import * as _lerna from '../../../manager/npm/post-update/lerna';
 import * as _npm from '../../../manager/npm/post-update/npm';
 import * as _pnpm from '../../../manager/npm/post-update/pnpm';
 import * as _yarn from '../../../manager/npm/post-update/yarn';
-import { platform as _platform } from '../../../platform';
 import * as _hostRules from '../../../util/host-rules';
 
 const defaultConfig = getConfig();
@@ -19,7 +18,6 @@ const yarn = mocked(_yarn);
 const pnpm = mocked(_pnpm);
 const lerna = mocked(_lerna);
 const hostRules = mocked(_hostRules);
-const platform = mocked(_platform);
 
 jest.mock('../../../util/git');
 
@@ -107,7 +105,7 @@ describe('manager/npm/post-update', () => {
     it('returns no error and empty lockfiles if lock file maintenance exists', async () => {
       config.updateType = 'lockFileMaintenance';
       config.reuseExistingBranch = true;
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       const res = await getAdditionalFiles(config, { npm: [{}] });
       expect(res).toMatchSnapshot();
       expect(res.artifactErrors).toHaveLength(0);
diff --git a/lib/workers/branch/reuse.spec.ts b/lib/workers/branch/reuse.spec.ts
index 27b4151081..d89e83b98b 100644
--- a/lib/workers/branch/reuse.spec.ts
+++ b/lib/workers/branch/reuse.spec.ts
@@ -1,9 +1,11 @@
-import { platform } from '../../../test/util';
+import { git, platform } from '../../../test/util';
 import { RenovateConfig } from '../../config';
 import { PR_STATE_OPEN } from '../../constants/pull-requests';
 import { Pr } from '../../platform';
 import { shouldReuseExistingBranch } from './reuse';
 
+jest.mock('../../util/git');
+
 describe('workers/branch/parent', () => {
   describe('getParentBranch(config)', () => {
     const pr: Pr = {
@@ -19,22 +21,19 @@ describe('workers/branch/parent', () => {
         rebaseWhen: 'behind-base-branch',
       };
     });
-    afterEach(() => {
-      jest.resetAllMocks();
-    });
     it('returns undefined if branch does not exist', async () => {
-      platform.branchExists.mockResolvedValueOnce(false);
+      git.branchExists.mockResolvedValueOnce(false);
       const res = await shouldReuseExistingBranch(config);
       expect(res.reuseExistingBranch).toBe(false);
     });
     it('returns branchName if no PR', async () => {
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockReturnValue(null);
       const res = await shouldReuseExistingBranch(config);
       expect(res.reuseExistingBranch).toBe(true);
     });
     it('returns branchName if does not need rebaseing', async () => {
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         ...pr,
         isConflicted: false,
@@ -43,7 +42,7 @@ describe('workers/branch/parent', () => {
       expect(res.reuseExistingBranch).toBe(true);
     });
     it('returns branchName if unmergeable and cannot rebase', async () => {
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         ...pr,
         isConflicted: true,
@@ -54,7 +53,7 @@ describe('workers/branch/parent', () => {
     });
     it('returns branchName if unmergeable and can rebase, but rebaseWhen is never', async () => {
       config.rebaseWhen = 'never';
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         ...pr,
         isConflicted: true,
@@ -64,7 +63,7 @@ describe('workers/branch/parent', () => {
       expect(res.reuseExistingBranch).toBe(true);
     });
     it('returns undefined if PR title rebase!', async () => {
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         ...pr,
         title: 'rebase!Update foo to v4',
@@ -73,7 +72,7 @@ describe('workers/branch/parent', () => {
       expect(res.reuseExistingBranch).toBe(false);
     });
     it('returns undefined if PR body check rebase', async () => {
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         ...pr,
         title: 'Update foo to v4',
@@ -83,7 +82,7 @@ describe('workers/branch/parent', () => {
       expect(res.reuseExistingBranch).toBe(false);
     });
     it('returns undefined if manual rebase by label', async () => {
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         ...pr,
         isModified: true,
@@ -93,7 +92,7 @@ describe('workers/branch/parent', () => {
       expect(res.reuseExistingBranch).toBe(false);
     });
     it('returns undefined if unmergeable and can rebase', async () => {
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         ...pr,
         isConflicted: true,
@@ -105,22 +104,22 @@ describe('workers/branch/parent', () => {
     it('returns branchName if automerge branch and not stale', async () => {
       config.automerge = true;
       config.automergeType = 'branch';
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       const res = await shouldReuseExistingBranch(config);
       expect(res.reuseExistingBranch).toBe(true);
     });
     it('returns undefined if automerge branch and stale', async () => {
       config.automerge = true;
       config.automergeType = 'branch';
-      platform.branchExists.mockResolvedValueOnce(true);
-      platform.isBranchStale.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
+      git.isBranchStale.mockResolvedValueOnce(true);
       const res = await shouldReuseExistingBranch(config);
       expect(res.reuseExistingBranch).toBe(false);
     });
     it('returns branch if rebaseWhen=behind-base-branch but cannot rebase', async () => {
       config.rebaseWhen = 'behind-base-branch';
-      platform.branchExists.mockResolvedValueOnce(true);
-      platform.isBranchStale.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
+      git.isBranchStale.mockResolvedValueOnce(true);
       platform.getBranchPr.mockResolvedValueOnce({
         ...pr,
         isConflicted: true,
diff --git a/lib/workers/branch/reuse.ts b/lib/workers/branch/reuse.ts
index 63c65f9995..ac0fe351f0 100644
--- a/lib/workers/branch/reuse.ts
+++ b/lib/workers/branch/reuse.ts
@@ -1,6 +1,7 @@
 import { RenovateConfig } from '../../config';
 import { logger } from '../../logger';
 import { platform } from '../../platform';
+import { branchExists, isBranchStale } from '../../util/git';
 
 type ParentBranch = {
   reuseExistingBranch: boolean;
@@ -12,8 +13,7 @@ export async function shouldReuseExistingBranch(
 ): Promise<ParentBranch> {
   const { branchName } = config;
   // Check if branch exists
-  const branchExists = await platform.branchExists(branchName);
-  if (!branchExists) {
+  if (!(await branchExists(branchName))) {
     logger.debug(`Branch needs creating`);
     return { reuseExistingBranch: false };
   }
@@ -50,8 +50,7 @@ export async function shouldReuseExistingBranch(
     (config.rebaseWhen === 'auto' && (await platform.getRepoForceRebase())) ||
     (config.automerge && config.automergeType === 'branch')
   ) {
-    const isBranchStale = await platform.isBranchStale(branchName);
-    if (isBranchStale) {
+    if (await isBranchStale(branchName)) {
       logger.debug(`Branch is stale and needs rebasing`);
       // We can rebase the branch only if no PR or PR can be rebased
       if (!pr || !pr.isModified) {
diff --git a/lib/workers/pr/index.spec.ts b/lib/workers/pr/index.spec.ts
index 52f5719c95..82d225e19d 100644
--- a/lib/workers/pr/index.spec.ts
+++ b/lib/workers/pr/index.spec.ts
@@ -1,4 +1,4 @@
-import { mocked, partial } from '../../../test/util';
+import { git, mocked, partial } from '../../../test/util';
 import { getConfig } from '../../config/defaults';
 import { PLATFORM_TYPE_GITLAB } from '../../constants/platforms';
 import { Pr, platform as _platform } from '../../platform';
@@ -15,6 +15,7 @@ const gitlabChangelogHelper = mocked(_changelogHelper);
 const platform = mocked(_platform);
 const defaultConfig = getConfig();
 
+jest.mock('../../util/git');
 jest.mock('./changelog');
 jest.mock('./code-owners');
 
@@ -330,7 +331,7 @@ describe('workers/pr', () => {
     });
     it('should return null if waiting for not pending', async () => {
       platform.getBranchStatus.mockResolvedValueOnce(BranchStatus.yellow);
-      platform.getBranchLastCommitTime.mockImplementationOnce(() =>
+      git.getBranchLastCommitTime.mockImplementationOnce(() =>
         Promise.resolve(new Date())
       );
       config.prCreation = 'not-pending';
@@ -340,7 +341,7 @@ describe('workers/pr', () => {
     });
     it('should create PR if pending timeout hit', async () => {
       platform.getBranchStatus.mockResolvedValueOnce(BranchStatus.yellow);
-      platform.getBranchLastCommitTime.mockImplementationOnce(() =>
+      git.getBranchLastCommitTime.mockImplementationOnce(() =>
         Promise.resolve(new Date('2017-01-01'))
       );
       config.prCreation = 'not-pending';
@@ -533,7 +534,7 @@ describe('workers/pr', () => {
       config.automerge = true;
       config.automergeType = 'branch';
       platform.getBranchStatus.mockResolvedValueOnce(BranchStatus.yellow);
-      platform.getBranchLastCommitTime.mockResolvedValueOnce(new Date());
+      git.getBranchLastCommitTime.mockResolvedValueOnce(new Date());
       const { prResult, pr } = await prWorker.ensurePr(config);
       expect(prResult).toEqual(PrResult.BlockedByBranchAutomerge);
       expect(pr).toBeUndefined();
@@ -542,9 +543,7 @@ describe('workers/pr', () => {
       config.automerge = true;
       config.automergeType = 'branch';
       platform.getBranchStatus.mockResolvedValueOnce(BranchStatus.yellow);
-      platform.getBranchLastCommitTime.mockResolvedValueOnce(
-        new Date('2018-01-01')
-      );
+      git.getBranchLastCommitTime.mockResolvedValueOnce(new Date('2018-01-01'));
       const { prResult, pr } = await prWorker.ensurePr(config);
       expect(prResult).toEqual(PrResult.Created);
       expect(pr).toBeDefined();
@@ -570,7 +569,7 @@ describe('workers/pr', () => {
     });
     it('should create PR if waiting for not pending but artifactErrors', async () => {
       platform.getBranchStatus.mockResolvedValueOnce(BranchStatus.yellow);
-      platform.getBranchLastCommitTime.mockResolvedValueOnce(new Date());
+      git.getBranchLastCommitTime.mockResolvedValueOnce(new Date());
       config.prCreation = 'not-pending';
       config.artifactErrors = [{}];
       config.platform = PLATFORM_TYPE_GITLAB;
diff --git a/lib/workers/pr/index.ts b/lib/workers/pr/index.ts
index 880c00f878..d3bcfa7ea1 100644
--- a/lib/workers/pr/index.ts
+++ b/lib/workers/pr/index.ts
@@ -9,6 +9,7 @@ import { PlatformPrOptions, Pr, platform } from '../../platform';
 import { BranchStatus } from '../../types';
 import { ExternalHostError } from '../../types/errors/external-host-error';
 import { sampleSize } from '../../util';
+import { getBranchLastCommitTime } from '../../util/git';
 import { BranchConfig, PrResult } from '../common';
 import { getPrBody } from './body';
 import { ChangeLogError } from './changelog';
@@ -137,7 +138,7 @@ export async function ensurePr(
     );
     if ((await getBranchStatus()) === BranchStatus.yellow) {
       logger.debug('Checking how long this branch has been pending');
-      const lastCommitTime = await platform.getBranchLastCommitTime(branchName);
+      const lastCommitTime = await getBranchLastCommitTime(branchName);
       const currentTime = new Date();
       const millisecondsPerHour = 1000 * 60 * 60;
       const elapsedHours = Math.round(
@@ -180,7 +181,7 @@ export async function ensurePr(
       logger.debug(
         `Branch status is "${await getBranchStatus()}" - checking timeout`
       );
-      const lastCommitTime = await platform.getBranchLastCommitTime(branchName);
+      const lastCommitTime = await getBranchLastCommitTime(branchName);
       const currentTime = new Date();
       const millisecondsPerHour = 1000 * 60 * 60;
       const elapsedHours = Math.round(
diff --git a/lib/workers/repository/finalise/prune.spec.ts b/lib/workers/repository/finalise/prune.spec.ts
index c67a4288ef..2e5031ab57 100644
--- a/lib/workers/repository/finalise/prune.spec.ts
+++ b/lib/workers/repository/finalise/prune.spec.ts
@@ -1,7 +1,14 @@
-import { RenovateConfig, getConfig, platform } from '../../../../test/util';
+import {
+  RenovateConfig,
+  getConfig,
+  git,
+  platform,
+} from '../../../../test/util';
 import { PLATFORM_TYPE_GITHUB } from '../../../constants/platforms';
 import * as cleanup from './prune';
 
+jest.mock('../../../util/git');
+
 let config: RenovateConfig;
 beforeEach(() => {
   jest.resetAllMocks();
@@ -16,42 +23,42 @@ describe('workers/repository/finalise/prune', () => {
     it('returns if no branchList', async () => {
       delete config.branchList;
       await cleanup.pruneStaleBranches(config, config.branchList);
-      expect(platform.getAllRenovateBranches).toHaveBeenCalledTimes(0);
+      expect(git.getAllRenovateBranches).toHaveBeenCalledTimes(0);
     });
     it('returns if no renovate branches', async () => {
       config.branchList = [];
-      platform.getAllRenovateBranches.mockResolvedValueOnce([]);
+      git.getAllRenovateBranches.mockResolvedValueOnce([]);
       await expect(
         cleanup.pruneStaleBranches(config, config.branchList)
       ).resolves.not.toThrow();
     });
     it('returns if no remaining branches', async () => {
       config.branchList = ['renovate/a', 'renovate/b'];
-      platform.getAllRenovateBranches.mockResolvedValueOnce(config.branchList);
+      git.getAllRenovateBranches.mockResolvedValueOnce(config.branchList);
       await cleanup.pruneStaleBranches(config, config.branchList);
-      expect(platform.getAllRenovateBranches).toHaveBeenCalledTimes(1);
+      expect(git.getAllRenovateBranches).toHaveBeenCalledTimes(1);
       expect(platform.deleteBranch).toHaveBeenCalledTimes(0);
     });
     it('renames deletes remaining branch', async () => {
       config.branchList = ['renovate/a', 'renovate/b'];
-      platform.getAllRenovateBranches.mockResolvedValueOnce(
+      git.getAllRenovateBranches.mockResolvedValueOnce(
         config.branchList.concat(['renovate/c'])
       );
       platform.findPr.mockResolvedValueOnce({ title: 'foo' } as never);
       await cleanup.pruneStaleBranches(config, config.branchList);
-      expect(platform.getAllRenovateBranches).toHaveBeenCalledTimes(1);
+      expect(git.getAllRenovateBranches).toHaveBeenCalledTimes(1);
       expect(platform.deleteBranch).toHaveBeenCalledTimes(1);
       expect(platform.updatePr).toHaveBeenCalledTimes(1);
     });
     it('does nothing on dryRun', async () => {
       config.branchList = ['renovate/a', 'renovate/b'];
       config.dryRun = true;
-      platform.getAllRenovateBranches.mockResolvedValueOnce(
+      git.getAllRenovateBranches.mockResolvedValueOnce(
         config.branchList.concat(['renovate/c'])
       );
       platform.findPr.mockResolvedValueOnce({ title: 'foo' } as never);
       await cleanup.pruneStaleBranches(config, config.branchList);
-      expect(platform.getAllRenovateBranches).toHaveBeenCalledTimes(1);
+      expect(git.getAllRenovateBranches).toHaveBeenCalledTimes(1);
       expect(platform.deleteBranch).toHaveBeenCalledTimes(0);
       expect(platform.updatePr).toHaveBeenCalledTimes(0);
     });
@@ -59,25 +66,25 @@ describe('workers/repository/finalise/prune', () => {
       config.branchList = ['renovate/a', 'renovate/b'];
       config.dryRun = false;
       config.pruneStaleBranches = false;
-      platform.getAllRenovateBranches.mockResolvedValueOnce(
+      git.getAllRenovateBranches.mockResolvedValueOnce(
         config.branchList.concat(['renovate/c'])
       );
       platform.findPr.mockResolvedValueOnce({ title: 'foo' } as never);
       await cleanup.pruneStaleBranches(config, config.branchList);
-      expect(platform.getAllRenovateBranches).toHaveBeenCalledTimes(1);
+      expect(git.getAllRenovateBranches).toHaveBeenCalledTimes(1);
       expect(platform.deleteBranch).toHaveBeenCalledTimes(0);
       expect(platform.updatePr).toHaveBeenCalledTimes(0);
     });
     it('posts comment if someone pushed to PR', async () => {
       config.branchList = ['renovate/a', 'renovate/b'];
       config.dryRun = false;
-      platform.getAllRenovateBranches.mockResolvedValueOnce(
+      git.getAllRenovateBranches.mockResolvedValueOnce(
         config.branchList.concat(['renovate/c'])
       );
       platform.getBranchPr.mockResolvedValueOnce({ isModified: true } as never);
       platform.findPr.mockResolvedValueOnce({ title: 'foo' } as never);
       await cleanup.pruneStaleBranches(config, config.branchList);
-      expect(platform.getAllRenovateBranches).toHaveBeenCalledTimes(1);
+      expect(git.getAllRenovateBranches).toHaveBeenCalledTimes(1);
       expect(platform.deleteBranch).toHaveBeenCalledTimes(0);
       expect(platform.updatePr).toHaveBeenCalledTimes(0);
       expect(platform.ensureComment).toHaveBeenCalledTimes(1);
@@ -85,13 +92,13 @@ describe('workers/repository/finalise/prune', () => {
     it('skips comment if dry run', async () => {
       config.branchList = ['renovate/a', 'renovate/b'];
       config.dryRun = true;
-      platform.getAllRenovateBranches.mockResolvedValueOnce(
+      git.getAllRenovateBranches.mockResolvedValueOnce(
         config.branchList.concat(['renovate/c'])
       );
       platform.getBranchPr.mockResolvedValueOnce({ isModified: true } as never);
       platform.findPr.mockResolvedValueOnce({ title: 'foo' } as never);
       await cleanup.pruneStaleBranches(config, config.branchList);
-      expect(platform.getAllRenovateBranches).toHaveBeenCalledTimes(1);
+      expect(git.getAllRenovateBranches).toHaveBeenCalledTimes(1);
       expect(platform.deleteBranch).toHaveBeenCalledTimes(0);
       expect(platform.updatePr).toHaveBeenCalledTimes(0);
       expect(platform.ensureComment).toHaveBeenCalledTimes(0);
diff --git a/lib/workers/repository/finalise/prune.ts b/lib/workers/repository/finalise/prune.ts
index fb64b97b55..80de63e497 100644
--- a/lib/workers/repository/finalise/prune.ts
+++ b/lib/workers/repository/finalise/prune.ts
@@ -3,6 +3,7 @@ import { REPOSITORY_CHANGED } from '../../../constants/error-messages';
 import { PR_STATE_OPEN } from '../../../constants/pull-requests';
 import { logger } from '../../../logger';
 import { platform } from '../../../platform';
+import { getAllRenovateBranches } from '../../../util/git';
 
 async function cleanUpBranches(
   { dryRun, pruneStaleBranches: enabled }: RenovateConfig,
@@ -81,9 +82,7 @@ export async function pruneStaleBranches(
     logger.debug('No branchList');
     return;
   }
-  let renovateBranches = await platform.getAllRenovateBranches(
-    config.branchPrefix
-  );
+  let renovateBranches = await getAllRenovateBranches(config.branchPrefix);
   if (!(renovateBranches && renovateBranches.length)) {
     logger.debug('No renovate branches found');
     return;
diff --git a/lib/workers/repository/init/base.spec.ts b/lib/workers/repository/init/base.spec.ts
index eb5b59aa35..4a0deb2cc5 100644
--- a/lib/workers/repository/init/base.spec.ts
+++ b/lib/workers/repository/init/base.spec.ts
@@ -1,6 +1,13 @@
-import { RenovateConfig, getConfig, platform } from '../../../../test/util';
+import {
+  RenovateConfig,
+  getConfig,
+  git,
+  platform,
+} from '../../../../test/util';
 import { checkBaseBranch } from './base';
 
+jest.mock('../../../util/git');
+
 let config: RenovateConfig;
 beforeEach(() => {
   jest.resetAllMocks();
@@ -18,7 +25,7 @@ describe('workers/repository/init/base', () => {
     });
     it('sets baseBranch', async () => {
       config.baseBranch = 'ssome-base';
-      platform.branchExists.mockResolvedValue(true);
+      git.branchExists.mockResolvedValue(true);
       const res = await checkBaseBranch(config);
       expect(res.errors).toHaveLength(0);
       expect(platform.setBaseBranch).toHaveBeenCalledTimes(1);
diff --git a/lib/workers/repository/init/base.ts b/lib/workers/repository/init/base.ts
index 099efbe2ec..6c6be45eda 100644
--- a/lib/workers/repository/init/base.ts
+++ b/lib/workers/repository/init/base.ts
@@ -1,6 +1,7 @@
 import { RenovateConfig, ValidationMessage } from '../../../config';
 import { logger } from '../../../logger';
 import { platform } from '../../../platform';
+import { branchExists } from '../../../util/git';
 
 export async function checkBaseBranch(
   config: RenovateConfig
@@ -12,7 +13,7 @@ export async function checkBaseBranch(
   // istanbul ignore else
   if (config.baseBranch) {
     // Read content and target PRs here
-    if (await platform.branchExists(config.baseBranch)) {
+    if (await branchExists(config.baseBranch)) {
       baseBranchSha = await platform.setBaseBranch(config.baseBranch);
     } else {
       // Warn and ignore setting (use default branch)
diff --git a/lib/workers/repository/init/index.spec.ts b/lib/workers/repository/init/index.spec.ts
index ced701204e..4329e293bb 100644
--- a/lib/workers/repository/init/index.spec.ts
+++ b/lib/workers/repository/init/index.spec.ts
@@ -4,6 +4,7 @@ import * as _base from './base';
 import * as _config from './config';
 import { initRepo } from '.';
 
+jest.mock('../../../util/git');
 jest.mock('../../../workers/repository/onboarding/branch');
 jest.mock('../../../workers/repository/configured');
 jest.mock('../../../workers/repository/init/apis');
diff --git a/lib/workers/repository/init/index.ts b/lib/workers/repository/init/index.ts
index 040cd7f061..3bf947019c 100644
--- a/lib/workers/repository/init/index.ts
+++ b/lib/workers/repository/init/index.ts
@@ -3,6 +3,7 @@ import { logger } from '../../../logger';
 import { platform } from '../../../platform';
 import * as memCache from '../../../util/cache/memory';
 import * as repositoryCache from '../../../util/cache/repository';
+import { setBranchPrefix } from '../../../util/git';
 import { checkIfConfigured } from '../configured';
 import { checkOnboardingBranch } from '../onboarding/branch';
 import { initApis } from './apis';
@@ -27,7 +28,7 @@ export async function initRepo(input: RenovateConfig): Promise<RenovateConfig> {
   config = await mergeRenovateConfig(config);
   checkIfConfigured(config);
   config = await checkBaseBranch(config);
-  await platform.setBranchPrefix(config.branchPrefix);
+  await setBranchPrefix(config.branchPrefix);
   config = await detectVulnerabilityAlerts(config);
   // istanbul ignore if
   if (config.printConfig) {
diff --git a/lib/workers/repository/init/semantic.spec.ts b/lib/workers/repository/init/semantic.spec.ts
index 8fff1faec2..b920e8c411 100644
--- a/lib/workers/repository/init/semantic.spec.ts
+++ b/lib/workers/repository/init/semantic.spec.ts
@@ -1,6 +1,8 @@
-import { RenovateConfig, getConfig, platform } from '../../../../test/util';
+import { RenovateConfig, getConfig, git } from '../../../../test/util';
 import { detectSemanticCommits } from './semantic';
 
+jest.mock('../../../util/git');
+
 let config: RenovateConfig;
 beforeEach(() => {
   jest.resetAllMocks();
@@ -18,16 +20,13 @@ describe('workers/repository/init/semantic', () => {
     });
     it('detects false if unknown', async () => {
       config.semanticCommits = null;
-      platform.getCommitMessages.mockResolvedValue(['foo', 'bar']);
+      git.getCommitMessages.mockResolvedValue(['foo', 'bar']);
       const res = await detectSemanticCommits(config);
       expect(res).toBe(false);
     });
     it('detects true if known', async () => {
       config.semanticCommits = null;
-      platform.getCommitMessages.mockResolvedValue([
-        'fix: foo',
-        'refactor: bar',
-      ]);
+      git.getCommitMessages.mockResolvedValue(['fix: foo', 'refactor: bar']);
       const res = await detectSemanticCommits(config);
       expect(res).toBe(true);
     });
diff --git a/lib/workers/repository/init/semantic.ts b/lib/workers/repository/init/semantic.ts
index 0195ede34d..66e173d956 100644
--- a/lib/workers/repository/init/semantic.ts
+++ b/lib/workers/repository/init/semantic.ts
@@ -1,7 +1,7 @@
 import conventionalCommitsDetector from 'conventional-commits-detector';
 import { RenovateConfig } from '../../../config';
 import { logger } from '../../../logger';
-import { platform } from '../../../platform';
+import { getCommitMessages } from '../../../util/git';
 
 export async function detectSemanticCommits(
   config: RenovateConfig
@@ -15,7 +15,7 @@ export async function detectSemanticCommits(
     );
     return config.semanticCommits;
   }
-  const commitMessages = await platform.getCommitMessages();
+  const commitMessages = await getCommitMessages();
   if (commitMessages) {
     commitMessages.length = 10;
   }
diff --git a/lib/workers/repository/process/limits.spec.ts b/lib/workers/repository/process/limits.spec.ts
index f698036f60..056aa0a5d6 100644
--- a/lib/workers/repository/process/limits.spec.ts
+++ b/lib/workers/repository/process/limits.spec.ts
@@ -1,8 +1,15 @@
 import moment from 'moment';
-import { RenovateConfig, getConfig, platform } from '../../../../test/util';
+import {
+  RenovateConfig,
+  getConfig,
+  git,
+  platform,
+} from '../../../../test/util';
 import { BranchConfig } from '../../common';
 import * as limits from './limits';
 
+jest.mock('../../../util/git');
+
 let config: RenovateConfig;
 beforeEach(() => {
   jest.resetAllMocks();
@@ -34,7 +41,7 @@ describe('workers/repository/process/limits', () => {
   describe('getConcurrentPrsRemaining()', () => {
     it('calculates concurrent limit remaining', async () => {
       config.prConcurrentLimit = 20;
-      platform.branchExists.mockResolvedValueOnce(true);
+      git.branchExists.mockResolvedValueOnce(true);
       const branches: BranchConfig[] = [
         { branchName: 'test', upgrades: [] },
         { branchName: undefined, upgrades: [] },
diff --git a/lib/workers/repository/process/limits.ts b/lib/workers/repository/process/limits.ts
index 3745e99d5c..9d279476fd 100644
--- a/lib/workers/repository/process/limits.ts
+++ b/lib/workers/repository/process/limits.ts
@@ -2,6 +2,7 @@ import moment from 'moment';
 import { RenovateConfig } from '../../../config';
 import { logger } from '../../../logger';
 import { platform } from '../../../platform';
+import { branchExists } from '../../../util/git';
 import { BranchConfig } from '../../common';
 
 export async function getPrHourlyRemaining(
@@ -47,7 +48,7 @@ export async function getConcurrentPrsRemaining(
     logger.debug(`Enforcing prConcurrentLimit (${config.prConcurrentLimit})`);
     let currentlyOpen = 0;
     for (const branch of branches) {
-      if (await platform.branchExists(branch.branchName)) {
+      if (await branchExists(branch.branchName)) {
         currentlyOpen += 1;
       }
     }
-- 
GitLab