Skip to content

Instantly share code, notes, and snippets.

@skipcloud
Last active January 27, 2020 08:40
Show Gist options
  • Select an option

  • Save skipcloud/bc0c2d274af7bc20bf8cd995344e3d52 to your computer and use it in GitHub Desktop.

Select an option

Save skipcloud/bc0c2d274af7bc20bf8cd995344e3d52 to your computer and use it in GitHub Desktop.
A small git tip

A friend of mine tweeted recently about how they got into such a git mess that they deleted the entire repo and re-cloned it. I know I've done that in the past so I thought I would share a neat git feature that isn't widely known: git can understand temporal strings.

For example say you are working on a branch for an hour and you completely mess it up, knowing an hour ago you were in a good place you could issue this command git reset --hard @{'1 hour ago'} . You can use all sorts of temporal langauge e.g. hours, minutes, seconds, weeks, months, years. You can even combine them git reset --hard @{'1 year 3 months 5 hours ago'}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment