Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Arondight/830b479d38ecdd2169073dba268b6e3b to your computer and use it in GitHub Desktop.
Save Arondight/830b479d38ecdd2169073dba268b6e3b to your computer and use it in GitHub Desktop.
git checkeout to the most recent commit before a certain date
#/usr/bin/env cat
# checkout with a iso8601 date format
git checkout $(git rev-list -n 1 --before="yyyy-mm-dd HH:MM:SS" HEAD)
# also can work well with repo command
repo forall -c 'git checkout $(git rev-list -n 1 --before="yyyy-mm-dd HH:MM:SS" HEAD)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment