1. 程式人生 > 其它 >gitlab 合併分支到master分支

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 "[email protected]"
Create a new repository
git clone [email protected]: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 [email protected]: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 [email protected]:root/ops.git
git push -u origin --all
git push -u origin --tags

推送程式碼結束

二、新增分支要的合併程式碼

1、clone主分支程式碼

git -c http.sslVerify=false clone  [email protected]:root/ops.git

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 [email protected]: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分支程式碼發生改變