Skip to content

Instantly share code, notes, and snippets.

@pawelrubin
Last active January 10, 2020 01:05
Show Gist options
  • Save pawelrubin/3ed0d8a987870c8c4b020de0fc211446 to your computer and use it in GitHub Desktop.
Save pawelrubin/3ed0d8a987870c8c4b020de0fc211446 to your computer and use it in GitHub Desktop.
shell function for making commits with faked date. Just add it to your `~/.bashrc`.
function fake_commit {
local date=$1
local message=$2
export GIT_{AUTHOR,COMMITTER}_DATE="$(LC_TIME=en_US date -d "$date")"
git commit -m "$message"
unset GIT_{AUTHOR,COMMITTER}_DATE
}
@pawelrubin
Copy link
Author

Example usage

$ touch dummy_file
$ git add dummy_file 
$ fake_commit "5 days ago" "dummy file added"
[master (root-commit) 85a4f04] dummy file added
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 dummy_file
$ git graph 
* (5 days ago) Pawel Rubin 85a4f04 (HEAD -> master) dummy file added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment