Version history for markdown notes: recover lost edits and files

Version history for markdown notes: how long git, editors, Jotura, Obsidian and cloud drives keep versions, and how to undo an overwrite, delete or agent edit.

A markdown note is a plain file with no history of its own. Its history is whatever copies other tools kept: git commits, your editor’s local history, your notes app, your cloud drive and your operating system’s backups. Each keeps versions for a different length of time.

To get an overwritten or deleted note back, stop editing the file and work from the shortest window to the longest. Editor undo and local history go first, because they expire in days. Sync services and backups reach back weeks or months, and git keeps whatever you committed forever.

How long each tool keeps old versions

All figures come from each vendor’s documentation, checked in October 2026.

Tool When it saves a version Default retention Survives losing the machine Plan
Git Each commit you make Forever Only if pushed to a remote Free
VS Code local history (Timeline view) Each save in VS Code 50 entries per file, files over 256 KB skipped No Free
JetBrains Local History Each change, from the IDE or from outside it The last 5 working days No Free
Obsidian File Recovery core plugin At most once every 5 minutes 7 days No Free
Obsidian Sync Each synced change Notes 1 month on Standard, 12 months on Plus; attachments 2 weeks Yes Paid
Dropbox Each synced change 30 days on Basic, Plus and Family; 180 on Professional, Essentials, Standard and Business; 365 on Business Plus, Advanced and Enterprise Yes Free tier and paid
OneDrive Each synced change 30 days Yes Free tier and paid
Google Drive Each upload of a new version 30 days or 100 newer versions, unless you mark one Keep forever Yes Free tier and paid
iCloud Drive Deleted files go to Recently Deleted 30 days for deleted files Yes Free tier and paid
Time Machine (macOS) Hourly Hourly for 24 hours, daily for a month, weekly after that Yes, on an external disk Free, needs a backup disk
Windows File History Hourly by default A setting you choose Yes, on an external or network drive Free, off until you turn it on
Jotura autosave snapshots Before each write the desktop app makes Thinned with age, at most 50 per note No Free
Jotura synced versions Each sync push Superseded content for 3 years, current content indefinitely Yes Paid (Jotura Sync)

The fine print

  • VS Code merges saves made within 10 seconds into one entry. The workbench.localHistory.maxFileEntries, maxFileSize and mergeWindow settings change those limits (local file history).
  • JetBrains records changes made outside the IDE, so it catches a script or agent overwriting a file. VS Code records only its own saves (JetBrains Local History).
  • Obsidian File Recovery stores snapshots outside the vault, and they never sync between devices (File recovery).
  • Time Machine also keeps a local snapshot on the Mac about once an hour for 24 hours, which covers you while the backup disk is unplugged (local snapshots).

Sync markdown notes across devices compares these services on more than history.

Turn these on before you need them

Three of the longest windows do nothing until you set them up.

  • File History on Windows is off by default and needs an external drive or network location. It backs up your libraries, so keep the vault inside Documents or add its folder to a library (File History).
  • Time Machine on macOS needs a backup disk chosen in System Settings before it keeps anything.
  • Scheduled git commits need a cron job, a scheduled task or an editor plugin to run them. Inside Obsidian, the Obsidian Git community plugin does this, and its author calls the mobile version highly unstable (Obsidian Git).

A git init in the vault folder, with a commit before each agent session, covers every case below.

Recover an overwritten note

If the file is still open in the editor that changed it, try Ctrl+Z or Cmd+Z first. Then go through these in order:

  1. Your notes app’s history. In Jotura, right-click the note in the file tree and choose History. In Obsidian, open File recovery under Core plugins in Settings and choose View under Snapshots, or with Obsidian Sync choose Open version history on the note.
  2. Your editor’s local history. In VS Code, open the file and expand the Timeline view under the Explorer. In a JetBrains IDE, right-click in the editor and choose Local History, then Show History. Only JetBrains will hold a version written by another program.
  3. Your sync service. Dropbox, OneDrive and Google Drive show a file’s versions on their websites, and they treat .md files like any other.
  4. Operating system backups. On a Mac, open the folder in Finder and choose Browse Time Machine Backups from the menu bar. On Windows, right-click the file and choose Properties, then Previous Versions.
  5. Git. The commands are in the next section.

Restore to a new name when you are unsure, then compare. File recovery software is a last resort. On an SSD the drive erases deleted blocks soon after a delete, so it rarely finds anything.

Recover a note with git

Git holds only what you committed. To see and discard uncommitted changes to one note:

git diff notes/plan.md
git restore notes/plan.md

To go back further, list the commits that touched the note, print an old version, then restore it:

git log --oneline -- notes/plan.md
git show <commit>:notes/plan.md
git restore --source=<commit> notes/plan.md

A deleted note still exists in the commit before the one that deleted it:

git log --diff-filter=D --oneline -- notes/plan.md
git restore --source=<commit>~1 notes/plan.md

If a reset or rebase made a commit disappear, git reflog still lists it for a while, and you can restore from its hash.

Where did my deleted note go?

What deleted it Where to look How long it stays
Finder or File Explorer The system Trash or Recycle Bin Until you empty it
A shell command or agent (rm, Remove-Item, del) No trash at all. Only git, Time Machine, File History or a sync service’s deleted files That tool’s window
Obsidian set to Move to system trash The system Trash or Recycle Bin Until you empty it
Obsidian set to Move to Obsidian trash The hidden .trash folder in the vault Until you empty it
Obsidian set to Permanently delete File Recovery snapshots, if one exists 7 days
A device using Obsidian Sync Settings, Core plugins, Sync, then View next to Deleted files Your plan’s history window
VS Code Local History: Find Entry to Restore, from the Timeline view Up to 50 entries
A git repository git log --diff-filter=D -- <path>, then restore from the commit before Forever
A Dropbox folder Deleted files on dropbox.com 30 to 365 days by plan
A OneDrive folder The recycle bin on onedrive.com 30 days personal, 93 days work or school
A Google Drive folder Trash in Google Drive 30 days
An iCloud Drive folder Recently Deleted at icloud.com/iclouddrive 30 days
Jotura’s Move to trash <vault>/.jotura/trash/, restored with jotura trash restore Until you purge it
jotura delete Nowhere, it is permanent None

Obsidian’s setting lives under Settings, Files and links, Deleted files.

Why a whole-file rewrite loses edits

Most overwrites raise no error. A program reads a file, builds a new version in memory and writes the whole file back. Any change made on disk between the read and the write is missing from the copy it writes, so that change vanishes.

Two sync tools pointed at one folder do this to each other, and so can a script, an editor saving a stale buffer, or a shell command such as sed -i or a > redirect. Agents vary. Claude Code’s Edit tool replaces an exact string in the file’s current content, so your edits elsewhere in the note survive, while its Write tool replaces the whole file (tools reference). An agent’s shell commands carry no check at all.

Two things prevent it: a conditional write, which refuses when the file no longer matches what the writer read, and a merge, which combines both sets of changes.

Undo changes an AI agent made to your files

Find what changed

In a git repository, these show everything since your last commit:

git status --short
git diff

M marks a modified file and ?? a new one. Codex CLI’s /diff and Aider’s /diff show changes from inside a session.

Without git, list the notes modified in the last hour. In Jotura, the dashboard’s Recently modified list does this for you. On macOS or Linux:

find . -name "*.md" -mmin -60 -not -path "./.git/*"

On Windows, in PowerShell:

Get-ChildItem -Recurse -Filter *.md | Where-Object LastWriteTime -gt (Get-Date).AddMinutes(-60)

Revert uncommitted changes

git restore --staged --worktree .
git clean -nd
git clean -fd

The first command discards edits to tracked files, including any the agent staged with git add. git clean -nd lists the new files and folders the agent created, and git clean -fd deletes them for good, so read the list first. To keep some edits and drop others, git restore -p walks through each change and asks.

If the agent committed

Find its commits with git log --oneline. git revert <sha> adds a new commit that undoes one of them and keeps the history. git reset --hard <sha> moves the branch back to an earlier commit and throws away everything after it, including uncommitted work, so use it only when you are sure.

Claude Code checkpoints and rewind

Claude Code saves a checkpoint before each prompt you send. Run /rewind, or press Esc twice with an empty prompt, then restore code and conversation, the conversation only, or the code only. Snapshots last about 30 days after the session last saved one, and cleanupPeriodDays extends that.

Rewind covers only edits made through Claude’s file-editing tools. Files changed by shell commands such as rm or mv, by most subagents, or by another program are left as they are (checkpointing).

Other agents

Agent Built-in undo Limits
GitHub Copilot in VS Code Keep and Undo on each edit, Restore Checkpoint on a previous request, and editing a previous request reverts its changes and later ones Terminal commands are not reversed (review code edits)
Cursor Restore Checkpoint on an earlier request Checkpoints are local and separate from git (checkpoints)
Cline A checkpoint after each tool use, with Restore Files, Restore Task Only and Restore Files & Task On by default (checkpoints)
Aider Commits each change to git, and /undo discards the last one --no-auto-commits turns this off (git integration)
Gemini CLI /restore Off until general.checkpointing.enabled is set in settings.json (checkpointing)
Codex CLI No undo command Revert with git

Version history in Jotura

Jotura is a notes app for desktop and Android that opens a folder of markdown files as-is. Its history has two sources.

Synced versions come with Jotura Sync. Each push of a note becomes a version with its time, size and author, marked as an edit, a delete or a restore. Superseded content is kept for three years and current content indefinitely, and the timeline follows you to every computer on your account. Sync is £4 a month or £40 a year with no free trial; see pricing for local currencies.

Autosave snapshots are free and local. The app saves one second after you stop typing, and before every write it copies the old content into <vault>/.jotura/history/. After an overwrite from outside the app, the snapshots therefore hold every version up to your second-to-last save. They are thinned to one per hour after a day and one per day after a week, up to 50 per note.

To restore, right-click a note in the file tree and choose History, or run History for Current Note from the command palette. With Sync on, turn on the Autosaves chip to see local snapshots between synced versions. Pick two versions for a diff, then click Restore and confirm. The current content is snapshotted first, and the version history docs cover the rest.

Trash and permanent delete

Move to trash in the app sends a note to <vault>/.jotura/trash/. The desktop app has no trash browser, so you restore with the command-line tool that ships with it:

jotura trash list
jotura trash restore "Projects/plan.md"
jotura trash restore "Projects/plan.md" --rename-to "Projects/plan-recovered.md"

The restore refuses if a file already sits at the original path, and --rename-to puts the note elsewhere. The note’s snapshots stay in place, so its history returns with it.

jotura delete is permanent unless you add --trash, as are jotura trash purge and jotura trash empty --force. Ask agents to trash rather than delete. The trash stays on the machine that trashed the note, while other devices remove the file when the delete syncs. Restore on that machine and the note syncs back (trash reference).

Hash-checked edits

The jotura command-line tool can make a write conditional. A script or agent reads the note to get its hash and passes it with the edit:

jotura read Projects/plan.md --json
jotura edit Projects/plan.md --replace "Due: Friday" --with "Due: Monday" --if-hash <hash>

If the note changed since the read, the edit exits with code 2 and writes nothing. The CLI and the desktop app share a per-vault lock around that check, so two writers holding one hash cannot both succeed. A note you have open is merged when it changes on disk, and sync merges edits from two devices or writes a conflict copy. A notes app with a CLI covers the rest of the tool.

What Jotura does not do

Jotura is not a sandbox. An agent with access to your machine can change files outside the vault, and one that writes with its own file tools skips the hash check. History covers .md files only, so imported documents and images have none.

Restores happen one note at a time, with no way to roll a whole vault back to a point in time. Opening a past synced version downloads it, so it needs a connection. Once a note is deleted, its synced timeline cannot be opened from the app, so the trash is the way back.

The command-line tool has no history commands. There is no iOS app, and the Android app has no history view, though phone edits become synced versions you can restore on the desktop.

Frequently asked questions

Do markdown files have version history?

No. A markdown file is plain text with no built-in history. Its history comes from git, your editor’s local history, a notes app, a cloud drive or an operating system backup.

How do I recover an overwritten markdown file?

Stop editing it and try undo if it is still open. Then check your notes app’s history, your editor’s local history, your cloud drive’s version history, Time Machine or Windows Previous Versions, and git. Of those editor histories, only JetBrains Local History records changes made by other programs.

How do I recover a deleted note?

Look where the deleting program sends files: the system Trash or Recycle Bin, Jotura’s .jotura/trash/ folder, or Obsidian’s .trash folder if you chose it. Cloud drives keep deleted files for 30 days or more, and git keeps them in the commit before the deletion. A file removed with rm or Remove-Item skips every trash.

How do I undo changes an AI agent made to my files?

In a git repository, git diff shows the changes and git restore --staged --worktree . reverts edits to tracked files; preview new files with git clean -nd before removing them with git clean -fd. Claude Code rewinds its own file edits with /rewind, and Copilot, Cursor, Cline and Gemini CLI have checkpoints. Shell-command changes need git or a backup.

How long does Jotura keep old versions?

With Jotura Sync, superseded versions are kept for three years and a note’s current content indefinitely. Without Sync, local autosave snapshots are thinned to one a day after a week, with at most 50 per note. To restore a deleted note, run jotura trash restore with its original path.

How to convert PDF and Word to markdown: six tools tested2026-10-10
How to convert PDF to markdown and Word docx to markdown, with real output from pandoc, MarkItDown, Docling, Marker, MinerU and PyMuPDF4LLM on the same files.
Daily notes and todo lists in plain markdown2026-10-10
Daily notes in markdown: date-based file names, a short daily note template, shell shortcuts, and a markdown todo list you can search across every file.
Markdown table syntax: how to make a table in Markdown2026-10-10
Markdown table syntax with copyable examples: pipes, the separator row, alignment, escaped pipes, line breaks in cells, and where tables render.

More in Writing and organizing.

Download free

Jotura is free, and your notes stay plain markdown files you keep forever.