You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在IntelliJ IDEA中配置git-duet实现结对提交?

Does IntelliJ IDEA support git-duet for pair programming commits? How to configure it?

Great question! Yes, IntelliJ IDEA does support git-duet for pair programming commits—you just need to set it up properly to integrate with IDEA's Git tooling. Here's a straightforward, step-by-step guide to get it working:

Prerequisite First

Make sure you've already installed git-duet on your local machine and completed its basic setup:

  • Add your pair programming partners' details to the ~/.git-authors file
  • Set up your own initials and default preferences using git-duet's initialization commands (like git duet init)

Step 1: Configure IDEA to use your system Git executable

IntelliJ comes with a built-in Git client, but git-duet relies on your system's Git configuration and hooks to work correctly. To switch:

  • Open IDEA's Settings (Windows/Linux: File > Settings; Mac: IntelliJ IDEA > Settings)
  • Navigate to Version Control > Git
  • In the "Path to Git executable" field, select your system's Git binary (e.g., /usr/bin/git on macOS/Linux, C:\Program Files\Git\bin\git.exe on Windows) instead of the built-in option.
  • Click Test to verify IDEA can connect to this Git instance, then save the settings.

Git-duet uses a commit template to automatically inject pair programming author details into your commit messages. To make IDEA use this template:

  • Go back to Settings, then navigate to Version Control > Commit
  • In the "Commit message" section, check the box for Use commit template
  • In the template path field, enter the path to git-duet's default template (usually ~/.gitmessage). You can confirm this path by running git config --global commit.template in your terminal.

Step 3: Activate git-duet for your session before committing

Before you make any commits in IDEA, you need to set the current pair using git-duet. You can do this directly in IDEA's built-in Terminal:

  • Open the Terminal tab at the bottom of IDEA
  • Run git duet <your-initials> <your-pair's-initials> (e.g., git duet rp sk if your initials are RP and your pair's are SK)
  • This tells git-duet to attach both authors to all subsequent commits in this session.

Step 4: Verify your setup

Make a test commit in IDEA, then check the commit details to confirm both authors are included. You can run git log --pretty=full in the terminal to see the full author and committer information—you should see both pair members listed.

If things aren't working as expected, try restarting IDEA to ensure it picks up the new Git configuration, or double-check that your ~/.git-authors file has correct entries for you and your partners.

Hope this helps you smooth out your pair programming workflow in IntelliJ!

内容的提问来源于stack exchange,提问作者Pramod S. Nikam

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 12:34:14