您的位置:首页 > 其它

git基础操作

2015-09-30 09:31 337 查看
git操作之PD篇:
―――――――――――――――――――――――――――――――――
1. 本地什么都没有的时候~~~~~
a.
git clone git@git.corp.xx.com:_java_crm/w_one.anjuke.com #Clone远程版本库

b.
$ git init #初始化一个版本仓库
$ git remote add origin git@git.xx.com:_java_crm/w_one.xx.com #添加远程版本库
#语法为 git remote add [shortname] [url]
$ git fetch origin #抓取远程仓库
#语法为 git fetch [shortname], 默认使用origin

2.operate pmt1001项目(先让QA拉对应项目分支:pmt1001)
$ git fetch ―-all #fetch所有连接仓库
$ git checkout pmt1001 #切换至pmt1001分支

3. 开发完成提交远程
$ git fetch
$ git rebase pmt1001
$ git rebase release #在对应的分支上rebase到release
#可能会有冲突,解决完后再继续
$ git add . #将所有修改过的工作文件提交暂存区
$ git commit -am 'msg…’ #提交本地代码
$ git push --force origin pmt1001

4.线上bug,在hotfix分支上修复完毕之后
$ git fetch ―-all
$ git rebase master
$ git add .
$ git commit -a -m 'fix ga bug'
$ git push origin hotfix:hotfix
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: