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.

Revisions

  1. airdrummingfool revised this gist Jun 5, 2014. 2 changed files with 8 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions nth-commit
    Original file line number Diff line number Diff line change
    @@ -1,5 +0,0 @@
    #!/bin/bash

    git checkout master
    SHA1=`git rev-list HEAD | tail -n $1 | head -n 1`
    git checkout $SHA1
    8 changes: 8 additions & 0 deletions nth-commit.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #!/bin/bash

    # nth-commit.sh
    # Usage: `nth-commit.sh n [branch]`

    branch=${2:-'master'}
    SHA1=$(git rev-list $branch | tail -n $1 | head -n 1)
    git checkout $SHA1
  2. @joeyates joeyates created this gist Oct 30, 2013.
    5 changes: 5 additions & 0 deletions nth-commit
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    #!/bin/bash

    git checkout master
    SHA1=`git rev-list HEAD | tail -n $1 | head -n 1`
    git checkout $SHA1