DEV Community

Orbit Websites
Orbit Websites

Posted on

Enabling AI Co-Authorship by Default in VSCode: A Game-Changing Pull Request

Enabling AI Co-Authorship by Default in VSCode: A Game-Changing Pull Request

AI is transforming how we write code — and now, it's becoming a first-class collaborator in your Git history. A recent pull request in the GitHub Copilot and VS Code ecosystem enables AI co-authorship by default, meaning every time you accept AI-generated code, it can be automatically attributed in your commits.

This isn’t just about credit — it’s about transparency, collaboration, and future-proofing your development workflow.

In this step-by-step tutorial, you’ll learn how to enable AI co-authorship in VS Code using the latest features, so your AI assistant shows up as a co-author in your Git commits — just like a human teammate.


🔧 Prerequisites

Before we begin, ensure you have:

💡 No prior experience with Git co-authors required.


Step 1: Enable AI Co-Authorship in VS Code Settings

The feature is controlled via a new VS Code setting. Open your settings:

Option A: GUI Method

  1. Open VS Code
  2. Press Ctrl + , (or Cmd + , on macOS) to open Settings
  3. Search for: github.copilot.git.coauthor
  4. Check the box: GitHub > Copilot: Git Coauthor

Option B: Edit settings.json (Recommended)

  1. Press Ctrl + Shift + P to open the Command Palette
  2. Type: Preferences: Open Settings (JSON)
  3. Add this line:
{
  "github.copilot.git.coauthor": true
}
Enter fullscreen mode Exit fullscreen mode

✅ Save the file.

Now, every time you accept a Copilot suggestion, it will be eligible for co-authorship in your next commit.


Step 2: Write Code with Copilot (and Watch It Co-Author)

Let’s generate a simple script and see how AI gets credited.

Create a Test File

  1. In your project, create sum.js:
// Let's create a function to sum two numbers
Enter fullscreen mode Exit fullscreen mode
  1. Start typing:
function add(a, b)
Enter fullscreen mode Exit fullscreen mode

👉 Accept the Copilot suggestion (press Tab or Enter).

Your file should now look like:

function add(a, b) {
  return a + b;
}
Enter fullscreen mode Exit fullscreen mode
  1. Save the file.

✅ Copilot has now contributed — and because git.coauthor is enabled, it’s tracked.


Step 3: Commit with AI Co-Authorship

Now, let’s commit and see the magic.

Stage and Commit

In your terminal (inside the project):

git add sum.js
git commit -m "Add add function with Copilot"
Enter fullscreen mode Exit fullscreen mode

👉 That’s it. You don’t need special flags.

Behind the scenes, VS Code adds a special co-author trailer to your commit using the Co-authored-by: convention.


Step 4: Verify the AI Co-Author in Git History

Check your last commit:

git log -1 --pretty=format:%B
Enter fullscreen mode Exit fullscreen mode

You should see output like:

Add add function with Copilot

Co-authored-by: GitHub Copilot <copilot@github.com>
Enter fullscreen mode Exit fullscreen mode

🎉 AI is now a co-author!

This line tells Git and GitHub that Copilot contributed to the code — just like if a teammate had pair-programmed with you.


How It Works: The Technical Details

When you enable github.copilot.git.coauthor, VS Code does the following:

  1. Tracks accepted Copilot suggestions per file
  2. On commit, checks if any staged files contain AI-generated code
  3. If yes, automatically appends this trailer to your commit message:
Co-authored-by: GitHub Copilot <copilot@github.com>
Enter fullscreen mode Exit fullscreen mode

This uses the standard Git trailer format, which GitHub recognizes and displays.

📌 Note: This only happens if you accept Copilot suggestions in files being committed.


Step 5: View Co-Authorship on GitHub

Push your commit:

git push origin main
Enter fullscreen mode Exit fullscreen mode

Go to your repository on GitHub.

Open the commit. You’ll see:

This commit was authored by [Your Name] and GitHub Copilot.

Depending on GitHub’s UI updates, you may also see Copilot listed under “Contributors” or in the commit details.


Optional: Disable for Specific Commits

Want to skip AI co-authorship for a specific commit?

Use the --no-verify flag to bypass:

git commit -m "WIP: quick fix" --no-verify
Enter fullscreen mode Exit fullscreen mode

⚠️ This skips all Git hooks — use sparingly.

Alternatively, temporarily disable the setting in VS Code.


Why This Matters

1. Transparency

Knowing which code was AI-generated helps teams audit, review, and understand contributions.

2. Collaboration Culture

Treating AI as a team member encourages thoughtful use — not blind trust.

3. Future Tooling

Git history with AI attribution enables:

  • Better code archaeology
  • License and compliance tracking
  • AI contribution analytics

Troubleshooting

❌ Co-author line not appearing?

  • Confirm

Community-Focused

Top comments (0)