I have added a local changes to an existing file into my PR by mistake. I want to revert only this file without deleting this file locally. I just want that it doesn't show up in the Pull Request. I don't want to create new branch as many people have commented on other files in this PR.
To exclude certain files from appearing in pull requests: In the repository containing the pull request, click Repository settings > Excluded files in the Pull Requests section. In the Patterns field, enter patterns to exclude from pull request diff views. Click Save.
It does delete the file. It DOES NOT mean it will remove your changes to the file.
Given that, there are multiple ways to remove a file from a Merge Request, such as: As you proposed, you can add a new commit to your source branch which effectively undoes the changes to the files you no longer wish to include. This could mean undoing the changes to existing tracked files, or deleting untracked files.
If you updated a file that already existed and want to remove it from the PR:
Assume you're working on a branch off of staging
, and you PR'd a file named validate_model.py
.
To remove this file from the PR and revert its changes, simply do:
git checkout staging -- validate_model.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With