Skip to content

Commit 4b10fe7

Browse files
committed
Create AI-Assisted Authorship section
1 parent 03ab8bc commit 4b10fe7

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

docs/developer-experience/copilots.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,8 @@ Chat AI tools are only as good as the prompts you give them. The quality and app
6868

6969
## Considerations
7070

71-
It is important when using AI tools to understand how the data (including private or commercial code) might be used by the system. Read more about how GitHub Copilot handles your data and code [here](https://resources.github.com/copilot-for-business/).
71+
If you make use of AI tools, consider the following:
72+
73+
* It is important when using AI tools to understand how the data (including private or commercial code) might be used by the system. Read more about how GitHub Copilot handles your data and code [here](https://resources.github.com/copilot-for-business/).
74+
75+
* You may want to consider how you will handle [attribution of AI-generated code](../source-control/git-guidance/README.md#ai-assisted-code-authorship) for accountability, code review, and auditing purposes.

docs/source-control/git-guidance/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,41 @@ For more information on commit message conventions, see:
270270
* [Information in commit messages](https://wiki.openstack.org/wiki/GitCommitMessages#Information_in_commit_messages)
271271
* [On commit messages](http://who-t.blogspot.com/2009/12/on-commit-messages.html)
272272
273+
### AI-Assisted Code Authorship
274+
275+
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:
298+
299+
```sh
300+
git commit --message "Implement feature" --trailer "Assistant-model: GPT-4o"
301+
```
302+
303+
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:
304+
```sh
305+
git log --color --pretty=format:"%C(yellow)%h%C(reset) %C(blue)%an%C(reset) [%C(magenta)%(trailers:key=Assistant-model,valueonly=true,separator=%x2C)%C(reset)] %s%C(bold cyan)%d%C(reset)"
306+
```
307+
273308
## Managing Remotes
274309
275310
A local git repository can have one or more backing remote repositories. You can list the remote repositories using `git remote` - by default, the remote repository you cloned from will be called origin

0 commit comments

Comments
 (0)