简体   繁体   中英

Gitlab Merge local branches

I have three branches master , env1 and env2 . env1 has some changes and merged into master without conficts.

env2 also has some changes but getting merge conflicts when created merge request. I have resolved the confilcted files and commited in env2 but before creating merge request I want to check the whole functinality if code breaks or not, is it possible to merge env2 to master locally without creating a merge request in the main repo?

Of course it is possible to merge local branch env2 into the local master branch.

(env2) $ git checkout master
(master) $ git merge env2

Now, your local master branch is ahead of origin/master . You didn't yet pushed the changes to the origin/master . If your local changes are the good ones, then you can just do git push origin master to sync origin/master with you local master . If your local changes are the bad ones, then just remove them or reset your local master to the state on remote git reset --hard origin/master .

However, in a good workflow your local copy of master is just a copy of the one in remote, so you should never do these kind of things like merging to the local master .

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