git 添加远程分支,并可以code review.

这里写图片描述

需要以common repo (gitlab)中的某个branch( remote_xxx)为基础,建立要添加的branch (new_xxx), 假设远程自己的repo为(origin)

如果远程repo name为 gitlab.则:

  1. git checkout gitlab/remote_xxx -t -b remote_xxx(把远程的code拉到本地)

  2. git checkout -b new_xxx(切换到需要提交的分支)

#以上也可以一步到位:git checkout gitlab/remote_xxx -t -b new_xxx

  1. git push gitlab new_xxx(将分支递交到远程公共库)

  2. #这个时候就可以以这个为基础,进行修改,然后review了。

  3. #本地new_xxx进行了部分修改后,如下进行递交。

  4. git add xxx

  5. git commit -m "xxx"

  6. git push origin new_xxx (将分支递交到远程自己的库)

  7. #从gitlab 页面进行merge request,选择需要merge到的远程分支。就可以比较了,最后进行code review 了。

原文地址:https://www.cnblogs.com/qianggezhishen/p/7349367.html