3.9 KiB
3.9 KiB
<style>
.reveal strong {
font-weight: bold;
color: orange;
}
.reveal p {
text-align: left;
}
.reveal section h1 {
color: orange;
}
.reveal section h2 {
color: orange;
}
.reveal code {
font-family: 'Ubuntu Mono';
color: orange;
}
</style>
Working in Teams / Git Workflows
Why Workflows?
- Git offers a lot of flexibility in managing changes.
- When working in a team, some agreements need to be made however (especially on how to work with branches).
Which Workflow?
- There are standard solutions.
- It depends on the size of the team.
- Workflow should enhance effectiveness of team, not be a burden that limits productivity.
Centralized Workflow
- Only one branch: the
mainbranch - Keep your changes in local commits till some feature is ready
- If ready, directly push to
main; no PRs, no reviews - Conflicts: fix locally (push not allowed anyway), use
git pull --rebase - Good for: small teams, small projects, projects that are anyway reviewed over and over again
- Example: LaTeX papers
- Put each section in separate file
- Put each sentence in separate line
Feature Branch Workflow
- Each feature (or bugfix) in separate branch
- Push feature branch to remote, use descriptive name
- e.g. issue number in name if each branch closes one issue
mainshould never contain broken code- Protect direct push to
main - PR (or MR) with review to merge from feature branch to
main - Rebase feature branch on
mainif necessary - Delete remote branch once merged and no longer needed (one click on GitHub after merge)
- Good for: small teams, small projects, prototyping, websites (continuous deployment), documentation
- Aka. trunk-based development or GitHub flow
Gitflow
- Visualization by Vincent Driessen, from original blog post in 2010
mainanddevelopmaincontains releases as tagsdevelopcontains latest features
- Feature branches created of
develop, PRs back todevelop - Protect
mainand (possibly)developfrom direct pushes - Dedicated release branches (e.g.,
v1.0) created ofdevelop- Tested, fixed, merged to
main - Afterwards, tagged, merged back to
develop
- Tested, fixed, merged to
- Hotfix branches directly of and to
main - Good for: software with users, larger teams
- There is a tool
git-flow, a wrapper aroundgit, e.g.git flow init… but not really necessary IMHO
Forking Workflow
- Gitflow + feature branches on other forks
- More control over access rights, distinguish between maintainers and external contributors
- Should maintainers also use branches on their forks?
- Makes overview of branches easier
- Distinguishes between prototype branches (on fork, no PR), serious enhancements (on fork with PR), joint enhancements (on upstream)
- Good for: open-source projects with external contributions (used more or less in preCICE)
Do Small PRs
- For all workflows, it is better to do small PRs
- Easier to review
- Faster to merge –> fewer conflicts
- Easier to squash