Fastest way to merge branches via gitlab (or git)?

I have a development branch and a manufacturing branch. I am pushing changes from my development server to a remote gitlab installation. Then I go into the gitlab GUI and make a merge request (which is quite time consuming). Then I "git pull the original production" from my production server.

The merge request step step takes a long time. Is there a faster way to do this? Can I just create a bash / shell script to merge development into production and push updates with a single command? If so, what commands does this merge query run?

I do merge requests a couple of times a day. Anything that will speed up the process I have will be great.

+3


source to share


1 answer


You can merge changes without going through the UI - this is one of the core features of Git. Assuming that you have two branches ( development

and production

), here you can merge the changes:

# Check out development branch
git checkout development

# Make changes, commit...
...

# Optional: Push development changes to the remote
git push origin development

# Check out production branch
git checkout production

# Merge the changes from the development branch
git merge development

# Push the changes to the remote
git push origin production

# Check out the development branch again
git checkout development

      

Now go to the production server and pull the changes there.



You could of course put the above checkout / merge / push operations in your script - this is quite common.

There are ways to automatically change changes when something changes. Here are some links for you:

+5


source







All Articles