Skip to content

Commit 8da2726

Browse files
docs: clarify all commits must be signed in signing.md (#459) (#464)
Signed-off-by: Zaki-Mohd <[email protected]> Signed-off-by: exploreriii <[email protected]> Co-authored-by: exploreriii <[email protected]>
1 parent 3de4726 commit 8da2726

File tree

2 files changed

+90
-30
lines changed

2 files changed

+90
-30
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
7979
- Added checksum validation for TokenId
8080
- Refactor examples/token_cancel_airdrop
8181
- Refactor token creation examples for modularity and consistency
82+
- Updated `signing.md` to clarify commit signing requirements, including DCO, GPG, and branch-specific guidelines (#459)
83+
84+
### Changed
85+
8286
- Rearranged running_examples.md to be alphabetical
8387
- Refactor token_associate.py for better structure, add association verification query (#367)
8488
- Refactored `examples/account_create.py` to improve modularity and readability (#363)

docs/sdk_developers/signing.md

Lines changed: 86 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
To contribute to this repository, **both DCO sign-off and GPG signature verification** are required for your commits to be merged successfully.
44

5-
This guide walks you through how to correctly configure and sign your commits.
5+
This guide walks you through how to correctly configure and sign your commits, and how to ensure **all commits are properly signed**.
66

77
---
88

99
## 🛡️ Why Commit Signing?
1010

11-
- **DCO (`Signed-off-by`)** ensures you agree to the developer certificate of origin.
12-
- **GPG Signature** proves the commit was authored by a trusted and verified identity.
11+
* **DCO (`Signed-off-by`)** ensures you agree to the developer certificate of origin.
12+
* **GPG Signature** proves the commit was authored by a trusted and verified identity.
1313

1414
---
1515

@@ -25,22 +25,21 @@ gpg --full-generate-key
2525

2626
Choose:
2727

28-
Kind: RSA and RSA
29-
30-
Key size: 4096
31-
32-
Expiration: 0 (or choose as per your need)
33-
34-
Name, Email: Must match your GitHub email
35-
36-
Passphrase: Set a strong passphrase
28+
* Kind: RSA and RSA
29+
* Key size: 4096
30+
* Expiration: 0 (or choose as per your need)
31+
* Name, Email: Must match your GitHub email
32+
* Passphrase: Set a strong passphrase
3733

3834
To list your keys:
3935

4036
```bash
41-
gpg --list-secret-keys --keyid-format LONG
37+
gpg --list-secret-keys --keyid-format LONG
4238
```
43-
Copy the key ID (it looks like 34AA6DBC)
39+
40+
Copy the key ID (looks like `34AA6DBC`).
41+
42+
---
4443

4544
### 2. Add Your GPG Key to GitHub
4645

@@ -49,35 +48,69 @@ Export your GPG public key:
4948
```bash
5049
gpg --armor --export YOUR_KEY_ID
5150
```
52-
Paste the output into GitHub here:
5351

52+
Paste the output into GitHub:
53+
54+
* [Add GPG key on Github](https://github.com/settings/gpg/new)
5455

55-
- [Add GPG key on Github ](https://github.com/settings/gpg/new)
56+
---
5657

57-
### 3. Tell Git to Use Your GPG Key
58+
### 3. Configure Git to Use Your GPG Key
5859

5960
```bash
6061
git config --global user.signingkey YOUR_KEY_ID
6162
git config --global commit.gpgsign true
6263
```
6364

64-
### 4. Make a Signed Commit
65+
---
66+
67+
## ✨ Make Signed Commits
6568

66-
Use both DCO sign-off and GPG signing:
69+
**All commits must be signed using both DCO and GPG.**
6770

6871
```bash
6972
git commit -S -s -m "chore: your commit message"
7073
```
7174

72-
-S = GPG sign
73-
-s = DCO sign-off
75+
* `-S` = GPG sign
76+
* `-s` = DCO sign-off
77+
78+
> ⚠️ Ensure **every commit** in your branch follows this rule.
7479
75-
### Fixing an Unsigned Commit
80+
---
81+
82+
## 🛠️ Fixing Unsigned Commits
83+
84+
If you accidentally forgot to sign commits, there are **two ways to fix them**:
85+
86+
### 1. Soft Reverting Commits (Recommended for New Contributors)
87+
88+
Soft revert the impacted commits while keeping changes locally:
89+
90+
```bash
91+
git reset --soft HEAD~n
92+
```
93+
94+
* `HEADn` = number of commits to go back
95+
* Example: To fix the last 3 commits: `git reset --soft HEAD`
7696

77-
If you forgot to sign or DCO a commit:
97+
Then, recommit each commit with proper signing:
98+
99+
```bash
100+
git commit -S -s -m "chore: your commit message"
101+
```
102+
103+
Repeat for each impacted commit.
104+
105+
---
106+
107+
### 2. Retroactively Signing Commits
108+
109+
Alternatively, you can **amend commits retroactively**:
78110

79111
```bash
80112
git commit --amend -S -s
113+
git rebase -i HEAD~n # For multiple commits
81114
git push --force-with-lease
82115
```
83116
## Rebasing and Signing
@@ -91,16 +124,39 @@ When rebasing, you must use this command to ensure your commits remain verified:
91124
git rebase main -S
92125
```
93126

127+
> **Note:** `--force-with-lease` safely updates the remote branch without overwriting others’ changes.
128+
129+
---
130+
131+
## ✅ Verify Signed Status of Commits
132+
133+
To check that your commits are signed correctly:
134+
135+
```bash
136+
git log --show-signature
137+
```
138+
139+
* Ensure each commit shows both **GPG verified** and **DCO signed-off**.
140+
* For a quick check of recent commits:
141+
142+
```bash
143+
git log -n 5 --pretty=format:'%h %an %G? %s'
144+
```
145+
146+
* `G?` column shows the signature status (`G` = good, `B` = bad, `U` = unsigned)
147+
148+
---
149+
94150
## ✅ Final Checklist
95151

96-
- [ ] Signed your commit with `-S`
97-
- [ ] Added DCO with `-s`
98-
- [ ] GPG key is added to GitHub
99-
- [ ] Verified badge appears in PR
152+
* [ ] All commits signed with `-S`
153+
* [ ] DCO added with `-s`
154+
* [ ] GPG key added to GitHub
155+
* [ ] Verified badge appears in PR
100156

157+
---
101158

102159
### Still Need Help?
103160

104-
If you run into issues:
105-
106-
- Refer to [GitHub’s GPG Docs](https://docs.github.com/en/authentication/managing-commit-signature-verification)
161+
* Refer to [GitHub’s GPG Docs](https://docs.github.com/en/authentication/managing-commit-signature-verification)
162+
* Ask maintainers on the **Hiero Discord** if stuck

0 commit comments

Comments
 (0)