Integrating Before Starting New Work
You'll learn why pulling the latest changes before you start coding is essential to Continuous Integration.
The Core Practice
Before you begin any new feature or bug fix, you should always pull and integrate the latest changes from your team's mainline branch. This means running a git pull (or equivalent) and ensuring your local workspace includes all the work your teammates have committed since you last synced.
Think of it like this: imagine you're working on a shared jigsaw puzzle with friends. Before you start placing new pieces, you need to see what everyone else has already added. Otherwise, you might waste time trying to fit pieces in spots that are already filled, or build on an outdated picture of the puzzle.
Why This Matters
When you start work on an old version of the codebase, you're setting yourself up for painful merge conflicts later. The longer you wait to integrate, the more your code diverges from everyone else's. By pulling first, you:
- Start from the current reality of the codebase
- Discover conflicts early when they're easier to resolve
- Validate that recent changes haven't already addressed your task
- Reduce the integration burden when you're ready to commit
This practice reinforces the CI principle of integrating early and often. It shifts integration from a scary "big bang" event to a routine, low-risk activity.
The Workflow
Pull → Build → Run Tests → Start Coding
If the build or tests fail after pulling, fix those issues first. Never build on a broken foundation.
Key Takeaway: Always integrate the latest mainline changes before starting new work—it keeps you aligned with the team and makes your eventual integration smooth and conflict-free.