Troubleshooting
Troubleshooting
Merge Conflicts
Merge conflicts happen when someone else merged changes to the same files you're working on. Git can't automatically figure out how to combine the changes, so it asks you to decide.
Here's how to resolve them:
# Update your local master
git checkout master
git pull origin master
# Go back to your branch and merge master in
git checkout feat/add-user-auth
git merge master
# Git will tell you which files conflict
# Edit those files and look for conflict markers:
# <<<<<<< HEAD
# your changes
# =======
# their changes
# >>>>>>> master
# After fixing conflicts:
git add [fixed-files]
git commit -m "fix: resolve merge conflicts with master"
git push
Tools to help with conflicts:
VS Code Merge Editor - VS Code's built-in merge editor provides a 3-way view (incoming, current, result) that makes conflicts much easier to visualize. When you open a conflicted file, VS Code shows options to accept incoming changes, keep your changes, or merge both.
Cursor AI Resolve Conflicts - Cursor Agent can help resolve conflicts by understanding both sides:
- When a conflict occurs, you'll see the conflict markers in your file
- Click the "Resolve in Chat" button in the merge conflict UI
- Agent analyzes both versions and suggests a resolution
- Review the proposed changes and apply them
Note: If you're not sure how to resolve a conflict, ask someone. Better to pause and get help than to accidentally lose someone's work.
Wrong Branch Name
You created a branch but forgot to include something or used the wrong type. No problem:
# Rename the local branch
git branch -m old-name new-name
# Delete the old remote branch
git push origin --delete old-name
# Push the new branch name
git push -u origin new-name
Creating PR After Work Begins
If you started working before creating a PR, that's fine. Just push and create:
# Push your branch
git push -u origin feat/add-user-auth
# Create the PR
gh pr create
Work in Progress Commits
Need to stop mid-task with uncommitted changes? Just commit the work in progress:
git add .
git commit -m "feat: work in progress on validation logic"
git push
That's what draft PRs are for—accommodating work that's not finished yet.
For more quick reference material and common commands, check out the quick reference section.