Interview Prep/Git & GitHub/GitHub, Actions and Pull Request Issues

Your PR suddenly shows 340 changed files and dozens of commits you did not write.

IntermediateTroubleshootingGitHub, Actions and Pull Request Issues
Answer

Likely causes → The PR's base is wrong (e.g. targeting main while the branch was cut from release/2.x), you merged another branch into yours, or the base branch was rewritten/force-pushed after you branched.

Diagnose →

git fetch origin
git log --oneline origin/main..HEAD | wc -l
git merge-base --fork-point origin/main HEAD
gh pr view --json baseRefName,headRefName

Fix → Change the base branch in the PR UI if it is wrong. Otherwise replay only your commits onto the correct base:

git rebase --onto origin/main <last-commit-before-yours> feature
git push --force-with-lease

Prevent → Branch from an up-to-date origin/main, and do not merge unrelated branches into feature branches.

All Git & GitHub questions Roadmap: Git & GitHub

More on GitHub, Actions and Pull Request Issues