If you're using Git, you can use git reset
to move your branch back to the commit prior to the commit that contained the unwanted file, then force push the branch. Beware that force pushing is potentially dangerous. Be sure you understand the implications prior to using it.
You can also use git revert
to create a commit that undoes the change, but the commit containing the change will still be present.
If you're using TFVC, you can use tf.exe
with the destroy
parameter to delete the file: https://www.visualstudio.com/en-us/docs/tfvc/destroy-command-team-foundation-version-control
Note that destroy
removes files, not commits. Rollback is your best bet in the event that you want to retain the file and its history, but revert the content to how it was at an earlier point.