Skip to content

Instantly share code, notes, and snippets.

@NicolasGeraud
Created March 20, 2016 10:24
Show Gist options
  • Save NicolasGeraud/ef5dd9205aec64eded65 to your computer and use it in GitHub Desktop.
Save NicolasGeraud/ef5dd9205aec64eded65 to your computer and use it in GitHub Desktop.
git filter-branch -f --env-filter '
LANG=en_US.utf8
original_git_date="$GIT_COMMITTER_DATE"
cutDate=$(echo $original_git_date | rev | cut -d" " -f2 |rev)
hour=$(date --date "$cutDate" +%H)
day=$(date --date "$cutDate" +%u)
new_git_date=$(date --date "$cutDate" +"%a %b %d %T %Y")
if [ "$hour" -gt "9" ] && [ "$hour" -lt "19" ] && [ "$day" -lt "6" ]
then
new_git_date=$(date --date "$new_git_date 9 hours" +"%a %b %d %T %Y %z")
fi
export GIT_AUTHOR_DATE="$new_git_date"
export GIT_COMMITTER_DATE="$new_git_date"
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment