From 7a76a4498ff7c3be787b0f7406d51d1c2a9949c6 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 22 Apr 2017 22:00:46 -0400 Subject: [PATCH] Add vcs/git/bin/git-old-commit --- vcs/git/bin/git-old-commit | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 vcs/git/bin/git-old-commit diff --git a/vcs/git/bin/git-old-commit b/vcs/git/bin/git-old-commit new file mode 100755 index 00000000..808fc517 --- /dev/null +++ b/vcs/git/bin/git-old-commit @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Commits to a local git repository with a timestamp different from when it was +# actually committed. I use this to push old projects with more relevant dates +# (i.e. when they were authored) and to correct clerical mistakes involving lost +# or accidental commits. +# +# Example: git old-commit "-5 years -2 months -11 days -1 hours -19 seconds" "commit message here" + +D="$(date --date='-5 years -2 months -11 days -1 hours -19 seconds')" +GIT_COMMITTER_DATE="$D" GIT_AUTHOR_DATE="$D" git commit -m "$2"