Just select the entire buffer and do C-c^ (it runs the command
org-sort). It will prompt you for the
type of sorting.
To understand different types of sorting see the documentation of
org-sort-entriesRET). I am quoting it here for completeness
Sort entries on a certain level of an outline tree.
If there is an active region, the entries in the region are sorted.
Else, if the cursor is before the first entry, sort the top-level items.
Else, the children of the entry at point are sorted.
Sorting can be alphabetically, numerically, by date/time as given by
a time stamp, by a property, by priority order, or by a custom function.
The command prompts for the sorting type unless it has been given to the
function through the SORTING-TYPE argument, which needs to be a character,
(?n ?N ?a ?A ?t ?T ?s ?S ?d ?D ?p ?P ?o ?O ?r ?R ?f ?F ?k ?K). Here is
the precise meaning of each character:
a Alphabetically, ignoring the TODO keyword and the priority, if any.
c By creation time, which is assumed to be the first inactive time stamp
at the beginning of a line.
d By deadline date/time.
k By clocking time.
n Numerically, by converting the beginning of the entry/item to a number.
o By order of TODO keywords.
p By priority according to the cookie.
r By the value of a property.
s By scheduled date/time.
t By date/time, either the first active time stamp in the entry, or, if
none exist, by the first inactive one.
Capital letters will reverse the sort order.