- Branch
exploring-coloring: player starts with 5 lives and UI color changed to green. - Branch
main: player starts with 3 lives and original colors remain.
main) has no new commits since the source branch diverged. In that case Git simply moves the main pointer forward so it points to the same commit as the source branch. If both branches have unique commits, Git creates a merge commit unless you rebase first.
Performing a local merge (fast-forward example)
- Checkout the target branch you want to merge into (usually
main). - Merge the source branch into it.
main now includes the updates from exploring-coloring (player starts with 5 lives and the styling changes). Run the app from main to verify the UI and behavior.
Quick reference: common git merge commands
Inspecting commit history
Use a compact graph log to confirm branches were combined and to visualize commit pointers.
Example:
main and exploring-coloring point to the same latest commit after the fast-forward.
Deleting the feature branch locally
If you no longer need the feature branch locally, delete it to keep your branch list tidy.
Example:
Fast-forward merges are simple and clean: Git advances the target branch pointer when there are no divergent commits. If your branches have diverged, Git will create a merge commit. Teams often choose between merge commits and rebasing based on their preferred history style—pick the workflow that matches your team’s collaboration model.
- Local merging:
git checkout <target>thengit merge <source>. - Fast-forward merges move the branch pointer without creating a merge commit.
- Always verify the merge by opening files, running the app, and inspecting the log.
- Clean up local feature branches with
git branch --delete <branch>when they’re no longer needed.