Change a Copyright Notice in a Git Repository

Every year I find myself going through my open source projects and changing the copyright notices. This year I’m doing it via the terminal, and it only takes two commands.

sudo find /var/www/htdocs/community_auth_ci_3 -type f -print0 | xargs -0 sed -i "s/Copyright (c) 2011 - 2017, Robert B Gottier/Copyright (c) 2011 - 2018, Robert B Gottier/g"

sudo find /var/www/htdocs/community_auth_ci_3/.git -type f -print0 | xargs -0 sed -i "s/Copyright (c) 2011 - 2018, Robert B Gottier/Copyright (c) 2011 - 2017, Robert B Gottier/g"

Notice the second command reverts the changes made to the .git directory. This is necessary, or else the git index may be corrupted.

Posted in