Git团队协作工作流程
2017-02-07 18:04
369 查看
以github的仓库为例,假定已经配置git并有了自己的github账号。
1,通过github,把团队代码仓库(Fork源)Fork一份到自己的github仓库;
2,从自己的github仓库clone代码到本地(开发用的电脑,Virtual machine..);
git clone git@github.com:Song2017/wordpress-azure.git(ssh key/http url)
3,新建一个分支,便于Fork源代码的管理
git checkout -b dev //新建并转到分支 dev
4,工作的代码应与团队保持一致,git remote update Fork源
git remote add upstream git@github.com:Source/joomla-azure.git //添加Fork源并设置别名upstream
git remote -v //查看本地仓库对应的远程仓库
//只会将本地库所关联的远程库的commit id更新至最新,代码不会更新,需要继续merge/rebase
git remote update upstream/git fetch upstream
git branch -a
git merge remotes/upstream/master
git pull upstream master //同步Fork源的代码至本地
5,Work with code in local repository.搬砖..
6,提交到自己的github仓库
git status // 查看代码的状态
git add . // 添加所有操作过的代码文件
git commit -m "comment"//统一提交并注释
git push origin dev //向自己的github仓库推送代码 origin:clone的地址git@github.com:Song2017/wordpress-azure.git
7,通过github,向Fork源提出push request.团队管理人进行代码merge。
Tips
a, 推送冲突
$git push origin master
To github.com:Song2017/joomla-azure.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:Song2017/joomla-azure.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
1,强制push
git push origin dev -f
2,创建分支
git branch [name]
git push origin [name]
3,查看修改过的code,修改掉冲突的代码
b,git 代码操作指令 远程地址 分支
git pull origin master
pull: 拉取远程仓库代码的指令
origin: 远程仓库的地址,默认为clone的仓库地址git@github.com:Song2017/wordpress-azure.git
master: 远程仓库的分支名称,默认为master
1,通过github,把团队代码仓库(Fork源)Fork一份到自己的github仓库;
2,从自己的github仓库clone代码到本地(开发用的电脑,Virtual machine..);
git clone git@github.com:Song2017/wordpress-azure.git(ssh key/http url)
3,新建一个分支,便于Fork源代码的管理
git checkout -b dev //新建并转到分支 dev
4,工作的代码应与团队保持一致,git remote update Fork源
git remote add upstream git@github.com:Source/joomla-azure.git //添加Fork源并设置别名upstream
git remote -v //查看本地仓库对应的远程仓库
//只会将本地库所关联的远程库的commit id更新至最新,代码不会更新,需要继续merge/rebase
git remote update upstream/git fetch upstream
git branch -a
git merge remotes/upstream/master
git pull upstream master //同步Fork源的代码至本地
5,Work with code in local repository.搬砖..
6,提交到自己的github仓库
git status // 查看代码的状态
git add . // 添加所有操作过的代码文件
git commit -m "comment"//统一提交并注释
git push origin dev //向自己的github仓库推送代码 origin:clone的地址git@github.com:Song2017/wordpress-azure.git
7,通过github,向Fork源提出push request.团队管理人进行代码merge。
Tips
a, 推送冲突
$git push origin master
To github.com:Song2017/joomla-azure.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:Song2017/joomla-azure.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
1,强制push
git push origin dev -f
2,创建分支
git branch [name]
git push origin [name]
3,查看修改过的code,修改掉冲突的代码
b,git 代码操作指令 远程地址 分支
git pull origin master
pull: 拉取远程仓库代码的指令
origin: 远程仓库的地址,默认为clone的仓库地址git@github.com:Song2017/wordpress-azure.git
master: 远程仓库的分支名称,默认为master
相关文章推荐
- Github 团队协作基本流程与命令操作 图解git工作流程
- [cnblogs镜像]Github 团队协作基本流程与命令操作 图解git工作流程
- 小团队Git协作流程
- 小团队Git协作流程
- Git教程 团队协作开发流程
- git团队协作流程
- git结合SourceTree的工作流程和两人协作的工作模型(仅供参考)
- 基于git版本控制团队协作流程
- 小议团队工作流程
- 用git工作的流程
- git多人协作开发流程(以blog为例)
- GitHub超详细图文攻略 - Git客户端下载安装 GitHub提交修改源码工作流程 Git分支 标签 过滤 Git版本工作流
- GitHub超详细图文攻略 - Git客户端下载安装 GitHub提交修改源码工作流程 Git分支 标签 过滤 Git版本工作流
- Git工作的一般流程
- git工作流程
- Git工作流程
- 利用git bash的工作流程
- git学习笔记 -- day01 原理、安装、工作流程、三种装态、设置个人信息
- git学习【2】Git基本工作流程和常用命令
- 使用Git工作的一般流程