gitlab 合并分支到master分支

一、新建一个gitlab仓库后

You can also upload existing files from your computer using the instructions below.

Git global setup
git config --global user.name "Administrator"
git config --global user.email "admin@example.com"
Create a new repository
git clone git@192.168.40.132:root/ops.git
cd ops
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Push an existing folder
cd existing_folder
git init
git remote add origin git@192.168.40.132:root/ops.git
git add .
git commit -m "Initial commit"
git push -u origin master
Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin git@192.168.40.132:root/ops.git
git push -u origin --all
git push -u origin --tags

 推送代码结束

二、新增分支要的合并代码

1、clone主分支代码

git -c http.sslVerify=false clone  git@192.168.40.132:root/ops.git

(http.sslVerify=false禁用Git SSL验证)

2、切换到一个新分支 'release-1.0'

git checkout -b release-1.0

3、修改代码

vi test.py

4、推送到代码仓库

git add .  #(本地提交更新)
git commit -m "release-1.0"  #(将代码远程推送到 release-1.0分支当中)
[release-1.0 f23169b] release-1.0
2 files changed, 3 insertions(+), 6 deletions(-)
create mode 100644 test.py

git -c http.sslVerify=false push origin release-1.0
remote:
remote: INFO: Your SSH key is expiring soon. Please generate a new key.
remote:
Counting objects: 12, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 578 bytes | 0 bytes/s, done.
Total 7 (delta 4), reused 0 (delta 0)
remote:
remote: To create a merge request for release-1.0, visit:
remote: http://192.168.40.132:9090/root/ops/-/merge_requests/new?merge_request%5Bsource_branch%5D=release-1.0
remote:
To git@192.168.40.132:root/ops.git
* [new branch] release-1.0 -> release-1.0

5、将release-1.0分支的代码合并到master分支

点击“Create merge requests”

 或者

 

 6、创建一个合并请求,选择源分支和目标分支

7、添加描述,指明谁来review操作合并这项工作

 8、操作账号查看merge请求

9、查看与目标分支的差异变化

10、点击Merge即同意合并请求

11、查看合并效果,'release-1.0‘分支被合并,master分支代码发生改变

 

暂存问题:

当其他账号提交的merge请求不满足代码规范要求时,可以不用打回,直接修改吗?然后合并

posted @ 2022-01-18 21:56  凡人半睁眼  阅读(6350)  评论(0编辑  收藏  举报