Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antrikshmisri/pygit
Pygit provides git commands that can be executed from a python script
https://github.com/antrikshmisri/pygit
Last synced: 4 months ago
JSON representation
Pygit provides git commands that can be executed from a python script
- Host: GitHub
- URL: https://github.com/antrikshmisri/pygit
- Owner: antrikshmisri
- License: mit
- Created: 2020-12-12T18:23:53.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-30T16:19:50.000Z (about 3 years ago)
- Last Synced: 2024-09-29T14:41:55.626Z (4 months ago)
- Language: Python
- Homepage:
- Size: 27.3 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.txt
- License: LICENSE.txt
Awesome Lists containing this project
README
# Pygit
[![Downloads](https://pepy.tech/badge/pygitcli)](https://pepy.tech/project/pygitcli)
[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)
## Installation:```bash
pip install Pygitcli
```## Here is an example code to perform various git commands:-
```python
"""
===============
Pygitcli
===============
This example shows how to use the Pygitcli module. We will demonstrate how
to perform various git commands.
First, some imports.
"""
from Pygitcli.git import Git###############################################################################
# Now let's initialize the Git class
# We need to provide the path to the target directorygit = Git(r'D:\test_directory')
###############################################################################
# Next we will initialize an empty git directory in the target directoryrepo_info = ['https://github.com/test_user/test_repo.git', 'master']
git.init_repo(repo_info)###############################################################################
# Next, we'll perform various git commandsgit.add('test_file.txt')
git.commit('test_file.txt')
git.pull(repo_info)
git.push(repo_info)###############################################################################
# There are some utility functions in the Git class as wellgit.create_readme() # creates a README.md in the target directory
# Set remote URL, branch
git.set_remote(url='https://github.com/test_user/test_repo.git')
git.set_branch(branch='master', new=True) # If the branch already exists set new to False# Get remote repository information (URL, branch)
url = git.get_remote()
branch = git.get_branch()
```