Mac 配置自定义执行文件 pull.sh,push.sh

Mac 自定义可执行脚本

新建文件夹sh

mkdir sh

创建自定义sh

touch pull.sh
touch push.sh

写入内容

#!/bin/bash
# 一次性处理git拉取
#branch_name=`git symbolic-ref --short -q HEAD`
branch_name=$(git symbolic-ref --short -q HEAD)
git pull origin "$branch_name"
#!/bin/bash
# 一次性处理git提交
#branch_name=`git symbolic-ref --short -q HEAD`
branch_name=$(git symbolic-ref --short -q HEAD)
if [ ! -n "$1" ] ;then
commit="提交"
else
commit=$1
fi
git add .
git commit -m "$commit"
git push origin "$branch_name"

设为可执行

chmod +x pull.sh
chmod +x push.sh

配置环境变量

vim ~/.zshrc
# 自定义sh
export PATH="/Users/jiqing/sh:$PATH"
source ~/.zshrc
原文地址:https://www.cnblogs.com/jiqing9006/p/14934260.html