Skip to main content

Undelete a file with Git

Posted in Development and Git

I’ve talked about how great git restore is, but I missed a really obvious use of git restore: restoring a deleted file!

Let’s say I’m making some changes and I either:

  • accidentally delete a file
  • delete a file and decide I shouldn’t have

I could go digging around in my Trash folder and move the file back to the directory I deleted it from, but there’s an easier way!

As long as you I haven’t committed the changes, all I need to restore my deleted homepage file is:

git restore index.html

Accessibility in your inbox

I send an accessibility-centric newsletter on the last day of every month, containing:

  • A roundup of the articles I’ve posted
  • A hot pick from my archives
  • Some interesting posts from around the web

I don’t collect any data on when, where or if people open the emails I send them. Your email will only be used to send you newsletters and will never be passed on. You can unsubscribe at any time.

More posts

Here are a couple more posts for you to enjoy. If that’s not enough, have a look at the full list.

  1. How button groups should work for keyboard users

    Menubars, menus, toolbars, and tablists are part of a larger family of ‘button groups’. Here’s how they should behave when using the keyboard.

  2. There’s no such thing as ‘menubar navigation’

    A problem markup and interaction pattern I encounter a lot is a result of people (understandably) following a misleading example from the W3C.