http://blog.projectrhinestone.org/one-liner-for-changing-all-git-repos-license-times/
pwd=$(pwd);for file in ~/GitHub/*/LICENSE;do cd $(dirname $file);git checkout master;stash=$(git diff LICENSE);if [ -n "$stash" ];then git stash;fi;sed -i "" -e "s/\(Copyright (c) \)[0-9]\{4\}\(-[0-9]\{4\}\)*/\1$(git log $(git log --pretty=format:%H|tail -1) --date=format:%Y --format=%ad)-$(date +%Y)/" LICENSE;git commit -m "Update time for copyright message in license" LICENSE;if [ -n "$stash" ];then git stash pop;fi;git push;done;cd $pwd
自行修改路徑,隨便開個 term 窗口 paste 進去就可以了。 POSIX 兼容。 Tested on OS X Yosemite Version 10.10.5 (14F27).
效果:
