Extracting previous copy from github [til/cli]

1 · Remy Sharp · July 2, 2021, 10:09 a.m.
Sometimes I need to pull a complete copy of a previous file out of a github (this is useful when needing to do visual binary diffs to see which bytes have moves or changed). To pull a specific file, say the last commit, the following command line does the trick: git show HEAD^:./myfile.bin > myfile.bin The HEAD^ means "one commit behind the head of the branch" (the "head" being the last commit on the branch). Though if you've got merge commits where a commit has more than one parent commit this...