git add, commit and push commands in one?

前端 未结 30 1414
隐瞒了意图╮
隐瞒了意图╮ 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 04:15

    This is perfect for command grouping.

    Grouping Commands

    { list; } Placing a list of commands between curly braces causes the list to be executed in the current shell context. No subshell is created. The semicolon (or newline) following list is required.

    legit(){ git add --all; git commit -m "$1"; git push origin master; }
    legit 'your commit message here'
    

提交回复
热议问题