What an undo log actually does
An undo log is a record that your program or database keeps of every change you make, so it can reverse those changes if you ask it to. When you press Ctrl+Z (or Cmd+Z on Mac) to undo, the program is reading backward through that log and putting things back the way they were. The log is not something you see or manage yourself — it runs in the background.
Different programs keep undo logs in different ways. A word processor like Microsoft Word stores the last 100 edits by default, so you can undo back through your last 100 changes. A database like SQL Server keeps a transaction log that records every insert, update, and delete so the system can roll back if something goes wrong. A version control system like Git keeps a complete history of every commit you make. All of them are doing the same job: recording what changed, so you can go backward.
The log takes up space on your computer or server, which is why programs usually limit how far back you can undo. Once you close a document in Word, the undo log for that document is thrown away. Once you shut down your database, it may keep the transaction log for a few days before deleting it. This is a trade-off between being able to undo mistakes and not filling your hard drive with history.
Key Takeaways
- An undo log is a hidden record of changes that lets you reverse what you just did by pressing Ctrl+Z or Cmd+Z.
- Different programs keep different amounts of history — Word keeps about 100 edits, but databases and version control systems may keep much more.
- The log is stored on your device or server and takes up space, so programs delete old logs to save room.
- You cannot edit or see the undo log directly; the program manages it automatically when you make changes.
How programs decide what to record in the log
Not every keystroke goes into the undo log. If it did, undoing one character at a time would be unusable. Instead, programs group related changes together. In Word, typing a sentence is usually one undo step, not 50 separate steps for each letter. Pressing Enter or clicking elsewhere signals the end of a group, so the next change starts a new undo step.
Databases work differently. A transaction log records every single change — every row inserted, every value updated — because databases need to be able to recover from a crash in the middle of an operation. If your database crashes while inserting 10,000 customer records, the transaction log lets the system figure out which ones actually made it to disk and which ones need to be redone. That level of detail is necessary for safety, even though it creates much larger logs.
Version control systems like Git record changes at the commit level. You decide when to create a commit, and Git logs that entire commit as one unit. This gives you control over what counts as a single undoable action, which is why developers commit frequently — so each commit is small enough to understand and undo if needed.
Why undo logs matter for your data safety
An undo log is one of the main ways your programs protect you from mistakes. If you accidentally delete a paragraph, change a formula, or overwrite a file, the undo log is what makes it possible to get it back. Without it, every change would be permanent the moment you made it.
For databases and servers, undo logs (called transaction logs) are critical for recovery. If the power goes out or the system crashes, the transaction log tells the database which changes were complete and which were interrupted. The database can then redo the complete changes and undo the interrupted ones, so you don't end up with corrupted or half-finished data. This is why database administrators back up transaction logs separately from the data itself — losing the log means losing the ability to recover safely.
The undo log is also why you should save your work regularly. Once you close a document, the undo log is gone. If you close Word without saving, you cannot undo back to an earlier version — you have lost all the changes since the last save. Saving creates a checkpoint, and the undo log only covers changes after that checkpoint.
The limits of undo logs and when they run out
Every undo log has a limit. Word stops recording after about 100 changes, so if you have made 150 edits, you can only undo back 100. Photoshop lets you set the limit yourself in preferences, anywhere from 1 to 1000 steps. Once you hit the limit, the oldest change is deleted from the log to make room for the newest one.
Some programs let you undo further by using version history or autosave. Google Docs keeps a version history for 30 days, so even if you have used up your undo steps, you can still go back to an earlier version from last week. Microsoft Word has autosave and version history in OneDrive. These are separate from the undo log — they are backups, not the same thing.
If you are working with a database or server, the transaction log can fill up your disk if it is not managed. Database administrators have to delete old transaction logs or move them to archive storage, or the log will eventually consume all available space and the database will stop working. This is why database backups are important — they let you delete old logs without losing the ability to recover.
Undo logs in different programs and what they can and cannot do
Word processors like Word and Google Docs keep undo logs that cover typing, formatting, and deletion. You can undo back through your edits, but once you close the document, the log is gone. Google Docs is different because it saves to the cloud and keeps version history, so you can recover older versions even after closing.
Spreadsheets like Excel work the same way — the undo log covers formulas, data entry, and formatting. But if you close the file without saving, the undo log is discarded. If you save the file, close it, and reopen it later, you cannot undo changes from before you closed it.
Photo and video editors like Photoshop and Premiere Pro keep longer undo logs because creative work often requires stepping back through many changes. Photoshop defaults to 20 undo steps but can be set higher. However, the undo log is still lost when you close the file, unless you save a project file that preserves the history.
Databases and servers use transaction logs differently. The log is permanent (until the administrator deletes it) and is used for recovery, not for user-facing undo. You cannot press Ctrl+Z in a database to undo a query. Instead, administrators use the transaction log to restore the database to a point in time if something goes wrong.
How to protect yourself when undo is not enough
The undo log is useful for recent mistakes, but it is not a backup. If you want to be able to recover work from days or weeks ago, you need something else. For documents, use version history or autosave features. Word and Google Docs both keep older versions automatically. You can also manually save versions with different names — "report_v1.docx", "report_v2.docx" — so you have a trail to go back to.
For code and creative projects, use version control. Git lets you commit your work and keep a complete history. You can branch off to try something risky, and if it does not work, you can switch back to the main branch without losing anything. This is much more powerful than an undo log because it lets you manage multiple versions at once.
For important files, back them up to a separate location. Use cloud storage like OneDrive, Google Drive, or Dropbox, which keeps version history. Or use a backup tool that creates snapshots of your files at regular intervals. If your computer crashes or a file gets corrupted, you can restore from backup. The undo log cannot help you then.
Frequently Asked Questions
Can I undo something after I have closed the program?
No. Once you close a program, the undo log is deleted. If you closed the file without saving, those changes are gone. Some programs like Google Docs and Word keep version history separately, so you can recover older versions, but that is different from the undo log.
Why does undo sometimes not work?
Undo only works on changes made in the current session. If you closed the file and reopened it, the undo log was reset. Also, some actions like printing or saving cannot be undone — the undo log only covers edits to the document itself, not actions that affect other files or devices.
Can I undo a save?
No. Saving writes your current work to disk and clears the undo log. If you saved by mistake, you cannot undo the save itself. But if the program has version history (like Word or Google Docs), you can open an earlier version of the file from before the save.
What happens to the undo log if my computer crashes?
The undo log is lost. It only exists in your computer's memory while the program is running. If the power goes out or the system crashes, the undo log is gone. This is why saving frequently is important — it creates a checkpoint so you do not lose too much work.
Is the undo log the same as a backup?
No. The undo log is temporary and only covers recent changes in the current session. A backup is a copy of your files stored separately, usually on another device or in the cloud. Backups protect you from crashes, deleted files, and old mistakes. The undo log only protects you from very recent mistakes.