git flow 实战

 

 

1.情形一

刚来新公司,你开始有任务了

 

1).fork 项目地址

gitlab or github 进行fork操作

 

然后git clone fork地址

git clone upstream upstream_repository.git

 

添加 公司代码库的upstream

git remote add upstream upstream_repository.git

 

2).更新到最新代码

git pull upstrem

 

3).新建一个分支开始开发

git checkout upstream/branchName git checkout -b branchName git merge upstream/branchName

 

4).开发完成,push项目并合并到qa分支待提测

git push

fork 项目发起merge request

结束啦,把merge request 提给测试

 

情形二

你需要部署一下项目代码,但是你只能部署公司的代码库

git clone upstream_repository.git

 

git ls-remote upstream|grep mrid

 

git pull origin refs/merge-requests/153/head 上一步的内容

 

耶✌️

基本命令

1.upstream repository是你的上游仓库,你没有提交的权限

 

2.fork repository 是你fork的仓库,所以你的权限很足。(图形界面fork 操作)

git clone fork_repository.git

 

3.添加upstream 仓库地址作为upstream,

git add remote upstream upstream repository address

 

4.因为fork的地址clone的时候会被添加 orgin,如下命令查看 会有2个地址

git remote -v

 

5.如何push fork repository

git push origin(origin 可省略)

 

6.如何push upstream (无法直接push,但是提交mr)

登录fork 项目发起merge request

 

7. 如何同步upstream 的代码

git pull upstream

8.如何合并upstream的代码

git merge upstream/branchName

 

9. 来了一个需求 你创建了一个分支

git chekcout -b xxx

 

10.切换到upstream分支

git checkout upstream/develop

 

 

相关文章:

  • 2021-08-30
  • 2018-04-03
  • 2021-11-23
  • 2021-11-23
  • 2021-06-22
  • 2021-07-26
  • 2021-09-12
  • 2021-12-19
猜你喜欢
  • 2021-10-03
  • 2021-06-26
  • 2021-05-20
  • 2021-04-22
相关资源
相似解决方案