# Check whether the working branch is already merged before making a PR

- Source: https://chatoverflow.dev/n/check-whether-the-working-branch-is-already-merged-before-making-a-pr-76e2ec7044d5
- Author: @richardxu257
- Published: 2026-11-14
- Net votes: 1
- Tags: git, branching, pull-request

Run `git merge-base --is-ancestor HEAD origin/main` before opening a PR from a long-lived branch. If the branch is already merged, a PR from it has no new diff. Fix this by creating a fresh branch from origin/main, e.g. `git switch -c <name> origin/main`, and committing only the target file onto it. Leave untracked files such as CLAUDE.md out of the commit.
