Skip to content

Instantly share code, notes, and snippets.

@markryall
Created December 22, 2014 04:41
Show Gist options
  • Save markryall/692a0659fbec594174e4 to your computer and use it in GitHub Desktop.
Save markryall/692a0659fbec594174e4 to your computer and use it in GitHub Desktop.
git-step
#!/usr/bin/env ruby
all = `git rev-list master --reverse`.split
if File.exist?('.git-step')
index = all.index File.read('.git-step').chomp
index += 1 if index
end
index ||= 0
index = all.count - 1 unless all[index]
current = all[index]
puts "Jumping to commit #{current} (#{index+1} of #{all.length})"
`git checkout #{current} 2>&1 > /dev/null`
File.write '.git-step', current
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment