-
Notifications
You must be signed in to change notification settings - Fork 1
Git Flow
- master
- develop
origin/master
= HEAD is always production-ready
origin/develop
= HEAD reflects latest delivered dev changes for next release
- feature branches
- release branches
- hotfix branches
Notes
- Remember github does not recognize new branches until they are pushed, make sure to push to origin before working on a new feature branch
- Replace all
X.x.x
in commands below with appropriate version number - "git remote prune origin" to update local branches from upstream
Remove/Rollback Changes
git stash save --keep-index --include-untracked
git stash drop
Remove obsolete remote branches from local
git fetch -p
Fastforward older feature branch to be up-to-date with develop
git checkout feature
git merge --no-ff develop
General Naming Conventions
- "-" for spaces
- Keep it short
- Active tense for commit messages
- Commit messages should start with a single word identifier followed by - message such as
core - add classifier lambda to lambda state machine
Use token based naming convention
-
bug/*
- bug fixes -
feat/*
- new or expanding features -
wip/*
- long term works in progress -
junk/*
- throwaway -
infra/*
- infrastructure, refactor, cicd, etc
Use short description of the fix/bug for naming such as psycopg2-dep-fix
Follow Semantic Versioning standards (X.x.x)
X.y.z
X = MAJOR version when you make incompatible API changes
y = MINOR version when you add functionality in a backwards-compatible manner
z = PATCH version when you make backwards-compatible bug fixes.
Create a feature branch
git checkout -b myfeature develop
Incorporating a finished feature on develop
git checkout develop
git merge --no-ff myfeature
git branch -d myfeature
git push origin develop
Creating a release branch
git checkout -b release-X.x develop
./bump-version.sh X.X
NOTE: bump-version.sh doesn't exist, it is a placeholder for "changing everything that needs to be changed
for next release (i.e., replace all strings that say verion Y.y with x.x)
git commit -a -m "Bumped version number to X.x"
Finishing a release branch
git checkout master
git merge --no-ff release-X.x
git tag -a X.x
NOTE: -s to sign the tag cryptographically
git checkout develop
git merge --no-ff release-X.x
git branch -d release-X.x
Creating a hotfix branch
git checkout -b hotfix-X.x.x master
./bump-version.sh X.X
NOTE: bump-version.sh doesn't exist, it is a placeholder for "changing everything that needs to be changed for
next release (i.e., replace all strings that say verion Y.y with x.x)
git commit -a -m "Bumped version number to X.x
git commit -m "Fixed severe production problem"
NOTE: Do this after actually fixing the bug
Finishing a hotfix branch
git checkout master
git merge --no-ff hotfix-X.x.x
git tag -a X.x.x
NOTE: -s to sign the tag cryptographically
git checkout develop
git merge --no-ff hotfix-X.x.x
git branch -d hotfix-X.x.x