Git Conflict Resolution Guide for Python/FastAPI & Vite Projects
Git conflicts occur when multiple developers make changes to the same parts of a file, and Git cannot automatically determine which changes to keep. This guide will help you understand and resolve common conflict scenarios in your Python/FastAPI backend and Vite frontend projects.
What Causes Conflicts?
- Two or more developers modify the same line(s) in a file
- One developer deletes a file while another modifies it
- Changes are made to files that have been moved or renamed
- Merging branches that have diverged significantly
How Git Shows Conflicts
When a conflict occurs, Git marks the file with conflict markers:
<<<<<<< HEAD
Your current branch's version
=======
The incoming branch's version
>>>>>>> branch-name
Your job is to edit the file, decide what to keep, and remove all three markers before committing.
What’s in this guide
- Backend Conflicts — Import statements, endpoint routes, and SQLAlchemy model conflicts in FastAPI
- Frontend Conflicts — package.json, component imports, CSS, and package-lock.json conflicts in Vite/React
- Configuration Conflicts — .env files and accidentally committed files like
__pycache__and virtual environments - Resolving Conflicts — A step-by-step process, best practices, common commands, and troubleshooting tips