aiueo49 / TIL

0 stars 0 forks source link

gitadd.~gitcommit~gitpushの自動化 #3

Closed aiueo49 closed 9 months ago

aiueo49 commented 9 months ago
aiueo49 commented 9 months ago

add .からpushまでをマクロで定義

gish() {

全てステージにのせる

git add .
# コミット対象のファイルを確認
git status
read "yesno?Commit with this content. OK? (y/N): "
case "$yesno" in
    # yes
    [yY]*)
        read "msg?Input Commit Message: "
        git commit -m "$msg"
        CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
        git push origin "$CURRENT_BRANCH"
        ;;
    # no
    *)
        echo "Quit."
        ;;
esac

}