|
| 1 | +# Developer Certificate of Origin (DCO) |
| 2 | + |
| 3 | +## What is DCO? |
| 4 | + |
| 5 | +The Developer Certificate of Origin (DCO) is a lightweight way for contributors to certify that they wrote or otherwise have the right to submit the code they are contributing to the project. |
| 6 | + |
| 7 | +## How to Sign Off Your Commits |
| 8 | + |
| 9 | +### For New Commits |
| 10 | +Use the `-s` flag when committing: |
| 11 | +```bash |
| 12 | +git commit -s -m "your commit message" |
| 13 | +``` |
| 14 | + |
| 15 | +### For Existing Commits |
| 16 | + |
| 17 | +#### Single Commit |
| 18 | +```bash |
| 19 | +git commit --amend -s |
| 20 | +``` |
| 21 | + |
| 22 | +#### Multiple Commits |
| 23 | +```bash |
| 24 | +# For the last n commits |
| 25 | +git rebase --signoff HEAD~n |
| 26 | + |
| 27 | +# For all commits in your branch |
| 28 | +git rebase --signoff main |
| 29 | +``` |
| 30 | + |
| 31 | +### Manual Sign-off |
| 32 | +Add this line to your commit message: |
| 33 | +``` |
| 34 | +Signed-off-by: Your Name <[email protected]> |
| 35 | +``` |
| 36 | + |
| 37 | +## DCO Text |
| 38 | + |
| 39 | +By making a contribution to this project, I certify that: |
| 40 | + |
| 41 | +1. The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or |
| 42 | + |
| 43 | +2. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or |
| 44 | + |
| 45 | +3. The contribution was provided directly to me by some other person who certified (1), (2) or (3) and I have not modified it. |
| 46 | + |
| 47 | +4. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. |
| 48 | + |
| 49 | +## Troubleshooting |
| 50 | + |
| 51 | +### Check if commits are signed |
| 52 | +```bash |
| 53 | +git log --show-signature |
| 54 | +``` |
| 55 | + |
| 56 | +### Configure git for automatic sign-off |
| 57 | +```bash |
| 58 | +git config --global user.name "Your Name" |
| 59 | +git config --global user.email "[email protected]" |
| 60 | +``` |
| 61 | + |
| 62 | +### Create an alias for signed commits |
| 63 | +```bash |
| 64 | +git config --global alias.cs 'commit -s' |
| 65 | +``` |
| 66 | + |
| 67 | +Then use `git cs -m "message"` instead of `git commit -s -m "message"`. |
| 68 | + |
| 69 | +## Why DCO? |
| 70 | + |
| 71 | +- **Legal Protection**: Provides legal protection for both contributors and maintainers |
| 72 | +- **Simple Process**: Lightweight alternative to Contributor License Agreements (CLAs) |
| 73 | +- **Transparency**: Creates a clear audit trail of contributions |
| 74 | +- **Industry Standard**: Used by major projects like Linux kernel, Docker, and many CNCF projects |
0 commit comments