# Branch out `module1` from `develop` $ git checkout -b module1 develop
# Make some changes $ mkdir new_module $cd new_module $ touch file1 file2 file3 $cd ..
# Add & Commit $ git add new_module $ git commit -a -m "- added new module"
# Show all branches you have $ git branch
# Switch to `develop` $ git checkout develop
# Merge with branch `module1` $ git merge --no-ff module1
# Delete `module1` branch $ git branch -d module1
# push to remote server $ git push origin develop
4. Everything tested fine, merge to master branch
1 2 3 4 5 6 7 8
# Switch to `master` $ git checkout master
# Merge with branch `develop` $ git merge --no-ff develop
# Push to remote server $ git push origin master
If you work on only a single branch, consider a situation here:
Now you have assigned a new module, you work on the new module. Suddenly, the life copy got some bugs that need you to be fix urgently, but now you’re working on the new module which is not yet complete.
Imagine the situation above happened, it may take you a lot of time to handle this. Thus use the branching model to avoid this situation happen.