https://github.com/atudomain/atudomain-git
Simple Python wrapper for Git. Originally created for commit and branch analysis.
https://github.com/atudomain/atudomain-git
git git-python library python python-git
Last synced: about 1 month ago
JSON representation
Simple Python wrapper for Git. Originally created for commit and branch analysis.
- Host: GitHub
- URL: https://github.com/atudomain/atudomain-git
- Owner: atudomain
- License: bsd-3-clause
- Created: 2019-11-02T23:14:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T08:06:52.000Z (about 3 years ago)
- Last Synced: 2025-12-19T02:56:28.875Z (2 months ago)
- Topics: git, git-python, library, python, python-git
- Language: Python
- Homepage: https://atudomain-git.readthedocs.io/en/latest/
- Size: 66.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple Python wrapper for Git
[](https://gitlab.com/atudomain/atudomain-git/-/tree/master)
[](https://atudomain-git.readthedocs.io/en/latest/?badge=latest)
Provides access to Commit objects and easy branch listing.
- License: 3-Clause BSD
- Python: Python 3.6+
## Table of Contents
- [Installation](#installation)
- [Quickstart](#quickstart)
- [Getting Branches](#getting-branches)
- [Getting Commits](#getting-commits)
- [Getting Commit details](#getting-commit-details)
- [API Documentation](#api-documentation)
## Installation
Install using pip:
```bash
python3 -m pip install atudomain-git --user
```
Alternatively, you can just append downloaded repository path to PYTHONPATH.
## Quickstart
Import Git class:
```python
from atudomain.git import Git
```
Create Git object:
```python
git = Git('/home/user/example-repo')
```
### Getting branches
Get list of remote origin branches:
```python
branches = git.get_branches(include='^remotes/origin')
```
Get list of local branches:
```python
branches = git.get_branches(exclude='^remotes/')
```
### Getting Commits
Get list of Commits for the current branch:
```python
commits = git.get_commits()
```
Get list with last Commit for the current branch:
```python
commits = git.get_commits('HEAD^..HEAD')
```
### Getting Commit details
Get committer date from Commit:
```python
committer_date = commits[0].committer_date
```
Get commit id from Commit:
```python
commit_id = commits[0].commit_id
```
Check if Commit is a merge:
```python
is_merge = commits[0].is_merge
```
## API Documentation
https://atudomain-git.readthedocs.io/en/latest/