Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@vasilakisfil
Created May 22, 2016 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vasilakisfil/909bc24e00760b62d0dcc8d5d5416ab2 to your computer and use it in GitHub Desktop.
Save vasilakisfil/909bc24e00760b62d0dcc8d5d5416ab2 to your computer and use it in GitHub Desktop.
Hack github's contribution history
require 'git'
require 'fileutils'
require 'date'
begin
FileUtils.rm_rf('.git/')
File.delete('myfile.out')
rescue Errno::ENOENT
end
File.open('myfile.out', 'a') { |f|
f.puts "This files holds all the commits..."
}
g = Git.init
g.add(all: true)
g.commit_all('initialize repo..')
10.times do |iteration|
405.downto(0).each do |i|
File.open('myfile.out', 'a') { |f|
f.puts i
}
date = (Date.today - i)
date_time = DateTime.new(date.year, date.month, date.day, rand(0...24), rand(0...60), rand(0...60)).strftime("%a, %d %b %Y %H:%M:%S %z")
g.add(all: true)
system(%Q{GIT_COMMITTER_DATE="#{date_time}" git commit --date "#{date_time}" -am "Changes...#{date_time}"})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment