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

You can merge changes without going through a UI - this is one of the core functionalities of Git. Assuming you have two branches (development and production), here's how you would merge 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 log into the production server and pull the changes there.

You could of course put the above checkout/merge/push steps into a script - that's quite common to do.

There are ways to automatically pull changes when something changes. Here are a couple of links for you:

  • Git: auto pull from repository?
  • https://johnflynn.me/autodeploy-your-gitlab-projects/