一 . 本地连接配置
1. 账号设置
git config --global user.name "test"
git config --global user.email "test@test.com"
2. 下载最新代码
git clone git@git.test-inc.com:bi_project/bi_sqls.git cd bi_sqls
3. 提交新增或者修改了的脚本 比如xxx.sql
git add xxx 也可以一次性把全部改动都提交了 git add . 提交并注释 git commit -m "modify xxx.sql" 如果涉及到删除文件夹, 需要执行git 删除命令 git rm test_dic
4. 推到线上库
git push -u origin master git stash #从线上拉取最新的代码 git pull 下载服务器代码 git add .添加当前目录下的所有文件; git commit -m '注释' 添加提交信息,提交代码到本地仓库 git push 上传代码至服务器仓库
二 分支管理
删除远程tag git push origin :refs/tags/201015_tag 拉取某个分支到本地 git clone -b stable_201130 git@git.test-inc.com:bi_project/bi_sqls.git 创建分支test git branch test 查看所有分支 git branch 删除远程分支 git push origin --delete test
三 合并分支到master
1. 下载master到本地
git clone git@git.test-inc.com:bi_project/bi_sqls.git
2. 创建分支 stable_201130
git branch stable_201130
3. 切换到分支1130
git checkout stable_201130
4. 修改代码上去
5. 上传分支
git add *
git commit -m "1130"
git push origin stable_201130
6. 同步分支到本地
git pull
7. 切换到主分支
git checkout master
8. 把分支merge到主分支
git merge stable_201130
9. 上传主分支
git push
每天进步一点点