Thursday 20 May 2021

Remove a file from git pull request

Learned something amazing today.

Scenario : You have updated a file that already existed in main branch and want to remove it from the pull request.

Assume you're working on a branch (say featureBranch) off of development (means you created 
featureBranch from the development  branch) , and your pull request includes a file named AccountController.java.

To remove this file from the pull request and revert its changes, simply do :

1. Checkout your branch (featureBranch).
2. Run below command.
     git checkout development --  AccountController.java
3. Commit and push into your branch (featureBranch).