将add、commit、push 三个命令合为一个:
git config --global alias.cmp '!f() { git add -A && git commit -m "$@" && git push; }; f'
使用时只需要 git cmp "内容"
由此可知若想讲add、commit两个命令合为一个只需要输入下面的命令
git config --global alias.cm '!f() { git add -A && git commit -m "$@"; }; f'
使用时只需要 git cm "内容"
---原生写法
git add和commit一起操作 合并操作
千次阅读2020-02-02 23:27:28执行git commit -am "提交描述"
即可将add和commit操作合并, 不需要先git add file 再 git commit -m “提交描述” 了
-a
–all
参数作用: Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.
-m
–message=
参数作用 Use the given as the commit message. If multiple -m options are given, their values are concatenated as separate paragraphs.