git add, commit and push commands in one?

前端 未结 30 1440
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 03:15

Is there any way to use these three commands in one?

git add .
git commit -a -m \"commit\" (do not need commit message either)
git push

Som

30条回答
  •  不思量自难忘°
    2020-12-02 03:56

    There are some issues with the scripts above:

    shift "removes" the parameter $1, otherwise, "push" will read it and "misunderstand it".

    My tip :

    git config --global alias.acpp '!git add -A && branchatu="$(git symbolic-ref HEAD 2>/dev/null)" && branchatu=${branchatu##refs/heads/} && git commit -m "$1" && shift && git pull -u origin $branchatu && git push -u origin $branchatu'

提交回复
热议问题