undo to the previous version of the file

I've wanted to add some lines to the file from the shell with the '>' symbol but it replaced the previous text. How can I bring back my file content?