Organize and collect useful git scripts

gcp

gcp => add + commit + push + status

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#!/bin/sh

set -e

if [ 0 -eq $# ]; then
        echo "Usage: gcp <commit>"
        exit 1
fi

git add -A
git commit -m "$1"
git push
git status

gta

gta => add tag and push to origin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#!/bin/sh

set -e

if [ 0 -eq $# ]; then
        echo -e "Usage: gta <tag> <commit>"
        exit 1
fi

git tag $1 -m "$2"
git push origin $1

gtd

gtd => delete local and origin tag

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#!/bin/sh

set -e

if [ 0 -eq $# ]; then
        echo "Usage: gtd <tag>"
        exit 1
fi

git tag -d $1
git push origin :refs/tags/$1
git tag -n