How to script GIT MERGE commands to automate it in GitLab -


my requirement little different regular branch merge.

branches in local , server repo -> branch-1, branch-2 & master

  • on event of…

    creating merge request.

    pushing changes head/source branch

    pushing changes base/target branch

…do…

attempt merge of head/source onto target. 

eg: (git clone target, git remote add source..., git fetch source. git checkout -b attempted-merge; git merge..)

push new ref repo “refs/merge-requests/{id}/head” (git push origin target/:merge-requests/{id}/head)

if there no merge conflicts, push “refs/merge-requests/{id}/merge” (git push origin attempted-merge:merge-requests/{id}/merge)

comment on merge request status (using :+1: or :-1: include vote of approval)

in process creating new branch called attempted-merge. branch while pushed should not pushed server instead should given new refs name (eg: refs/merge-request/{id}/merge).

so contains merge not been pushed server instead stored in temporary location can been seen in local repo not in remote repo. because of validating merge , authorizing merge happen if correct (means if code there expected , ready clean merge). once approved merged on remote repo.

this scenario have right now. not able understand how in script , make automate script should run when merge requested.

inputs script are

source url, source branch, target url & target branch.

once these given script should run , depending on input values should perform merge in gitlab.

can 1 me out how .. !!!!


Comments