setBranchUpstreamTo method

Future<BranchConfig> setBranchUpstreamTo(
  1. String branchName,
  2. GitRemoteConfig remote,
  3. String remoteBranchName
)

Implementation

Future<BranchConfig> setBranchUpstreamTo(String branchName,
    GitRemoteConfig remote, String remoteBranchName) async {
  var brConfig = config.branch(branchName);
  if (brConfig == null) {
    brConfig = BranchConfig(name: branchName);
    config.branches[branchName] = brConfig;
  }
  brConfig.remote = remote.name;
  brConfig.merge = ReferenceName.branch(remoteBranchName);

  await saveConfig();
  return brConfig;
}