-
Notifications
You must be signed in to change notification settings - Fork 0
Git Best Practices
Michael Palumbo edited this page Nov 16, 2021
·
8 revisions
Main Branch
- Never code on main
- Always is release-ready (anyone can clone/download and it works)
- only merge develop into main when the team agrees (suggest always opening a github issue to resolve this)
Develop Branch
- Never code on develop
- Should always build & work
- feature branches fork from here (i.e. on branch 'develop' do:
git checkout -b nameOfNewBranch
then develop on that branch and merge only working changes into the develop branch
Feature Branches
- try to limit scope to smaller change(s) To create one:
# always create feature branch from the develop branch (never from main)
# so on branch 'develop'
git checkout -b nameOfNewBranch
# now set github.com to track this branch (so others can access it too)
git push -u origin nameOfNewBranch
Branching Workflow:
- Always make changes on a feature branch, only
- when ready to move changes to develop branch:
- merge develop into feature
git merge develop feature
- resolve any new conflicts, commit
- switch to develop
git checkout develop
- merge feature into develop
git merge feature develop