Git Collaboration & Conflict Resolution
01 The daily Git workflow
Solution and explanation
- Inspect changes, stage intentionally, commit a focused unit and push a feature branch.
- Avoid blindly adding secrets or unrelated user work.
git status
git diff
git add path/to/changed-file.php
git commit -m "Add applicant report export"
git push origin feature/applicant-reports
Create a focused commit containing only the reporting module.
Quick check
Which statement is correct?
02 Synchronizing before development
Solution and explanation
- Fetch remote references, update local main, then merge or rebase main into a feature branch before pushing.
git fetch origin
git switch main
git pull --ff-only origin main
git switch feature/applicant-reports
git merge main
Synchronize a disposable feature branch and inspect the resulting history.
Quick check
Which statement is correct?
03 Resolving a merge conflict
Solution and explanation
- Git conflict markers show current and incoming alternatives.
- Understand both changes, produce the intended final code, remove every marker, test, then stage the resolution.
<<<<<<< HEAD
$users = User::active()->get();
=======
$users = User::active()->latest('id')->get();
>>>>>>> main
// Resolved
$users = User::active()->latest('id')->get();
Create a harmless conflict on a practice branch, resolve it and run the related test.
Quick check
Which statement is correct?
04 Healthy team Git practices
Solution and explanation
- Small feature branches and pull requests, frequent synchronization, clear reviews and automated tests reduce conflicts and regression risk.
feature/applicant-report
→ small commits
→ pull request
→ automated tests
→ review
→ merge
Split a large reporting change into reviewable commits and draft a concise pull-request description.
Quick check
Which statement is correct?
