Skip to content

adarsh62656/GIT-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github Library

git is a library that can be used to run git commands in python.

Installation

Paste git.py file in the Lib folder of the path retreved from os.path.dirname(sys.executable)

Usage

import git

# clones repository from the "url"
git.clone(url)

Git init

# initialize empty repository on current location
git.gitinit()

Git add

# adds files to the stage from the "path".
git.addtostage(path)

Git rm

#remove "file" from staging area
git.rmstage(file)

Git commit

#commits with the "message"
git.commit(message)

Git remote add origin

'''

origin -  add the remote point name 
url    -  add url to connect with remote repositary
'''
git.add_origin(origin,path)

Git push

'''
origin -  mantion the remote point name to push
branch -  branch name from where to push"""
'''
git.push(origin,path)

Git status

from git import status

To get modified files use:

status.modified()

To get cached files use:

status.cached()

To get untracked files use:

status.untracked()

To get deleted files use:

status.deleted()

To get staged files use:

status.staged()

Git log

#importing log class from git library
from git import log

log.commit_data() function can be used to find particular log details based on its commit id or commit message.

# Using commit Message:
log().commit_data('Create README.md')
# Using commit ID:
log().commit_data('70bca60c7a99f7cb10d9beb6d4550d6904a012a9')

About

git library to use in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages