as uses Git command to create a remote or local library code merge

If you have opened a project with a specified fork branch in as and want to merge the specified branch of the main creative library of the fork, if there is a conflict in the merge request in gitlab, a merge locally button will be displayed, click the change button and a pop-up window will pop up:

You can follow the git command in the above figure in the terminal of as:

step 1. Fetch and checkout the branch of this merge request

git fetch "https://gitlab.xxxxx/xxxx/app-android.git" main
git checkout -b "xxxx/android-main" FETCH_HEAD

step2. View local changes

Step 3. Merge the branch and fix any conflicts that arise

git fetch origin
git checkout "main"
git merge --no-ff "xxxx/android-main"

Step 4. Push the merged result to GitLab

git push origin "main"

After passing the above steps, a new android-main branch will be added, which is the main library branch that needs to be merged. The background needs to merge the local branch in as first, and the following two instructions can be used

1. Switch the local remote database creation: git remote set-url origin https://.git

2. Track the specified remote creation branch: git branch --set-upstream-to=origin/<branch> origin/<remote branch>,

If an error is reported: the requested upstream branch 'origin/alpha' does not exist, then enter the command git fetch, and then enter the tracking command again

Guess you like

Origin blog.csdn.net/weixin_44715716/article/details/122996997