简体   繁体   中英

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

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.

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:

Hope it will help whover looking to merge ur branch to ur parent branch via command

git checkout planedtoMergeToThisBranch
Git merge developedBranchNeedToMerge -> (development ) Git status git push origin planedtoMergeToThisBranch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM