Skip to content

basameera/egit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

egit

Python module for handling git easy.

Features

  • Smart git fetch

Only Python 3

Module can be accessed using both eg and egit commands

$ eg -h
usage: 
  egit                  : Git status
  egit comment          : Git add, commit (with "comment") and push
  egit -a               : Git Add -A
  egit -c comment       : Git Commit -m comment
  egit -p               : Git Push
  egit -u               : Git Pull
  egit -b <branch name> : Change branch

Easy Git - 0.1.1 | 2020 Sameera Sandaruwan

positional arguments:
  comment

optional arguments:
  -h, --help  show this help message and exit
  -a          Git Add -A
  -c          Git Commit -m comment
  -p          Git Push
  -u          Git Pull
  -b          Change branch
  -s          git-credential-cache for 3 hours

Install

  1. Clone this repo. ( git clone https://github.com/basameera/egit.git )
  2. cd egit
  3. pip3 install .
  4. Add export PATH=~/.local/bin:$PATH to ~/.bashrc file
  5. source ~/.bashrc

Git fetch

UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse "$UPSTREAM")
BASE=$(git merge-base @ "$UPSTREAM")

echo LOCAL : $LOCAL
echo REMOTE: $REMOTE
echo BASE : $BASE

if [ $LOCAL = $REMOTE ]; then
    echo "Up-to-date"
elif [ $LOCAL = $BASE ]; then
    echo "Need to pull"
elif [ $REMOTE = $BASE ]; then
    echo "Need to push"
else
    echo "Diverged"
fi

About

Easy Git wrapper using Python 3

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published