Switch to the branch from which you created the pull request:
$ git checkout pull-request-branch
Overwrite the modified file(s) with the file in another branch, let's consider it's master:
git checkout origin/master -- src/main/java/HelloWorld.java
Commit and push it to the remote:
git commit -m "Removed a modified file from pull request"
git push origin pull-request-branch
Reference:
See git checkout docs:
git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <pathspec>…
Overwrite the contents of the files that match the pathspec. When the <tree-ish>
(most often a commit) is not given, overwrite working tree with the contents in the index. When the <tree-ish>
is given, overwrite both the index and the working tree with the contents at the <tree-ish>
.
Anything within []
is optional. In our case, we want to overwrite items identified by a specific pathspec with its respective content at a different branch/commit/tag