Merge two branches in one

Hi everyone,

I have a project on Gitlab where I have a master branche and a development branche, I have the same files in this two branches, when I need to fix bugs or implement new features in the apps, I just create a new branche from development branche and work in this branche, after that I do the commits and push of the changes to development. After that I merge this branche with my development branch and after that I do the merge again to the master branche.

My problem:
My team needs to create deafferents branches because they work on deafferents projects in same time, but all this apps stay in the same solution (ASP.Net MVC). I’m responsible to maintain the Gitlab repository and ensure the deploys using CI/CD.

Because that I need to do many merges to development branche and I do it for each branche that we have created. I’d like to know if possible I merge two different branches in after that do another merge to development branch.

Please look at the image below to understand:

Nowadays I use the case 1, my question is if the case two could be works

Thank you in advance !

Hello there, Im really sorry for bumping old thread, Im searching for similar information to fix my prob, did you fix your?

Yes, of course it’s possible. This is not really a matter of GitLab, but git.

You can merge any branch into any branch, all depends on your use case and what does make sense.

E.g. if you want to merge branch feature-1 into feature-2, you could do:

# make sure you have latest changes of feature-1 locally
git checkout `origin/feature-1`
git pull
# make sure you have latest changes of feature-2 locally
git checkout `origin/feature-2`
git pull
# merge feature-1 into your feature-2 branch
git merge feature-1
# push to GitLab
git push

Or, you can also do it over Merge Requests in GitLab - in that case you need to change the target branch to a proper receiving branch - in above case to feature-2.

Hope this helps.