https://github.com/stephanlachnit/update_copyright_years
Update copyright years in a git repo
https://github.com/stephanlachnit/update_copyright_years
copyright git python python3
Last synced: 2 months ago
JSON representation
Update copyright years in a git repo
- Host: GitHub
- URL: https://github.com/stephanlachnit/update_copyright_years
- Owner: stephanlachnit
- License: mit
- Created: 2022-01-20T17:57:59.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-24T13:38:47.000Z (over 3 years ago)
- Last Synced: 2025-06-26T02:42:08.766Z (about 1 year ago)
- Topics: copyright, git, python, python3
- Language: Python
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Update copyright years for files in a git repository
[](https://github.com/stephanlachnit/update_copyright_years/actions/workflows/lint.yml)
[](https://api.reuse.software/info/github.com/stephanlachnit/update_copyright_years)
This Python script can automatically update the copyright year range for files in a git repository.
The initial year is determined via `git log --follow --format=%ad `, meaning it takes the year when the first commit for a particular file - following renames - was authored. All times are taken in UTC.
You can check the commits on a particular file yourself using `git log --follow --reverse `.
To aviod replacing random number that happen to match the pattern, you can specify an appendix and prependix to the regex pattern, or provide your own regex pattern.
You can also specify to only run the script on certain paths and specify paths to exclude.
The interace is given below:
```
usage: update_copyright_years.py [-h] [-v] [-a APPENDIX] [-p PREPENDIX] [-y YEARS] [-x EXCLUDE [EXCLUDE ...]] [-f FILES [FILES ...]]
Update copyright years for files in a git repo.
optional arguments:
-h, --help show this help message and exit
-v, --verbose enable verbose output
-a APPENDIX, --appendix APPENDIX
pattern to append to year matching, i.e.
-p PREPENDIX, --prependix PREPENDIX
pattern to prepend to year matching, i.e.
-y YEARS, --years YEARS
regex pattern to match years
-x EXCLUDE [EXCLUDE ...], --exclude EXCLUDE [EXCLUDE ...]
files to exclude
-f FILES [FILES ...], --files FILES [FILES ...]
only run on specified files
```