我自己有时候会忘记pull就commit了,然后merge会有别人的文件,容易代码混乱。写个脚本就绝不会出问题了。
执行顺序 git add
– git stash
– git pull
– git stash pop
– git commit
– git push
@echo off
chcp 65001
title GIT 一键提交
color 0D
echo 当前目录%cd%
@echo on
::设置环境变量,能调起git bash
set PATH=%PATH%;C:\Program Files\Git\cmd
::自定义设置目标目录
D:
cd D:\bat
echo 添加文件:git add .
git add .
echo 暂存代码:git stash
git stash
echo.
echo 拉取代码:git pull
git pull
echo.
echo 取出代码:git stash pop
git stash pop
echo.
set /p message=请输入提交信息
git commit -m "E45678 projectname %message%"
git push
@echo off
echo 推送成功