I have a development branch and a production branch. I push changes from my development server to a remote gitlab install. Then I login to gitlab GUI and do a merge request (which is quite time consuming). Then I "git pull origin production" from my production server.
The merge request step kind of takes a long time to do. Is there a faster way to do this? Could I just make a bash/shell script to merge development into production and pull down the updates with one command? If so what commands is this merge request running?
I make merge requests a couple times a day. Anything to speed up the process I have would be great.
A developer must log into the GitLab web application and create a merge request, specify the branch they're working on as the source and the master branch as the target. A user with rights to merge or push into the master branch is then set as the “assignee” before the merge request is initiated.
Fast forward merge can be performed when there is a direct linear path from the source branch to the target branch. In fast-forward merge, git simply moves the source branch pointer to the target branch pointer without creating an extra merge commit.
The git merge command integrates the independent lines of development into a single branch. The command is used to combine two branches and also to merge multiple commits into one history. Once you make changes in the local repository and ready to share it with your team members, then execute git push.
Recursive. This operates on two heads. Recursive is the default merge strategy when pulling or merging one branch. Additionally this can detect and handle merges involving renames, but currently cannot make use of detected copies.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With