This is the first time I am using Git Hub. So please co-operate with me.
I am working on an iOS project with another developer. Now since we are working on 2 different functionalities, I thought making separate branches for each developer is good way. So my plan in to follow below steps
-
Create a local branches named
functionality1from the current one usinggit checkout -b functionality1 -
Commit my code in
functionality1branch -
Push that branch to the remote using
git push origin functionality1This will add my branch to remote server. I need branches on remote because I can work from anywhere.
-
I will merge it in Master branch using
git checkout master git merge functionality1 -
Now
functionality1is merged intomasterbranch (provided no conflicts occurred)
Other developer will follow same steps.
We don’t want to delete the branches yet.
Now once both branches are merged into master, how can each developer will get the merged code from master branch into their respective branches (functionality1 & functionality2) & then continue on working on same branch (functionality1 & functionality2)?
IMHO you shouldn’t unless you really need the new functionality. Because by merging e.g.
masterback intofunctionality1you make it dependend upon the other feature branch. A good read is thegitworkflows(7)man-page.