If you haven't checked out the files you've edited, first do
p4 reconcile ...
to get the changes tracked by Perforce.
You don't need this if the changes you want to undo are already in any changelist.
Then, from the root of your workspace,
p4 revert ...
(...
is the Perforce wildcard for everything under a given directory, not something you have to fill in yourself).
If you also want to delete untracked files from the disk, then if you're using the 2013.2 release or later, you can pass -w
to p4 revert
to also delete newly added files. See this answer for some background on this option.
The reconcile
step would first detect these files and mark them for add, and then the revert
step would unmark them for add and delete them. If -w
isn't available then there's no clean way to do this and the files will be left untracked and on the disk after the revert.