Skip to content

Instantly share code, notes, and snippets.

@airdrummingfool
Forked from joeyates/nth-commit
Last active December 7, 2018 15:31
Show Gist options
  • Select an option

  • Save airdrummingfool/587f48afec98675210e4 to your computer and use it in GitHub Desktop.

Select an option

Save airdrummingfool/587f48afec98675210e4 to your computer and use it in GitHub Desktop.
Checkout the nth commit on a specified branch.
#!/bin/bash
git checkout master
SHA1=`git rev-list HEAD | tail -n $1 | head -n 1`
git checkout $SHA1
@airdrummingfool
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment