  An $(n,k,r)$ \emph{locally repairable code} (LRC) is an $[n,k,d]$ linear code
where every code symbol can be repaired from at most $r$ other code symbols. An
LRC is said to be optimal if the minimum distance attains the Singleton-like
bound $d \le n-k-\lceil k/r \rceil +2$. The \emph{generalized Hamming weights}
(GHWs) of linear codes are fundamental parameters which have many useful
applications. Generally it is difficult to determine the GHWs of linear codes.
In this paper, we study the GHWs of LRCs. Firstly, we obtain a generalized
Singleton-like bound on the $i$-th $(1\le i \le k)$ GHWs of general $(n,k,r)$
LRCs. Then, it is shown that for an optimal $(n,k,r)$ LRC with $r \mid k$, its
weight hierarchy can be completely determined, and the $i$-th GHW of an optimal
$(n,k,r)$ LRC with $r \mid k$ attains the proposed generalized Singleton-like
bound for all $1\le i \le k$. For an optimal $(n,k,r)$ LRC with $r \nmid k$, we
give lower bounds on the GHWs of the LRC and its dual code. Finally, two
general bounds on linear codes in terms of the GHWs are presented. Moreover, it
is also shown that some previous results on the bounds of minimum distances of
linear codes can also be explained or refined in terms of the GHWs.
