If you need to checkout the latest commit before a given date or deadline in a git repository:
First, save the desired deadline (yymmddhhmm) an environment variable:
export DEADLINE="2111081100" #yymmddhhmm
Second, run this command to checkout the lates commit before the defined deadline:
git checkout "$(git log --date=format-local:'%y%m%d%H%M' --format="%ad %h %d %s" | \
awk -v deadline="$DEADLINE" '$1<deadline' | head -n1 | awk '{ print $2}')"
References Consulted: