- A good free Git GUI - http://www.sourcetreeapp.com/
- A good set of tutorials - https://www.atlassian.com/git/tutorials/
- We follow the Feature Branch Workflow.
- All code modifications are done in their own dedicated branch.
- When the new code is ready, a code review is given. Any code review back and forth are done in the feature branch.
- Finally, the new code branch is merged back into master.
git checkout -b new-feature # make a new branch
# make changes
git commit -am "my message" # commit changes
git push origin new-feature # push to new remote branch
# (only first time pushing)
This is to update the feature branch (both local and remote) with the latest changes from master and to eliminate any merge conflicts when merging back into master.
git checkout new-feature # go to feature branch
git merge master # merge master into this branch
# fix any merge conflicts
git commit # commit the merge
git push # push to remote branch
This can be done by a different person, for example, the code reviewer who approved the branch. (Note: This assumes the remote feature branch is up-to-date from the previous step.)
git checkout master # go to master
git pull # make sure your local master is up-to-date
git pull origin new-feature # merge remote feature branch into local master
git push # push local master to remote master
The feature branch (both local and remote) are now completely merged into master and have no more unique changes in them so it is now safe to delete them.
git checkout master # go to master (get out of that feature branch)
git branch -d new-feature # delete local feature branch
git push origin :new-feature # delete remote feature branch
Nop Jiarathanakul, [email protected]