0
点赞
收藏
分享

微信扫一扫

Git 的一键三连


在使用 Git 时,最常用的莫过于 add -> commit -> push 三步操作了。但是对于懒惰的程序员来说,一遍遍地敲简直就是灾难!

除了按 ↑ 方向键,有没有办法实现一键三连? 😎

噔噔!写个脚本 git-push.sh,如下:

#!/bin/bash

if [ -z "$(git status --porcelain)" ];
then
echo "IT IS CLEAN"
exit 0
fi

echo "Enter your message"
read message
if [ -z "${message}" ];
then
message="update"
fi

git add .
git commit -m"${message}"
echo "Pushing data to remote server!!!"
git push -u origin master

exit

增加执行权限:

chmod

为方便使用,把它放到系统路径下:

sudo cp

赶紧试一下吧

LetsGit$ git-push.sh 
Enter your message
记得 点赞、投币、收藏!


举报

相关推荐

0 条评论