自动提交本地git仓库脚本
#! /bin/bash git_user_name=`git config user.name` git_user_mail=`git config user.email` branch_name="local" remote_alise=`git remote | tail -1` remote_url="" is_init=0 noupdate_filename=".gitignore" if [ -r "./.git" ] then is_init=1 fi if [ ! $git_user_name ] then echo "请输入git user.name:" read git_user_name echo "请输入git user.email:" read git_user_mail fi if [ $remote_alise ] then remote_url=`git remote get-url --push $remote_alise` else echo "创建git别名,请输入别名:" read remote_alise echo "请输入别名对应的url(ssh):" read remote_url fi git config --global user.name $git_user_name git config --global user.email $git_user_mail git init if [ ! -e $noupdate_filename ] then echo -e "*.noupload/\n*.noupload\n*.noupload.sh" > $noupdate_filename fi git remote add $remote_alise $remote_url git pull $remote_alise master git branch $branch_name git checkout $branch_name echo "Status:" git status echo "Branch:" git branch -v echo "Remote:" git remote -v if [ $is_init == 0 ] then echo "是否进行首次提交(Y/N)?:" read ch if [ $ch == "Y" ] || [ $ch == 'y' ] then git add ./* git commit -m "First commit" git push $remote_alise $branch_name fi else echo "是否进行提交(Y/N)?" read ch if [ $ch == "Y" ] || [ $ch == 'y' ] then git add ./* echo "请输入提交说明:" read des git commit -m des git push $remote_alise $branch_name fi fi
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
· 上周热点回顾(2.17-2.23)