Skip to content

Instantly share code, notes, and snippets.

@liamHowatt
Created May 24, 2026 13:15
Show Gist options
  • Select an option

  • Save liamHowatt/fcbea951ee93172fd3d8a1b8e029b00c to your computer and use it in GitHub Desktop.

Select an option

Save liamHowatt/fcbea951ee93172fd3d8a1b8e029b00c to your computer and use it in GitHub Desktop.
git checkout the oldest nuttx-apps commit that is no younger than the checked out nuttx commit
import subprocess
def extract_commit(log):
return log[7:7+40]
def extract_date(log):
return log.splitlines()[4].split("CommitDate:")[1].strip()
outp = subprocess.check_output("git log -1 --pretty=fuller", shell=True).decode()
commit = extract_commit(outp)
date = extract_date(outp)
print(f'This nuttx commit ({commit}) dated "{date}"')
outp = subprocess.check_output(f'git -C ../apps log -1 --pretty=fuller --until="{date}" upstream/master', shell=True).decode()
commit = extract_commit(outp)
date = extract_date(outp)
print(f'will use this apps commit ({commit}) dated "{date}"')
subprocess.check_call(f"git -C ../apps checkout {commit}", shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment