Skip to content

Kind 1617: Git Patch

Overview

Kind 1617 defines a Git patch event in the Nostr ecosystem. It enables users to propose changes to Git repositories announced on Nostr by sharing patches in the same format produced by git format-patch. This facilitates distributed code collaboration through Nostr's decentralized network.

Specification

PropertyValue
Kind Number1617
Event RangeRegular Event
Defined inNIP-34

Content Format

The content field contains a Git patch in the format produced by the git format-patch command. This is a plain text representation of proposed changes to a Git repository.

Schema

From 94c27b2afb9d4d8ae68de1a52f47ccca05a6d8a7 Mon Sep 17 00:00:00 2001
From: John Doe <[email protected]>
Date: Sat, 4 May 2025 10:48:52 -0500
Subject: [PATCH] Add new feature

Add a new feature that does something useful.

---
 file.txt | 2 ++
 1 file changed, 2 insertions(+)
 
diff --git a/file.txt b/file.txt
index 1234567..abcdefg 100644
--- a/file.txt
+++ b/file.txt
@@ -10,6 +10,8 @@ Existing content
+New line 1
+New line 2
 More existing content
 
 -- 
2.40.1

Tags

Tag NameDescriptionFormatRequired
aBase repository address["a", "30617:<base-repo-owner-pubkey>:<base-repo-id>"]Yes
rEarliest unique commit ID of repo["r", "<earliest-unique-commit-id-of-repo>"]No
pRepository owner["p", "<repository-owner>"]Yes
pOther user to notify["p", "<other-user>"]No
tRoot patch indicator["t", "root"]Only for the first patch in a series
tRoot revision indicator["t", "root-revision"]Only for the first patch in a revision
commitCurrent commit ID["commit", "<current-commit-id>"]No
rReference to commit["r", "<current-commit-id>"]No
parent-commitParent commit ID["parent-commit", "<parent-commit-id>"]No
commit-pgp-sigPGP signature of commit["commit-pgp-sig", "-----BEGIN PGP SIGNATURE-----..."]No
committerCommitter information["committer", "<n>", "<email>", "<timestamp>", "<timezone offset in minutes>"]No
eReply to previous patch["e", "<previous-patch-id>", "", "reply"]No

Client Behavior

Clients should:

  • Display patches in a readable format, possibly with syntax highlighting for diffs.
  • Enable users to view the full patch series by following the chain of e tags.
  • Allow users to send patches to repositories they're following.
  • Send patches to the relays specified in the repository's announcement event.
  • Include appropriate tags to maintain the relationship between patches in a series.
  • For patch revisions, include an e tag pointing to the original root patch.
  • Properly handle "cover letters" (descriptive patches without actual changes) when they are the first in a series.

Relay Behavior

Relays should:

  • Store these events according to NIP-01 guidelines.
  • No special handling is required beyond standard event handling.

Use Cases

  • Proposing code changes to open-source repositories.
  • Collaborating on code without needing direct push access to repositories.
  • Creating and managing patch series for complex changes.
  • Revising patches based on feedback from repository maintainers.
  • Notifying specific users about patches that may interest them.
  • Providing cover letters to explain complex patch sets.

Example

json
{
  "id": "fa21e7bad229f3937893c3d695dac889c148bd911ee444da9b306191c05b76d5",
  "pubkey": "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245",
  "created_at": 1677168023,
  "kind": 1617,
  "tags": [
    ["a", "30617:32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245:nostr-protocol"],
    ["r", "a7f5135e2dc4869588e3e0c56fc69a1187fec193b9b00e96bbee7e330bd2033e"],
    ["p", "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"],
    ["t", "root"],
    ["commit", "e0a88c97b0f2a7cc9b0f3ef20fd5c9970ef40a5c"],
    ["r", "e0a88c97b0f2a7cc9b0f3ef20fd5c9970ef40a5c"],
    ["parent-commit", "a722f8a0ed2e5b43b6573eb11d7c30069d8e23ba"],
    ["committer", "John Smith", "[email protected]", "1677168000", "-300"]
  ],
  "content": "From e0a88c97b0f2a7cc9b0f3ef20fd5c9970ef40a5c Mon Sep 17 00:00:00 2001\nFrom: John Smith <[email protected]>\nDate: Thu, 23 Feb 2023 15:00:00 +0300\nSubject: [PATCH] Add new feature\n\nThis patch adds a new feature that improves performance.\n\n---\n src/main.rs | 10 ++++++++++\n 1 file changed, 10 insertions(+)\n\ndiff --git a/src/main.rs b/src/main.rs\nindex 1234567..abcdefg 100644\n--- a/src/main.rs\n+++ b/src/main.rs\n@@ -100,6 +100,16 @@ fn main() {\n     // Existing code\n+    // New feature implementation\n+    let config = Config::from_env();\n+    let result = process_input(&config);\n+    \n+    if let Err(e) = result {\n+        eprintln!(\"Error: {}\", e);\n+        std::process::exit(1);\n+    }\n+    \n+    println!(\"Processing complete\");\n+    \n     // More existing code\n }\n \n-- \n2.39.1\n",
  "sig": "8b54d44f5effd7b2f1319d4d9c26ae16df0af24b34943181dd5ac03f1d9a8c1d7f3572e20c459072bc2aac239db818e89f5539f0f4aa89d029a9203aeccd293b"
}

References

  • Kind 30617: Git Repository Announcement
  • Kind 30618: Git Repository State Announcement
  • Kind 1621: Git Issue
  • Kinds 1630-1633: Git Status Events (Open, Applied/Merged, Closed, Draft)

Notes

Patches in a patch set should include a NIP-10 e reply tag pointing to the previous patch in the series.

The first patch in a revision should include a NIP-10 e reply tag pointing to the original root patch.

The first patch in a series may be a "cover letter" in the format produced by git format-patch --cover-letter. This is a descriptive patch without actual changes that explains the patch set as a whole.

The optional tags (commit, parent-commit, commit-pgp-sig, committer) are necessary when the maintainer wants to ensure that the resulting commit has the same ID as it had in the proposer's machine.