Created
October 9, 2015 00:11
-
-
Save defvol/2bc0c3cff0d749121453 to your computer and use it in GitHub Desktop.
Git commits traveling through time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'git' | |
| require 'logger' | |
| require 'active_support/all' | |
| g = Git.open(ENV['PWD'], :log => Logger.new(STDOUT)) | |
| g.log(100).each do |commit| | |
| actual = commit.author.date | |
| future = actual + 6.months | |
| %x(git filter-branch -f --commit-filter ' | |
| if [ "$GIT_COMMIT" = "#{commit.sha}" ] | |
| then | |
| export GIT_AUTHOR_DATE="#{future.asctime}"; | |
| export GIT_COMMITTER_DATE="#{future.asctime}"; | |
| git commit-tree "$@"; | |
| else | |
| git commit-tree "$@"; | |
| fi' HEAD) | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
References