How do you sign off on commits in Git?
Posted by DavidLee
Last Updated: June 12, 2024
In Git, you can sign off on commits using the --signoff (or -s) option when you create a commit. This adds a "Signed-off-by" line at the end of your commit message, which is often required for projects that follow the Developer Certificate of Origin (DCO). Here's how to do it:
Signing off on a commit:
1. With the command line: When you create a commit, you can use:
git commit -s -m "Your commit message"
This will automatically add your name and email address to the commit message as a "Signed-off-by" line. 2. Using git commit without -m: You can also open an editor to write your commit message:
git commit -s
In the editor, you can write your commit message, and when you save and exit, Git will append the Signed-off-by line automatically based on your Git configuration.
Configuring your identity:
Make sure your Git user name and email are set up correctly, as these will be used in the Signed-off-by line. You can set them up with the following commands if you haven't already:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Example of a commit message with sign-off:
Fix typo in documentation

Signed-off-by: Your Name <your.email@example.com>
Checking for sign-off in commits:
You can also check if a commit is signed off by looking for the "Signed-off-by" line in the commit message:
git log
You can also use the --show-signature option:
git log --show-signature
Conclusion
Signing off on commits helps maintain the integrity of contributions and signals agreement to the project's contribution terms. Always check the contribution guidelines for the specific project you are working with to see if sign-off is required.