---
title: "Restore a deleted file in Git"
description: "Restore a deleted file in Git"
canonical: https://oozou.com/til/restore-a-deleted-file-in-git-5
locale: en
date: 2020-10-13
topic: shell
---

# Restore a deleted file in Git

> Restore a deleted file in Git

Published: 2020-10-13 · Topic: [shell](https://oozou.com/til-topics/shell) ([markdown](https://oozou.com/til-topics/shell.md))

```bash
# Find in which commit it's been deleted
$ git rev-list -n 1 HEAD -- <file_path>
4058ef780d2f6c4c6d57cfd7fd4ebe14c9dc28b3
# Restore it back
$ git checkout 4058ef780d2f6c4c6d57cfd7fd4ebe14c9dc28b3^ -- <file_path>
```

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
