Close
Edit

Git

git git


Термины:
clon
init
push
pull
mergre
rebase
commit
fetch

git log --oneline --graph --decorate --all

git status
git add .
git push
git pull
git log --oneline --graph --decorate --all
git log --oneline --graph --decorate --all --stat -n 4

helper for git

#!/bin/bash
# bashlib

# to update type:
# source ./bashlib

bl_version='0.3.1'

function gsend {

    logrows=3

    echo -n "
    ===== ===== ===== "
    echo " status"
    git status

    echo -n "
    ===== ===== ===== "
    echo " add files"
    git add .

    echo -n "
    ===== ===== ===== "
    echo " status"
    git status

    echo -n "
    ===== ===== ===== "
    echo " create commit: 'auto commit: $1'"
    git commit -m "auto commit: $1"

    echo -n "
    ===== ===== ===== "
    echo " push"
    git push

    echo -n "
    ===== ===== ===== "
    echo " log (last $logrows)"
    git log --oneline --graph --decorate --all --stat -n $logrows

}

function gits {
git status
}

function gitsa {
git add .
}

function gitp {
git push
}

function gitpl {
git pull
}

function gitl {
git log --oneline --graph --decorate --all
}

function gitla {
git log --oneline --graph --decorate --all --stat -n 4
}

function f_blhelp {
    echo "this lib provide next commands:"
    echo -n "    gsend"
    echo -e "\t complex git script: status, add, status, commit, push, log"
    echo -n "    gits"
    echo -e "\t command: git status"
    echo -n "    gitsa"
    echo -e "\t command: git add ."
    echo -n "    gitp"
    echo -e "\t command: git push"
    echo -n "    gitpl"
    echo -e "\t command: git pull"
    echo -n "    gitl"
    echo -e "\t command: git log --oneline --graph --decorate --all"
    echo -n "    gitpla"
    echo -e "\t command: git log --oneline --graph --decorate --all --stat -n 4"
    echo ""
}


function f_vers {
    echo "
===== ===== ./bashlib updated v$bl_version
type for help:
bl -h

"
}

function bl {

    while [ -n "$1" ]
    do
        case "$1" in
            -h) f_blhelp ;;
            -v) f_vers ;;
            -a) echo "Found the -a option";;
            -b) param="$2"
            echo "Found the -b option, with parameter value $param"
            shift ;;
            -c) echo "Found the -c option";;
            --) shift
            break ;;
            *) echo "$1 is not an option";;
        esac
        shift
    done
    count=1
    for param in "$@"
    do
        echo "Parameter #$count: $param"
        count=$(( $count + 1 ))
    done
}

function zzz {
bl -h
}

f_vers
Ctrl + S : Update