How to remove a file from Git Pull Request

Please do let me know if there is a better way of doing this. This is the workaround I have found.

list remote branches

git branch -va

checkout the PR branch

git checkout origin pr_branch

overwrite pr_branch's file with other_branch's file

git checkout other_branch -- ./path/to/file

commit changes

git commit -m "overwrite with other_branch's"

push your changes

git push origin pr_branch

I think you can simply override your project.lock.json with the origin one and commit.


You need to remove file, commit changes and make next push to your branch.

If you want leave file in your branch, but not to merge it to main branch, you can delete it in one commit, then add again in another. Git allows you manually accept certain commits using git-cherry-pick. You can accept each commit except that in which you have added this file again.