rw_git
is a git wrapper that facilitates the out-of-the-box execution of common git operations.
rw_git offers a variety of features which are separated into relevant classes. To use this library you can either refer directly to the class which implements the implementation needed, or refer to an instance of it through the RwGit
class.
-
init
: Initialize a local GIT directory. If the local directory does not exist, it will be created. -
clone
: Clone a remote repository into a local folder. If the local directory does not exist, it will be created. -
checkout
: Checkout a GIT branch on the specified, existing directory. -
fetchTags
: Retrieve a list of tags of the specified repository. -
getCommitsBetween
: Retrieve a list of commits between two given tags.
-
stats
: Get the number of lines inserted, deleted and number of files changed. -
contibutionsByAuthor
: Returns the number of contributions for every author of the repository.
pubspec.yaml:
rw_git: 1.0.3
Import library:
import 'package:rw_git/rw_git.dart';
Initialize RwGit:
RwGit rwGit = RwGit();
Clone a remote repository:
String localDirectoryToCloneInto = _createCheckoutDirectory(localDirectoryName);
rwGit.gitCommon.clone(localDirectoryToCloneInto, repositoryToClone);
Fetch tags of a remote repository:
List<String> tags = await rwGit.gitCommon.fetchTags(localDirectoryToCloneInto);
print("Number of tags: ${tags.length}");
Retrieve the commits between two tags:
List<String> listOfCommitsBetweenTwoTags = await rwGit.gitCommon.getCommitsBetween(localDirectoryToCloneInto, oldTag, newTag);
print("Number of commits between $oldTag and $newTag: ${listOfCommitsBetweenTwoTags.length}");
Retrieve code-change statistics between two tags:
ShortStatDto shortStatDto = await rwGit.gitStats.stats(localDirectoryToCloneInto, oldTag, newTag);
print('Number of lines inserted: ${shortStatDto.insertions}'
' Number of lines deleted: ${shortStatDto.deletions}'
' Number of files changed: ${shortStatDto.numberOfChangedFiles}');
Please file any issues on the github issue tracker.