Git can recognize the files I modified, but the GitHub user interface shows other changes #187631
Replies: 2 comments
-
|
This usually happens when your feature branch was created from an outdated version of dev, or if dev was updated (via a squash merge or rebase) after you started your work. GitHub’s UI shows the 'diff' between the common ancestor of both branches and your current head. If those changes are already in dev but appearing in your PR, it means your branch doesn't 'know' they are already there. Here is how to fix it:
Option A: Merge (Safest) This will create a merge commit, but it should clear the 'already merged' changes from the GitHub UI. Option B: Rebase (Cleaner history) This rewrites your commits on top of the current dev. Note: You will need to git push --force after this. If your team uses Squash and Merge, the commit IDs change when they land in dev. Even if the code is the same, Git sees different hashes and thinks they are 'new' changes you are trying to introduce. Syncing your branch as shown above forces Git to realize those changes are already part of the target branch's history. |
Beta Was this translation helpful? Give feedback.
-
|
Run these commands on your feature branch to sync with latest dev This rebases your branch onto latest dev and force pushes. PR will update to show only your changes. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
Hello,
Something strange has been happening to me for a week now: Git can recognize the files I have modified, but the GitHub user interface shows changes that have already been merged into the dev branch as if I were introducing them into my pull request.
Thank you, I look forward to your comments.
Beta Was this translation helpful? Give feedback.
All reactions