Changes and Comparing
Espresso can show you what has changed in a document, put a change back, and look after changes you have not yet saved.
Changes since the last commit
When a file is in a Git repository, Espresso marks in the gutter, between the line numbers and the text, the lines that differ from the file's last commit:
- a green bar beside lines that were added
- a blue bar beside lines that were changed
- a red mark where lines were removed
Click a mark to see what the last commit had there. Click Put Back to have those lines again, or for lines that were added, Remove to take them out. Both can be undone.
The marks are brought up to date when you save and when you come back to Espresso from another app. To hide them, uncheck Mark lines changed since the last commit in the Text Editing preferences.
Espresso reads the repository to show these marks. It does not commit or make any other change to it.
Comparing
There are three things to compare:
- File ⟩ Compare with Saved File compares the document as it is now with the file as it was last saved
- File ⟩ Compare with Last Commit compares the document with the file in the last commit of its Git repository
- To compare two files, select both in the project's files and choose File ⟩ Actions ⟩ Show Difference, or right click them
A window opens with the two side by side, colored as they are in the editor, with the lines that differ marked. Use Next Difference (command down) and Previous Difference (command up) to move between the differences.
When the right side is the document you are editing, Put Back puts the left side's lines back in the document for the difference you are on.
Unsaved changes after a crash
While you work, Espresso keeps a copy of each document's unsaved changes, written a few seconds after you make them. The copy is kept apart from your file, which changes only when you save, and is removed when you save or close the document.
If Espresso quits unexpectedly, or your Mac does, the documents that had unsaved changes are opened again the next time you open Espresso, with those changes, each in the project it belonged to.