Version Control Flashcards
What is a Monorepo?
A repository model where one giant repo contains all microservices. Any commit triggers the production of multiple microservices.
What is a Multirepo?
A repository model where each service has its own repo. Any commit triggers the production of a single service.
What is the purpose of branching in version control?
Branching allows developers to develop and test new ideas away from the main system.
What is Feature-Based Development?
A branching model where developers create new branches based on project needs. Developers may use long-lived feature branches that are merged back into the main branch weeks or months later.
What is Trunk-Based Development?
A branching model where developers work on a single main branch. Developers may create short-lived feature branches, but they are merged back after a few minutes.
Why should commit tests be run locally before committing code?
To refresh the local copy of the project and prevent breaking the build, which slows down other developers.
Why should developers wait for commit tests to complete?
Monitoring commit test progress ensures that failures can be resolved quickly, as tests run automatically in script files with thousands of tests.
Why should developers avoid committing on a broken build?
New changes added to a broken build can cause compounding failures, making debugging much more difficult.
Why should developers never go home on a broken build?
The developer who introduced the issue is likely the only one who knows how to fix it quickly. A broken build can prevent other developers from working.
Why is it common practice to commit at the start of the day rather than the end?
So that if a build breaks, the developer is available to fix it instead of leaving it for others.
What does it mean to be ‘prepared to revert’ in version control?
Like a ‘go around’ in aviation, a revert means rolling back to a safe build if changes fail, lowering the cost of change.
Why should developers avoid commenting out tests?
Commenting out tests is bad practice as it prevents future bugs from being detected.
What does ‘taking responsibility for breakages’ mean in version control?
If a commit breaks tests (even those written by others), the developer who committed must resolve the issue.
What are the three benefits of a version control system according to D. Farley?
- Step back to safety
- Share changes easily
- Store changes somewhere safe
What are the three models of version control?
- Mono-repo - everything in one big repository
- Multi-repo - independent things in separate repositories
- Multi-repo’ - interdependent things in separate repositories
Why does a mono-repo provide the three benefits of version control?
Because it allows:
1. Stepping back to safety - by stepping back all components
2. Sharing changes easily - by changing any component
3. Storing changes safely - by saving all components together
Why might a multi-repo not provide the three benefits of version control?
Because communication between components and version specifications are not stored anywhere.
What are two solutions to the multi-repo problem?
- Use fixed, well-understood APIs
- Use flexible, backwards/forwards compatible APIs
How do the solutions to the multi-repo problem restore the three benefits of version control?
- Step back to safety - by stepping back any component
- Share changes easily - by coordinating updates (though not easy)
- Store changes safely - by storing components separately
Why is ‘multi-repo’’ considered the worst of all worlds?
Because components cannot be developed or deployed independently.