Skip to content

atudomain/atudomain-git

Repository files navigation

Simple Python wrapper for Git

pipeline Documentation Status

Provides access to Commit objects and easy branch listing.

  • License: 3-Clause BSD
  • Python: Python 3.6+

Table of Contents

Installation

Install using pip:

python3 -m pip install atudomain-git --user 

Alternatively, you can just append downloaded repository path to PYTHONPATH.

Quickstart

Import Git class:

from atudomain.git import Git

Create Git object:

git = Git('/home/user/example-repo')

Getting branches

Get list of remote origin branches:

branches = git.get_branches(include='^remotes/origin')

Get list of local branches:

branches = git.get_branches(exclude='^remotes/')

Getting Commits

Get list of Commits for the current branch:

commits = git.get_commits()

Get list with last Commit for the current branch:

commits = git.get_commits('HEAD^..HEAD')

Getting Commit details

Get committer date from Commit:

committer_date = commits[0].committer_date

Get commit id from Commit:

commit_id = commits[0].commit_id

Check if Commit is a merge:

is_merge = commits[0].is_merge

API Documentation

https://atudomain-git.readthedocs.io/en/latest/