# HG changeset patch # User Oleksandr Gavenko # Date 1543442411 -7200 # Node ID a2940bea3a6d331b3490913e633fe3f906fcddb3 # Parent e69cc87ded5da63609b9eda40c46fe8e29597863 Updated mygit-date to accept hour+minute, assume current day + random seconds. diff -r e69cc87ded5d -r a2940bea3a6d .bashrc --- a/.bashrc Tue Oct 16 08:43:53 2018 +0300 +++ b/.bashrc Thu Nov 29 00:00:11 2018 +0200 @@ -250,7 +250,16 @@ ag --nofilename --count -- "$1" | awk '{c += $1} END {print c}' } +# "YYYY-MM-DD hh:mm:ss" or "hh:mm" for current day and random sec. mygit-date() { + if [[ "02:23" =~ ^[0-9]{2}:[0-9]{2}$ ]]; then + local sec=$(($RANDOM % 60)) + if [[ ${#sec} = 1 ]]; then + sec=0$sec + fi + local yyyymmdd=`date +%F` + set "$yyyymmdd $1:$sec" + fi echo GIT_COMMITTER_DATE='"'"$1"'"' git commit --amend --no-edit --date '"'"$1"'"' GIT_COMMITTER_DATE="$1" git commit --amend --no-edit --date "$1" }