Note: technically this doesn't undo the commit, but it's just as good—an empty repository has little function.  To really empty out the repository, see below.
git commit --amend should work.  Here is a demonstration:
$ git init
Initialized empty Git repository in .../.git/
$ echo test changing root commit > README
$ git add README 
$ git commit -m initial
[master (root-commit) 90e83ae] initial
 1 file changed, 1 insertion(+)
 create mode 100644 README
$ echo different readme > README
$ git add README 
$ git commit --amend --no-edit
[master 8e159b1] initial
 Date: Sat Mar 2 21:00:53 2019 -0800
 1 file changed, 1 insertion(+)
 create mode 100644 README
$ git log --all --decorate --oneline --graph
* 8e159b1 (HEAD -> master) initial
Note that the "different README" is what went in to this new root commit:
$ git show --pretty=oneline
8e159b1f0d397b31cb1be5168e77ba200269c62a (HEAD -> master) initial
diff --git a/README b/README
new file mode 100644
index 0000000..ef0411a
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+different readme
If you have files you don't want in the new root commit, use git rm (perhaps with --cached) to remove them.
If you really want to delete the master branch and its single commit, and then be on the master branch as you normally are in a new, empty repository, it takes a couple of extra steps, at least as long as you want to use normal (not plumbing) commands.  Here are the steps:
- git branch -m master delete: rename the- masterbranch out of the way
- git checkout --orphan master: get back on a branch named- masterthat does not exist
- git branch -D delete: delete the unwanted branch
- git read-tree --empty: empty out the current index
The work-tree is undisturbed by this process.