Skip to content

Instantly share code, notes, and snippets.

@shayanbo
Last active June 21, 2016 03:04
Show Gist options
  • Save shayanbo/63a5f0ae65148ca00bacc9f992a6c9c3 to your computer and use it in GitHub Desktop.
Save shayanbo/63a5f0ae65148ca00bacc9f992a6c9c3 to your computer and use it in GitHub Desktop.
Get commit SHA1 with commit count from some branch.
#!/usr/bin/ruby
# get commit SHA1 with commit count.
commitCount=5648
branch='HEAD'
ruby -e 'puts `git rev-list #{branch}`.split.reverse[#{commitCount}-1]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment