# Git branching, merging and commit practices

*Platform Development Lifecycle and Deployment Architect Study Guide · Building · Last updated October 26, 2026 · https://www.certifyforce.com/study-guide/platform-development-lifecycle-and-deployment-architect/building/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.

- Certification: Salesforce Platform Development Lifecycle and Deployment Architect
- Exam section: Building
- Study guide: https://www.certifyforce.com/study-guide/platform-development-lifecycle-and-deployment-architect

**Official exam objective:**

> Given a customer scenario, explain how source control branching/versioning/merging can be used and recommend appropriate strategies.

## 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 revert` for pushed work, `commit --amend` and `reset --soft` only 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

| Fact | Detail | Source |
|---|---|---|
| Fast-forward condition | Target has no new commits since the branch was created; no merge commit | [Work with Your History in Git](https://trailhead.salesforce.com/content/learn/modules/git-and-git-hub-basics/work-with-your-history-in-git) |
| Rebase | Reapplies commits after the target's last commit; rewrites history | [Work with Your History in Git](https://trailhead.salesforce.com/content/learn/modules/git-and-git-hub-basics/work-with-your-history-in-git) |
| Pushed commit to undo | Use `git revert`; amend and reset only before pushing | [Work with Your History in Git](https://trailhead.salesforce.com/content/learn/modules/git-and-git-hub-basics/work-with-your-history-in-git) |
| Line endings | `core.autocrlf true` on Windows, `input` on Mac or Linux | [Work with the GitHub Workflow](https://trailhead.salesforce.com/content/learn/modules/git-and-git-hub-basics/work-with-the-git-hub-workflow) |
| Failed promotion deploy | Merge not finalized; all branches stay as before | [Promote Changes Through Your Pipeline](https://help.salesforce.com/s/articleView?id=platform.devops_center_promotion_overview.htm&type=5) |
| Partial release in a stage | Custom promotion of selected approved work items | [Promote Changes Through Your Pipeline](https://help.salesforce.com/s/articleView?id=platform.devops_center_promotion_overview.htm&type=5) |
| Unfinished high-risk work | Deploy disabled behind a custom metadata type or custom setting flag | [Operational Excellence - DevOps Patterns](https://architect.salesforce.com/docs/architect/well-architected/guide/operational-excellence-devops-patterns.html) |

## Check yourself

- Why is `git revert` the 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?

## Sources

- [Work with Teams in GitHub](https://trailhead.salesforce.com/content/learn/modules/git-and-git-hub-basics/work-with-teams-in-git-hub)
- [Work with Your History in Git](https://trailhead.salesforce.com/content/learn/modules/git-and-git-hub-basics/work-with-your-history-in-git)
- [Work with the GitHub Workflow](https://trailhead.salesforce.com/content/learn/modules/git-and-git-hub-basics/work-with-the-git-hub-workflow)
- [Operational Excellence - DevOps Patterns](https://architect.salesforce.com/docs/architect/well-architected/guide/operational-excellence-devops-patterns.html)
- [Promote Changes Through Your Pipeline](https://help.salesforce.com/s/articleView?id=platform.devops_center_promotion_overview.htm&type=5)
- [Govern, Manage, and Release Changes with Lifecycle Center](https://help.salesforce.com/s/articleView?language=en_US&id=platform.devops_center_overview.htm&type=5)
- [Plan for Changes to Your Org](https://trailhead.salesforce.com/content/learn/modules/org-development-model/plan-for-changes-to-your-org2)
- [Continuous Integration](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ci.htm)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 11 linked practice questions, and unlimited timed mock exams are included with the Platform Development Lifecycle and Deployment Architect pack (USD $19): https://www.certifyforce.com/practice-exams
