Rebase


Nov. 19, 2025

How to Fix Unwanted File Changes in a GitHub PR

What I Learned

I learned how to remove unwanted file changes from a specific commit in a Pull Request. By combining git rebase -i and git commit --amend, you can pinpoint and modify past commits while keeping the history clean.

Details

The Problem

When creating a PR and checking the diff, I found that a certain commit had unintentionally changed a file:

D  example/config.yaml    (deleted)

It’s common to accidentally include unrelated changes such as configuration files or documentation in commits. This prevents the PR from being properly reviewed, so I needed to fix only that specific commit.