Git branching, merging and commit practices
How to fit a Git branching model to team size and release cadence, when long-lived environment branches earn their place, how merge, rebase, revert, amend and reset change history, and which commit habits keep a Salesforce repository reviewable and auditable.
Given a customer scenario, explain how source control branching/versioning/merging can be used and recommend appropriate strategies.
~8 min read · 11 practice questions ·
What the exam expects
- Recommend a branching model (GitHub flow with short-lived feature branches, GitFlow or trunk-based) from team size, release frequency and process tolerance.
- Decide when long-lived environment branches are justified, and how a Lifecycle Center (formerly DevOps Center) pipeline maps stages to branches.
- Predict what a merge, fast-forward or rebase does to history, and resolve a conflict without losing either side's work.
- Pick the safe way to undo or tidy commits:
git revertfor pushed work,commit --amendandreset --softonly before pushing. - Set commit, line-ending and ignore-file practices that make pull requests readable and history auditable.
Key terms: short-lived branch (created for one function and deleted once merged), recursive merge (creates a merge commit because the target moved on), fast-forward merge (moves the target tip; no merge commit), rebase (reapplies a branch's commits on a new base, rewriting history), atomic commit (one small, logical unit of change).
Key facts
- Detail
- Target has no new commits since the branch was created; no merge commit
- Detail
- Reapplies commits after the target's last commit; rewrites history
- Detail
- Use
git revert; amend and reset only before pushing
- Detail
core.autocrlf trueon Windows,inputon Mac or Linux
- Detail
- Merge not finalized; all branches stay as before
- Detail
- Custom promotion of selected approved work items
- Detail
- Deploy disabled behind a custom metadata type or custom setting flag
Sources for this section (4)
- Work with Your History in Gittrailhead.salesforce.com (opens in a new tab)
- Work with the GitHub Workflowtrailhead.salesforce.com (opens in a new tab)
- Promote Changes Through Your Pipelinehelp.salesforce.com (opens in a new tab)
- Operational Excellence - DevOps Patternsarchitect.salesforce.com (opens in a new tab)
- Why is
git revertthe right undo for a commit others have already pulled? - When does merging a pull request create a merge commit?
- When does a long-lived branch make sense?
- Which reset mode lets you squash several unpushed commits into one?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the Platform Development Lifecycle and Deployment Architect pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 26 lessons of the Platform Development Lifecycle and Deployment Architect guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Inline practice questions and one-click topic practice (11 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams