VS Code हर Commit में "Co-Authored-by Copilot" जोड़ता है
VS Code का Copilot एक्सटेंशन चुपचाप आपके हर commit में Co-Authored-by ट्रेलर जोड़ देता है — भले ही आपने खुद हर लाइन लिखी हो। इसे रोकने का सटीक तरीका यहाँ है।
Co-authored-by: GitHub Copilot ट्रेलर जोड़ता है — जब भी वह उन्हें generate करने में शामिल होता है — और कभी-कभी तब भी जब नहीं होता। इससे attribution रिकॉर्ड, open-source योगदान इतिहास, और संभावित रूप से नियोक्ता IP नीतियाँ प्रभावित होती हैं। आप इसे git hook, VS Code settings बदलाव, या global gitconfig नियम से रोक सकते हैं — प्रत्येक के अलग-अलग trade-off हैं।अगर आपने हाल ही में अपना git log देखा है और अपने द्वारा पूरी तरह लिखे commit संदेशों के नीचे कोई अपरिचित पंक्ति नज़र आई है, तो आप गलत नहीं हैं। GitHub Copilot — या अधिक सटीक रूप से, VS Code Copilot एक्सटेंशन — उस push में बिना एक भी पंक्ति छुए चुपचाप commits पर अपना नाम co-author के रूप में लगा रहा है। यह कोई षड्यंत्र नहीं है; यह एक opt-out-by-default attribution प्रणाली है जिसे अधिकांश डेवलपर्स ने कभी जानबूझकर स्वीकार नहीं किया। आगे बताया गया है कि injection कैसे काम करता है, GitHub ने इसे इस तरह क्यों बनाया, और — सबसे उपयोगी — कौन सी settings, hooks, और configs इसे रोकेंगी।
ट्रेलर वास्तव में कैसा दिखता है
कुछ भी ठीक करने से पहले, यह जानना ज़रूरी है कि आप किससे निपट रहे हैं। इंजेक्ट किया गया टेक्स्ट एक मानक git commit trailer है — एक key-value pair जो आपके commit संदेश body के अंत में एक blank line के बाद जोड़ी जाती है। यह उसी format का पालन करता है जिसका उपयोग git interpret-trailers और Gerrit तथा GitHub की अपनी merge infrastructure जैसे tools करते हैं:
feat: add user authentication flow
Implement JWT-based login with refresh token rotation.
Co-authored-by: GitHub Copilot <github-copilot[bot]@users.noreply.github.com>
वह आखिरी पंक्ति वही है जो Copilot inject करता है। Email address github-copilot[bot]@users.noreply.github.com एक वास्तविक GitHub bot account है, जिसका मतलब है कि GitHub का contribution graph और commit attribution engine इसे वास्तव में co-authorship के रूप में register करता है — कोई comment नहीं, कोई metadata नहीं जिसे आप ignore कर सकें। एक बार push होने पर यह आपके commit history में permanently embed एक first-class git object है।
यह कहाँ दिखता है
- GitHub का commit view: commit में आपके avatar के साथ "Co-authored by GitHub Copilot" badge दिखेगा।
git log --format=full: ट्रेलर full commit body में दिखता है।git shortlog: parsing के आधार पर, Copilot project stats में contributor के रूप में दिख सकता है।- GitHub का contributor graph: bot account आपके repository पर contributor के रूप में register हो सकता है।
git rebase -i या git filter-branch) एक destructive operation है जो force-push करेगी और teammates की local histories को तोड़ देगी। रोकथाम, निवारण से काफी आसान है।जिस Commit में यह सबसे अधिक दिखता है
Injection तब सबसे aggressive होता है जब आप VS Code की Generate Commit Message feature का उपयोग करते हैं — Source Control sidebar में sparkle (✨) icon। इस पर click करें, Copilot एक संदेश draft करता है, और co-author ट्रेलर आपके confirm करने से पहले ही bundle हो जाता है। लेकिन डेवलपर्स की रिपोर्ट बताती है कि यह उन commits में भी दिखता है जहाँ संदेश manually लिखा गया था, खासकर अगर उस session में Copilot Chat active था और staged files में से किसी के लिए code generate करने हेतु उसका उपयोग किया गया था।
Injection के पीछे का तंत्र
GitHub Copilot का VS Code एक्सटेंशन VS Code के Source Control Manager (SCM) API के साथ low level पर integrate होता है। जब आप files stage करते हैं और commit message input box खोलते हैं, तो Copilot एक SCM input box provider के रूप में register हो जाता है और उस text field को prepopulate या modify कर सकता है — जिसमें आपके कुछ भी type करने से पहले programmatically trailers जोड़ना शामिल है।
यह कोई rogue feature नहीं है। यह GitHub की AI attribution philosophy से जुड़ा documented behavior है: अगर एक AI model ने किसी काम में substantially contribute किया है, तो GitHub का मानना है कि उस contribution को record किया जाना चाहिए। समस्या execution में है: "substantially contributed" को extension द्वारा बहुत broadly interpret किया गया है, और opt-out UX कई menus की गहराई में दबा है — बजाय एक prominent first-run prompt के।
VS Code का SCM API यह कैसे Enable करता है
VS Code vscode.scm.inputBox और related APIs expose करता है जिनमें extensions hook कर सकते हैं। Copilot extension इसका उपयोग करता है:
- यह observe करने के लिए कि कौन सी files staged हैं और उनके diffs क्या हैं।
- यह determine करने के लिए कि editing के दौरान Copilot invoke किया गया था (या केवल active था)।
- Copilot API के माध्यम से एक commit संदेश generate करने के लिए।
- संदेश — ट्रेलर सहित — को submit से पहले commit input field में inject करने के लिए।
Injection VS Code में client-side होता है, GitHub के servers पर नहीं, जिसका मतलब है कि server-side rules या branch protections इसे आपके history में enter होने से पहले नहीं पकड़ सकते।
क्या Generate Feature का उपयोग किए बिना भी यह होता है?
हाँ — और यही वह हिस्सा है जो डेवलपर्स को सबसे अधिक निराश करता है। Users report करते हैं कि ट्रेलर तब भी दिखता है जब:
- उन्होंने commit संदेश manually लिखा था (sparkle button के माध्यम से नहीं)।
- Staged changes 100% hand-typed थे।
- Copilot Chat open था लेकिन current task के लिए उसे consult नहीं किया गया था।
"Copilot involved था" के लिए extension का heuristic loose है। अगर diff में किसी भी file के लिए editing session के दौरान Copilot active था — भले ही आपने हर suggestion dismiss कर दी हो — तो वह फिर भी ट्रेलर append कर सकता है। यही complaint का core है: यह actual AI contribution के लिए attribution नहीं है, यह निकटता के आधार पर attribution है।
यह Aesthetics से परे क्यों मायने रखता है
आपके git log में एक ghost co-author एक cosmetic annoyance की तरह लग सकता है, लेकिन यह तय करने से पहले कि आपको कितनी तेज़ी से act करना है, कुछ real downstream consequences हैं जिन्हें समझना ज़रूरी है।
बौद्धिक संपदा और नियोक्ता नीतियाँ
कई नियोक्ता — विशेष रूप से finance, healthcare, और defense contracting जैसे regulated industries में — AI-generated code के बारे में explicit IP policies रखते हैं। एक proprietary codebase में commit पर Co-authored-by: GitHub Copilot लाइन एक documented record है कि उस code के निर्माण में AI tooling शामिल था। भले ही Copilot ने केवल एक closing bracket autocomplete की हो, वह ट्रेलर एक audit trail बनाता है जिसे legal teams को address करने की आवश्यकता हो सकती है।
अगर आपकी company ने production code के लिए Copilot के उपयोग को explicitly clear नहीं किया है, तो यह ट्रेलर एक ऐसी liability है जिसके लिए आपने sign up नहीं किया।
Open-Source Licensing के निहितार्थ
AI-generated code की legal status और copyleft licenses (GPL, AGPL) के साथ उसकी compatibility अभी भी unsettled है। Strict contribution policies वाले projects Copilot attribution वाले commits को reject कर सकते हैं या history rewrites की माँग कर सकते हैं — FSF और अन्य organizations ने इस पर positions publish किए हैं। अगर आप एक open-source project maintain कर रहे हैं जिसमें contributors clean provenance की उम्मीद रखते हैं, तो आपके history में Copilot trailers उसे और जटिल बना देते हैं।
Contributor आँकड़े और Hiring Portfolios
GitHub profiles और contribution graphs का उपयोग तेज़ी से informal portfolios के रूप में हो रहा है — recruiters द्वारा, potential collaborators द्वारा, conference program committees द्वारा। आपके public repositories में commits पर एक bot को co-author के रूप में list करना उस attribution signal को धुंधला करता है जो वे graphs provide करने के लिए हैं। यह एक छोटी बात है, लेकिन यह आपकी history है।
इसे रोकने के चार तरीके
कोई एकल canonical fix नहीं है जो हर workflow के लिए काम करे। सही approach इस पर निर्भर करती है कि आप global solution चाहते हैं, per-repository override, या कुछ ऐसा जो Copilot की commit message generation preserve करे लेकिन केवल ट्रेलर strip करे।
विकल्प 1 — VS Code Extension Settings
सबसे direct route VS Code की settings में से behavior को disable करना है। Settings खोलें (Ctrl+, या Cmd+,), फिर "copilot commit" खोजें। आप GitHub Copilot extension के अंतर्गत commit message generation और co-author attribution से संबंधित options देख रहे हैं।
settings.json में, relevant configuration path इस तरह दिखती है:
{
"github.copilot.chat.generateCommitMessage.enabled": false
}
Commit message generation को पूरी तरह disable करने से injection source पर रुक जाता है — Copilot commit input field को populate नहीं करेगा, इसलिए ट्रेलर append करने का कोई अवसर नहीं होगा। अगर आप अभी भी AI-assisted commit messages चाहते हैं लेकिन attribution line के बिना, तो extension के कुछ versions co-author ट्रेलर के लिए एक अलग toggle expose करते हैं। अपने installed version में क्या उपलब्ध है यह जाँचने के लिए VS Code sidebar में Extensions > GitHub Copilot > Settings पर जाएं, क्योंकि exact setting names Copilot extension releases में बदलते रहे हैं।
विकल्प 2 — Git Hook (सबसे Reliable)
एक prepare-commit-msg hook commit message editor खुलने से पहले automatically चलता है, और यह surgically Copilot ट्रेलर को remove कर सकता है — चाहे वह कैसे भी आया हो। यह approach VS Code से independent काम करती है, extension updates से बची रहती है, और repository में आपके द्वारा उपयोग किए जाने वाले किसी भी git client पर apply होती है।
.git/hooks/prepare-commit-msg पर hook file बनाएं:
#!/bin/sh
# Strip GitHub Copilot co-author trailer from commit messages
sed -i '/^Co-authored-by: GitHub Copilot/Id' "$1"
फिर इसे executable बनाएं:
chmod +x .git/hooks/prepare-commit-msg
Team-wide solution के लिए, repository में committed एक shared hooks directory का उपयोग करें और git को इसका उपयोग करने के लिए configure करें:
# In .gitconfig or the repo's local config
git config core.hooksPath .githooks
फिर अपना hook .githooks/prepare-commit-msg में ऊपर वाले समान content के साथ commit करें। हर developer जो repo clone करता है और git config core.hooksPath .githooks चलाता है (या अगर आप इसे एक setup script में automate करते हैं) उसके पास stripping behavior apply होगा।
sed पर -i flag file को in-place edit करता है। macOS पर, BSD sed को एक explicit backup extension की आवश्यकता होती है: sed -i '' '/^Co-authored-by: GitHub Copilot/Id' "$1"। अगर आपकी team Linux और macOS दोनों का उपयोग करती है तो एक shell conditional जोड़ें।विकल्प 3 — Per Workspace Copilot Disable करें
अगर आपकी चिंता repository-specific है (जैसे, कोई client project या strict provenance rules वाला open-source repo), तो आप उस workspace के लिए Copilot को पूरी तरह disable कर सकते हैं बिना अपना global setup छुए। Repository root में, .vscode/settings.json बनाएं या edit करें:
{
"github.copilot.enable": {
"*": false
}
}
यह उस workspace में केवल सभी Copilot features — completions, chat, और commit message generation — को disable करता है। जब आप किसी personal project पर switch करते हैं, तो Copilot normally behave करता है। नुकसान यह है कि आप उस repo में केवल co-author injection नहीं बल्कि सभी Copilot सहायता खो देते हैं।
विकल्प 4 — Global gitconfig Cleanup Rule
अगर आप ट्रेलर को कई tools और environments से commits में leak होते देख रहे हैं (न केवल VS Code), तो आपके home directory के git template में एक global prepare-commit-msg hook सब कुछ cover करता है:
# Set a global hooks template directory
git config --global init.templateDir ~/.git-templates
# Create the directory and hook
mkdir -p ~/.git-templates/hooks
cat > ~/.git-templates/hooks/prepare-commit-msg << 'EOF'
#!/bin/sh
sed -i '/^Co-authored-by: GitHub Copilot/Id' "$1"
EOF
chmod +x ~/.git-templates/hooks/prepare-commit-msg
इस बिंदु के बाद आपके द्वारा initialize या clone की गई कोई भी नई repository automatically इस hook को inherit करेगी। मौजूदा repositories के लिए, repo root में git init चलाएं — यह मौजूदा repos पर safe है और आपकी history को छुए बिना template hooks copy करेगा।
अपने विकल्पों की तुलना
| Method | Scope | Trailer हटाता है | Completions Preserve करता है | Team-Shareable | Extension Updates Survive करता है |
|---|---|---|---|---|---|
| VS Code setting (gen disable) | Global या workspace | हाँ | नहीं | settings.json commit के माध्यम से | हाँ |
prepare-commit-msg hook (local) |
Per repository | हाँ | हाँ | .githooks/ pattern के माध्यम से |
हाँ |
Workspace disable (copilot.enable) |
Per repository | हाँ | नहीं | .vscode/settings.json के माध्यम से |
हाँ |
| Global git template hook | सभी repos (नए + भविष्य) | हाँ | हाँ | नहीं (user-level) | हाँ |
| Copilot extension पूरी तरह disable | Global | हाँ | नहीं | N/A | N/A |
Copilot completions रखना चाहने वाले individuals के लिए सबसे अच्छा: prepare-commit-msg hook + global template।
Shared policies वाली teams के लिए सबसे अच्छा: Setup documentation के साथ committed .githooks/ directory।
Sensitive client repos के लिए सबसे अच्छा: Workspace-level copilot.enable: false को .vscode/settings.json में committed।
जो Commits पहले से इसे Contain करते हैं उन्हें Clean Up करना
अगर आप already किसी private repository पर Copilot ट्रेलर वाले commits push कर चुके हैं और history clean करना चाहते हैं, तो operation के लिए forced rewrite की आवश्यकता है। यह केवल उन branches पर करें जहाँ आप अकेले contributor हैं और आप commit SHAs बदलने के परिणामों को समझते हैं।
# Interactive rebase to edit recent commits
git rebase -i HEAD~10
# For each offending commit, mark it 'reword' then remove the trailer line
# Or use filter-branch for bulk cleaning:
git filter-branch --msg-filter \
'sed "/^Co-authored-by: GitHub Copilot/Id"' \
HEAD~20..HEAD
Rewriting के बाद, आपको force-push करना होगा:
git push --force-with-lease origin your-branch
--force-with-lease, --force से safer है क्योंकि यह push करने से refuse करेगा अगर आपके last fetch के बाद किसी और ने branch पर push किया हो। यह public shared branches की रक्षा नहीं करेगा — personal feature branch के अलावा किसी भी चीज़ पर यह करने से पहले अपनी team से coordinate करें।उन repositories के लिए जो पहले से public GitHub पर push हो चुकी हैं और जहाँ आप history rewrite नहीं करना चाहते, pragmatic answer यह है: अपने project के CONTRIBUTING file में situation document करें, आगे के लिए एक hook add करें, और accept करें कि पुराने commits जो हैं वही हैं। Active public repos पर history rewrites उनसे अधिक problems पैदा करती हैं जो solve होती हैं।
Quick Checklist
अपनी situation के आधार पर इन्हें क्रम में काम करें:
- Confirm करें कि आप ट्रेलर देख रहे हैं:
git log --format=full -5चलाएं और किसी भी commit body के नीचेCo-authored-by: GitHub Copilotदेखें। - प्रभावित repository में
prepare-commit-msghook install करें — यह सबसे कम friction, highest-reliability वाला fix है। - अपनी VS Code Copilot settings जाँचें: Settings खोलें, "copilot commit" search करें, और अगर आप sparkle button का उपयोग नहीं करते तो commit message generation disable करें।
- Sensitive repositories के लिए: एक
.vscode/settings.jsonadd करें जो उस workspace के लिए Copilot disable करे, और इसे commit करें ताकि teammates को setting inherit हो। - Team environments के लिए: एक
.githooks/directory बनाएं,prepare-commit-msgscript add करें, इसे commit करें, और अपने project के setup instructions या Makefile मेंgit config core.hooksPath .githooksadd करें। - Global git template set करें अगर आप कई personal repos में काम करते हैं और set-it-and-forget-it coverage चाहते हैं।
- Shared branches पर recent commits audit करें:
git log --grep="Co-authored-by: GitHub Copilot" --onelineका उपयोग करके यह तय करने से पहले affected commits ढूंढें कि history cleanup warranted है या नहीं। - Verify करें कि fix काम करता है: एक file stage करें, VS Code को commit dialog खोलने दें, और commit confirm करने से पहले जाँचें कि ट्रेलर absent है।
Sources & Further Reading
-
GitHub Docs — Commit Trailer Attribution — GitHub की official documentation जो बताती है कि co-author trailers GitHub के contribution graph में कैसे काम करते हैं और repository statistics तथा pull request attribution के लिए
Co-authored-byformat का क्या अर्थ है। -
VS Code GitHub Copilot Extension Changelog (marketplace.visualstudio.com) — Copilot extension के release notes document करते हैं कि commit message generation कब introduce किया गया और attribution behavior में बाद में क्या बदलाव आए; late 2023 के बाद के versions खोजें।
-
git-scm.com — githooks Documentation —
prepare-commit-msghook, उसके invocation context, arguments, और यह विभिन्न git clients में commit process के साथ कैसे interact करता है, इसके लिए authoritative reference। -
Software Freedom Conservancy — Copyleft and AI-Generated Code — SFC का published analysis कि AI model outputs GPL और AGPL licensing obligations के साथ कैसे interact करते हैं — उन open-source maintainers के लिए relevant जो अपने projects में Copilot attribution को कैसे handle करें यह तय कर रहे हैं।
-
GitHub Community Forum — "Copilot adding Co-authored-by without my input" — Ongoing developer discussion threads जो injection behavior के real-world cases, user-confirmed workarounds, और intended design बनाम reported edge cases के बारे में GitHub staff responses document करते हैं।