背景
代码用git管理,所以需要大家熟悉git工具的一些操作
目前我们自动化在develop分支上进行编写
前言
安装git,https://git-scm.com/
可视化工具推荐,sourcetree,https://www.sourcetreeapp.com/
准备工作
git拉取代码分两种协议,一种http,一种ssh,推荐大家用ssh协议。
http协议避免输入账号密码:http://www.cnblogs.com/ballwql/p/3462104.html
ssh协议生成key:http://www.asheep.cn/skill/git-ssh-key.html
git config --global user.name
"test"
git config --global user.email
"test@gmail.com"
ssh-keygen -t rsa -C
"test@gmail.com"
|
git简单命令
ssh协议拉取代码
git clone git
@gitlab
.xxxx.com:we-media/xxxxx.git
|
查看当前分支
git branch
|
切换分支
git checkout develop
|
push代码
//拉取最新的代码
git pull
//添加新增/修改的文件
git add
//提交刚刚添加的改动
git commit -m
"this is commit"
//推送代码到远程分支
git push
|
解决冲突
//提交本地代码
git commit -m
"this is commit"
//拉取最新的代码
git pull
//自动merge成功,不用做任何操作
//自动merge失败,会提示哪个文件冲突,打开指定文件解决冲突后再commit即可
|
更多细节:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000
合并分支
git merge <branch>
合并branch到当前分支
虽千万人,吾往矣!