自动提交本地git仓库脚本
2024-09-06 13:24:48
#! /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
最新文章
- EasyUi 改变 selelct 的 下拉内容 div 的高度
- sqlite与android交互 (封装)
- 黑马程序员——【Java高新技术】——JavaBean、注解
- 网页二维码推广App的实现
- 详解 ManualResetEvent
- JAVA-面向对象-多态
- 算法杂货铺——分类算法之朴素贝叶斯分类(Naive Bayesian classification)
- Wince 文本函数和字体应用
- js在以div添加滚动条
- 从事务角度粗窥架构的可扩展性和可维护性:内容整理自java web轻量级开发面试教程
- 脱掉Golang的第一层衣裳 golang入坑系列
- 1. 生成三行文本,过滤文本,cp不覆盖,find查找文件,sed打印行,查看系统信息,磁盘分区
- 使用 MERGE 语句实现增删改
- jquery 倒计时效果
- SpringMVC最直观的流程图
- Qt学习--信号与槽(多窗口的实现)
- discuz 模板中使用方法和语言标签
- linux 文件压缩与解压
- Hadoop简单介绍
- easyui datagrid列使用按钮的一些心得 .
热门文章
- HMS Core使能AI智慧体验,共建创新应用生态
- 29. Divide Two Integers - LeetCode
- 806. Number of Lines To Write String - LeetCode
- 爬虫Ⅱ:scrapy框架
- 耗时半年,Eoapi 终于正式发布 API 工具的插件广场
- Redis配置文件所在位置
- 李呈祥:bilibili在湖仓一体查询加速上的实践与探索
- windiws下安装Composer
- sharepoint 配置失败,已引发类型为System.ArgumentException的异常。其他异常信息:domainName参数不支持指定的值。
- 重学ES系列之过滤数组