Find recent queries and files
DataGrip can help you recover the queries that you have run or typed recently. Also, you can find the files that you have recently closed.
Query history
DataGrip saves all the queries you run. You can find the queries in the query history of a data source.
To view the query history for the current data source, click
Browse Query History on the console’s toolbar. Alternatively, press Ctrl+Alt+E.
In the <data_source_name> Query History dialog that opens, double-click a query to paste it in the editor.
In the dialog, text search is available to help you find queries.
Queries log
Any queries that DataGrip runs against your databases are stored in the database.log file. This file can show you what DataGrip does under the hood, but it can also help you restore a query from your history if you do not remember where and when you ran it last.
To open the log file, navigate to
.Open the log file from your file browser.
Alternalively, you can make the file always accessible by attaching the directory with it to your IDE project.
Local History
For the queries that you created in the editor but never run, recovering is also possible. To recover such queries, use Local History.
For more information about Local History, refer to the Local History topic.
In the editor, right-click anywhere in the area and select
.In the search field, start typing your query
To restore a specific code fragment, select the revision that contains that fragment. In the diff view on the right locate the piece of code you want to restore and click the chevron button
to copy it from the left pane.
Local History for directories
If you manipulate your files from the Files tool window , you can also use Local History to restore deleted files.
In the Files tool window Alt+2, right-click the directory where you want to restore the deleted files and select .
On the left, select the revision that contains the file you want to restore, right-click that file, and select Revert Selection.
Recent files
In DataGrip, you can open any tab with the file that you have closed recently or by mistake.
To open the previously closed tab, press Ctrl+E.
In the Recent Files popup window, find the file you want to re-open and double-click it.
For more information about the window, refer to the Find recent files chapter.

Clipboard history
DataGrip keeps a record of the items you copy to the clipboard. It starts doing this as soon as you launch the IDE and clears the clipboard history after you close it.
To open the dialog with clipboard history, press Ctrl+Shift+V.
In the dialog, select the entry you want to paste and click Paste.
