Approach to merge feature branch to development branch

Saibal Roy • November 15, 2020

git quick-tips

Well this approach is what i found while working on adding a pwa feature branch to the development branch of a web app and obviously i don't want anything to break up and screw my weekend 😏 😏 but also want the lovely feature to be up and running.

Cool! now let's dive into some action.

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b "feature-pwa" "origin/feature-pwa"

Step 2. Review the changes locally. Cool that part is super easy as i trust my team a lot and also hurry to finish up the work for the weekend 😀. Enough! let's get back to some serious work.

Step 3. Merge the branch and fix any conflicts that come up:

git fetch origin
git checkout "origin/development"
git merge --no-ff "feature-pwa"

Note: A quick tip if conflicts occurs then have the visual studio code which is a real time saver with its cool git features in the editor itself and after removing the conflicts you can do the following:

git add .
git merge --continue

Step 4. Push the result of the merge:

git push origin "development"

Happy learning folks!