We have created 'dev' branch from the 'master' and have been working on the 'dev' branch. We have not merged the 'dev' to 'master' yet. Also at the same time we have created 'preprod' branch from the 'master' and working on the 'preprod' branch changes. We have not merged the 'preprod' to 'master' yet.
Now what we are trying to achieve is to merge the 'preprod' changes alone to 'dev'. I tried this by creating a merge request through Gitlab and approved it. What I found is the changes in the 'dev' code was also moved to 'preprod' and vice versa. I do not want the 'dev' changes to be moved to the 'preprod' by any chance. How can i accomplish this ?
Use git to merge master into the branch. View a directory listing to validate files from master have been moved to the feature branch. View the Git reflog to validate that a master merge commit is registered. Push the merged feature branch back to the GitLab server.
To merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch. Next, use git merge and specify the name of the other branch to bring into this branch. This example merges the jeff/feature1 branch into the main branch.
Git merge will combine multiple sequences of commits into one unified history. In the most frequent use cases, git merge is used to combine two branches.
If you got changes on both, it is likely that your merge request told gitlab to merge the two branches into each other, which is sometimes desirable. Depending on your development process, you may find it easier to use git itself (or a gui for it, for example git extensions or sourcetree) to do your merges. GUI versions do a good job of visually showing your branches and past merges, which makes it a lot easier to figure out which commands to run.
From the command line, after you revert to a commit before the gitlab merge, check out the dev branch and merge preprod into it:
git checkout dev
git merge preprod
The preprod changes will be made on dev but not vice versa (don't forget to push dev). The git merge command's effect is to merge changes from the named branch in the command (preprod) INTO the CURRENT branch (in this case dev, but you can verify the current branch running "git branch" or "git status").
Links to the git tools I mentioned: git extensions: https://sourceforge.net/projects/gitextensions/ SourceTree: https://www.sourcetreeapp.com/
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