develop分支合併到release分支
develop -> release
Check out, review, and merge locally
Step 1. Fetch and check out the branch for this merge request
git fetch origin
git checkout -b develop origin/develop
Step 2. Review the changes locally
Step 3. Merge the branch and fix any conflicts that come up
git fetch origin
git checkout origin/release
git merge --no-ff develop -> 會產生一個不屬於任何分支的HEAD
Step 4. Push the result of the merge to GitLab
git push origin release
😱 一般都會卡在第四步的 git push origin release
會得到一個提示,讓你切到一個指定分支
解決辦法:
git fetch origin
git checkout origin/release
這時候HEAD會被追加到這個release分支上
如果有衝突就解決衝突並commit
沒有衝突和變化也是正常的,因爲已經被提到commit裏面了
這時候你只需要執行 “推送” || push
就成功了(當然,也可能提示無權限之類)
detached HEAD state參考文章