使用UNIX环境下的bash脚本自动化提交仓库到github
2017-01-22 23:58
162 查看
我本人一直在写一些玩具代码的时候,有提交到github上备份的习惯,由于这个是我自己写的玩具代码,也不涉及到多个分支,所以每次都是机械的敲一串相同的命令,为了提高生产力,在Mac的UNIX环境下写一个bash脚本,自动化每次提交到github,我每次只需要执行这个脚本就行了,下面给出源码:
这个脚本大大提交了我的生产效率。
#!/bin/bash echo "start git add commit fetch merge push" echo "git add -A" git add -A echo "git commit -m 'leetcode-louyuting'" git commit -m 'leetcode-louyuting' echo "git fetch origin master" git fetch origin master echo "git merge origin/master" git merge origin/master echo "git push origin master:master" git push origin master:master
这个脚本大大提交了我的生产效率。
改进
上面的脚本没法设置commit的注释,采用的统一的注释,所以后面优化了下,采用动态设置commit注释的方式脚本如下:#!/bin/bash echo "git add ." git add . echo "git commit" echo "请输入commit的注释信息:" comment="commit new code" read comment git commit -m "$comment" echo "git fetch origin master" git fetch origin master echo "git merge origin/master" git merge origin/master echo "git push origin master:master" git push origin master:master
相关文章推荐
- 如何在同一台电脑使用不同的账号提交到同一个github仓库
- ubuntu16系统中pycharm下使用git将代码提交到github仓库
- github使用笔记(1)——初次向仓库提交代码
- 使用 eclipse+egit 将项目提交至 github ,本地的git仓库:eclipse工作项目目录
- 使用自动化脚本dpdk-setup.sh来搭建dpdk开发环境
- 如何使用git命令同步代码到github或提交到多个远程仓库
- 如何使用git在github上开发的时候和别人在别人仓库上进行协作编程,最后再统一提交
- git 使用注意事:将本地仓库代码提交到远端(这里使用的是github)
- 使用git工具提交上传代码到GitHub上或者远程仓库
- CentOS使用yum配置安装LAMP环境自动化脚本
- ubuntu16系统中pycharm下使用git将代码提交到github仓库
- 使用gitbash上传代码到github远程仓库简单教程
- 在Fedora下自动配置Java开发环境的bash脚本(适用于使用bash终端的Linux)
- 使用git命令提交远程github仓库的时候提示"rejected"(拒绝)解决办法
- 使用shell脚本自动化配置工作环境
- 使用BASH编写Linux Shell脚本——前言
- 使用脚本设置全局环境变量
- 多线程、多平台环境中的跟踪 - 使用 log4j 和 UNIX 命令来挖掘跟踪数据
- 使用Bash编写Linux Shell脚本-2.使用外壳语言
- 使用BASH编写Linux Shell脚本——1. Linux 介绍