About
rw_git
is a git wrapper that facilitates the out-of-the-box execution of common git operations.
Features
x
init
: Initialize a local GIT directory. If the local directory does not exist, it will be created.x
clone
: Clone a remote repository into a local folder. If the local directory does not exist, it will be created.x
checkout
: Checkout a GIT branch on the specified, existing directory.x
fetchTags
: Retrieve a list of tags of the specified repository.x
getCommitsBetween
: Retrieve a list of commits between two given tags.x
stats
: Get the number of lines inserted, deleted and number of files changed.
Getting started
pubspec.yaml:
rw_git: 1.0.0
Usage
Initialize RwGit:
RwGit rwGit = RwGit();
Clone a remote repository:
String localDirectoryToCloneInto = _createCheckoutDirectory(localDirectoryName);
rwGit.clone(localDirectoryToCloneInto, repositoryToClone);
Fetch tags of a remote repository:
List<String> tags = await rwGit.fetchTags(localDirectoryToCloneInto);
print("Number of tags: ${tags.length}");
Retrieve the commits between two tags:
List<String> listOfCommitsBetweenTwoTags = await rwGit.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.stats(localDirectoryToCloneInto, oldTag, newTag);
print('Number of lines inserted: ${shortStatDto.insertions}'
' Number of lines deleted: ${shortStatDto.deletions}'
' Number of files changed: ${shortStatDto.numberOfChangedFiles}');
Additional information
Please file any issues on the github issue tracker.
Libraries
- rw_git
- A simple GIT wrapper.