push method

Future<void> push({
  1. String? remote,
  2. String? branch,
  3. bool force = false,
  4. bool setUpstream = false,
  5. String? workDir,
})

Pushes to a remote.

Implementation

Future<void> push({
  String? remote,
  String? branch,
  bool force = false,
  bool setUpstream = false,
  String? workDir,
}) async {
  final args = <String>['push'];
  if (force) args.add('--force');
  if (setUpstream) args.add('--set-upstream');
  if (remote != null) args.add(remote);
  if (branch != null) args.add(branch);
  await _runGit(args, workDir: workDir ?? defaultWorkDir);
}