Add missing copyright headers to files based on git author information. Helps to make your project reuse compliant.
The script scans the current working directory for files that do not
contain a copyright header. It ignores files that would not be covered
by reuse lint. If a file is missing a copyright header, all authors
that are present in the git blame output (or git shortlog if the
--use-shortlog flag is set) are added to the header.
You can install this script using pip (requires Python 3.12+):
pip install .Furthermore git is required to be installed and available in the PATH, as the script uses git commands to determine authorship information.
We recommend to commit (or stash) your changes before running the script, as it will modify files in the current working directory. After running the script, you can then review the changes and modify them as needed before committing.
Run the script from the command line:
add-copyright-from-git [--use-shortlog]The script analyzes the current working directory and adds missing
copyright headers to files based on git blame information. Use the
--use-shortlog flag to use git shortlog instead of git blame for
author detection.
The script will not modify files that already contain a copyright header.