UnKnown UnKnown - 14 days ago 5
Git Question

Merge development branch with master

I have two branches namely

master
and
development
in a GitHub Repository. I am doing all my development in development branch as shown.

git branch development
git add *
git commit -m "My initial commit message"
git push -u origin development


Now I want to merge all the changes on the
development
branch into the
master
. My current approach is:

git checkout master
git merge development
git push -u origin master


Please let me know if the procedure I am following is correct.

Answer

I generally like to merge master into the development first so that if there are any conflicts, I can resolve in the development branch itself and my master remains clean.

(on branch development)$ git merge master
(resolve any merge conflicts if there are any)
git checkout master
git merge development (there won't be any conflicts now)

There isn't much of a difference in the two approaches, but I have noticed sometimes that I don't want to merge the branch into master yet, after merging them, or that there is still more work to be done before these can be merged, so I tend to leave master untouched until final stuff.

Comments