自己的git使用

git是我们每天都会使用的工具,但是一般的使用还是直接通过几个简单的命令,例如:

1
2
3
git add .
git commit -m "..."
git push origin master

对于这种简单的步骤,我们每天都会重复无数次,所以巨懒如我就干脆搞个小脚本,直接点一下就提交了。。

一、Window使用bat脚本一键提交代码

直接新建文件,保存成.bat格式,编辑如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
title GIT提交批处理——小二三不乌
color 16


echo 开始提交代码到本地仓库
echo 当前目录是:%cd%

echo 开始添加变更
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
git add -A .
echo 执行结束!
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

echo;
echo 提交变更到本地仓库
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
set /p declation=输入修改:
git commit -m "%declation%"
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

echo;
echo 将变更情况提交到远程git服务器
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
git push origin master
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

echo;
echo 批处理执行完毕!
echo;

pause

二、编写Python脚本一键提交代码

额,用Python 好像就比较简单,但是还得cmd输一下,所以还是算了吧。。。