Skip to content

Instantly share code, notes, and snippets.

@joeyates
Created October 30, 2013 12:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joeyates/7231567 to your computer and use it in GitHub Desktop.
Save joeyates/7231567 to your computer and use it in GitHub Desktop.
Check out the nth commit to master in a git repository. This command can be used during presentation to skip through the history of a repo.
#!/bin/bash
git checkout master
SHA1=`git rev-list HEAD | tail -n $1 | head -n 1`
git checkout $SHA1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment