Gitflow
a premier for better Git collaboration
1. Developers Work In Branches
Why?
Branches are lightweight
(they aren't duplicates of master on disk)
SVN vs. Git Branches
(size of subversion branch)
SVN vs. Git Branches
(size of git branch)
Why?
Branches don't interrupt your teammates
Branch Naming—Features
feature/[story-number]-short-feature-name
Branch Naming—Bugs
bugs/[story-number]-short-bug-description
Branch Naming—Spikes/Random
spike/[story-number]-spike-name
Why Use a Slash?
[image of Tower folders]
* How to Make A Branch
git checkout -b feature/12-my-shiny-feature
* Developer 1 (Bob) Completes His Task
git add . && git commit -m 'commit message'
Now What? Depends:
- Code review
- QA
- Product manager validation
Often Review Will Include A Pull Request (PR)
More on PRs in a bit
2. Push Code to Repo For Review
git push
4. Merge Completed and Tested Features To develop Branch
What is develop?
- Branch fulled with completed, tested, yet-to-be released features
- Refers to staging environment
A Word On "Broken" Commits
- Feel free to commit broken code to your development branches
- Don't even think about merging broken code to develop
Squash Your Commits (or not)
git rebase -i HEAD~2
Backmerge First *
git checkout develop && git pull && git checkout [my-branch] && git merge develop
Then Merge Your Code *
git checkout develop && git merge [my-branch]
Time Passes
...and now we want to deploy to production
5. Merge Code to master Branch
What is master?
- Where the currently deployed, production application code lives
- Generally CI servers will deploy application directly from master
All Commits in Master Are Tagged
More on that soon
6. Merge to Master (But Backmerge First) *
git checkout master && git merge develop
7. Tag Your Commit
git tag -a v1.0 -m "my version 1.0"
git push origin v1.0
Gitflow
a premier for better Git collaboration