You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developer-experience/copilots.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,3 +62,44 @@ Chat AI tools are only as good as the prompts you give them. The quality and app
62
62
63
63
If you make use of AI tools, it is important to understand how the data (including private or commercial code) might be used by the system. You can read more about how GitHub copilot handles your data and code at the [GitHub Copilot Privacy FAQ](https://github.com/features/copilot/#faq) and how to [manage Copilot policies](https://docs.github.com/en/copilot/how-tos/manage-your-account/manage-policies).
64
64
65
+
## Attributing AI-Assisted Code Authorship
66
+
67
+
When using AI tools to generate code, it can be beneficial to maintain transparency about authorship for accountability, code review, and auditing purposes. This can be done easily by using [Git trailers](https://git-scm.com/docs/git-interpret-trailers) that append structured metadata to the end of commit messages.
68
+
69
+
### Agentic Code Authorship
70
+
71
+
When using agentic AI tools to generate code, such as the GitHub Coding Agent feature where a GitHub issue (such as a story or task) can be assigned to a software engineering bot that analyzes the request, creates a branch, writes commits, and opens a pull request, authorship is typically attributed using tool-specific mechanisms that follow conventions similar to pair programming. For example, the GitHub Coding Agent creates its commits using the agent as an author with the supervising person acknowledged using the `Co-authored-by` trailer in the commit message. This allows AI-generated code to be attributed to the agent while still giving credit (and accountability) to the person who supervised or initiated the task.
72
+
73
+
### IDE Assistant Attribution
74
+
75
+
When using an AI coding assistant inside an IDE, such as the GitHub Copilot extension in Visual Studio Code, consider providing attribution in cases when the commit consists of primarily AI-generated code. This might occur when:
76
+
77
+
* More than 50% of the lines in the commit were generated by AI
78
+
* The AI provided the core logic or algorithmic approach
79
+
* Substantial code blocks were accepted from AI suggestions
80
+
81
+
This can be done by appending one or more custom trailers in the commit message, such as:
82
+
83
+
```text
84
+
Assistant-model: GPT-4o
85
+
```
86
+
87
+
Because most Git tooling expects `Co-authored-by` trailers to be formatted as email addresses, you should use a different trailer key to avoid confusion and to distinguish authorship from assistance.
88
+
89
+
Trailers can be added manually at the end of a commit message, or by using the `git commit` command with the `--trailer` option:
Trailers can be displayed using the [pretty formats](https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt-trailersoptions) option to `git log` command. For example, for a formatted history showing the hash, author name, and assistant models used for each commit:
Copy file name to clipboardExpand all lines: docs/source-control/git-guidance/README.md
+2-42Lines changed: 2 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -254,6 +254,7 @@ The essential parts of a commit message are:
254
254
255
255
* subject line: a short description of the commit, maximum 50 characters long
256
256
* body (optional): a longer description of the commit, wrapped at 72 characters, separated from the subject line by a blank line
257
+
* trailers (optional): additional metadata about the commit in the form of key-value pairs on separate lines such as `Co-authored-by: <name><email>` that can be used to indicate co-authors, reviewers, or other relevant information
257
258
258
259
You are free to structure commit messages; however, git commands like `git log` utilize above structure.
259
260
Therefore, it can be helpful to follow a convention within your team and to utilize git best.
@@ -269,48 +270,7 @@ For more information on commit message conventions, see:
269
270
* [How to Write Better Git Commit Messages](https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages)
270
271
* [Information in commit messages](https://wiki.openstack.org/wiki/GitCommitMessages#Information_in_commit_messages)
When using AI tools to generate code, it can be beneficial to maintain transparency about authorship for accountability, code review, and auditing purposes. This can be done easily by using [Git trailers](https://git-scm.com/docs/git-interpret-trailers) that append structured metadata to the end of commit messages.
276
-
277
-
#### Agentic Code Authorship
278
-
279
-
When using agentic AI tools to generate code, such as the GitHub Coding Agent feature where a GitHub issue (such as a story or task) can be assigned to a software engineering bot that analyzes the request, creates a branch, writes commits, and opens a pull request, authorship is typically attributed using tool-specific mechanisms that follow conventions similar to pair programming. For example, the GitHub Coding Agent creates its commits using the agent as an author with the supervising person acknowledged using the `Co-authored-by` trailer in the commit message. This allows AI-generated code to be attributed to the agent while still giving credit (and accountability) to the person who supervised or initiated the task.
280
-
281
-
#### IDE Assistant Attribution
282
-
283
-
When using an AI coding assistant inside an IDE, such as GitHub Copilot in Visual Studio Code, consider providing attribution in cases when the commit consists of primarily AI-generated code. This might occur when:
284
-
285
-
* More than 50% of the lines in the commit were generated by AI
286
-
* The AI provided the core logic or algorithmic approach
287
-
* Substantial code blocks were accepted from AI suggestions
288
-
289
-
This can be done by appending one or more custom trailers in the commit message, such as:
290
-
291
-
```text
292
-
Assistant-model: GPT-4o
293
-
```
294
-
295
-
Because most Git tooling expects `Co-authored-by` trailers to be formatted as email addresses, you should use a different trailer key to avoid confusion and to distinguish authorship from assistance.
296
-
297
-
Trailers can be added manually at the end of a commit message, or by using the `git commit`command with the `--trailer` option:
Trailers can be displayed using the [pretty formats](https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt-trailersoptions) option to `git log` command. For example, for a formatted history showing the hash, author name, and assistant models used for each commit:
0 commit comments