Reputation: 13895
I accidentally make a code commit to a Visual Studio Online (TFS) repository that I do not want someone to get the latest on. I want to remove it as if it never existed. Should I be doing a rollback or is there a better way?
I basically want to delete the latest commit. But not sure if rollback will do this for me.
Upvotes: 0
Views: 1406
Reputation: 59074
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.
Upvotes: 1