A guide for developers on using version control system.
- Use
_or-as separations for repo and branch names. - Always start your work at new branch.
- Choose rebase and merge respective to branches.
- Maintain separate branch for development, staging and production.
- Provide proper tags and release versions.
Create a local feature branch based off master.
git checkout master git pull git checkout -b <branch-name> Rebase frequently to incorporate upstream changes.
git fetch origin git rebase origin/master Resolve conflicts. When feature is complete and tests pass, stage the changes.
git add --all When you've staged the changes, commit them.
git status git commit --verbose Write a good commit message. Example format:
Present-tense summary under 50 characters * More information about commit (under 72 characters). * More information about commit (under 72 characters). http://project.management-system.com/ticket/123 If you've created more than one commit, use git rebase interactively to squash them into cohesive commits with good messages:
git rebase -i origin/master Share your branch.
git push origin <branch-name> Submit a GitHub pull request.
Ask for a code review in the project's chat room.
- Avoid including files in source control that are specific to your development machine or process.
- Delete local and remote feature branches after merging.
- Perform work in a feature branch.
- Rebase frequently to incorporate upstream changes.
- Use a pull request for code reviews.
- Each
pull requestshould pass code review and unit test before merging tomasterbranch. - Make use of labels to define the type of PR (Feature, Bug, Enhancement and so on).
- Always get both code and feature reivew from previous developer of the file for new changes.
- Make sure to run unit test in master branch after merging feature branch.
Try to use these commands frequently while developing.
git fetch origin git checkout master git pull origin master git rebase -i master (In feature branch) Download Git Cheat Code in pdf format and practice regularly.
Follow these techniques or best practices to maintain continues development and release
- Maintain one or more stable branch to release at any time instance.
- Run unit and feature driven test on each and every PR.
- Assign code reviewers for each module or set of developers.
- Block user's push to stable remote branch.
- Use automation jobs for continues testing and deployment process.