# Parallel Agents और Git Worktrees — एडवांस्ड Agent Workflows और Skills

Source: https://www.geekswithgeeks.com/hi/agent-workflows/sub-parallel-worktrees

> कई agents एक साथ चलाएँ बिना एक-दूसरे की files overwrite किए।

## Files भी अलग रखें

एक ही working directory में parallel agents आपस में टकराएँगे। **Git worktree** हर agent को अपनी branch पर अपना checkout देता है, जबकि repository history एक ही रहती है। बाद में branches को सामान्य pull requests की तरह merge करें।

## दो कामों के लिए दो worktrees

हर command नई branch पर एक पास का folder बनाता है। हर folder में एक agent शुरू करें।

```bash
git worktree add ../shop-fix-login -b fix/login
git worktree add ../shop-add-search -b feat/search
git worktree list
```

## सिर्फ़ स्वतंत्र काम parallel करें

जो दो काम एक ही files छूते हैं वे merge के समय फिर टकराएँगे। काम को module या feature की सीमा पर बाँटें और हर नतीजा ख़ुद review करने की अपेक्षा रखें।

**Quiz:** Git worktree हर agent को क्या देता है?

- [ ] अलग repository server
- [x] अपना checkout और branch
- [ ] Internet की copy
- [ ] अतिरिक्त model memory

*Answer:* अपना checkout और branch. अलग working directories agents को एक-दूसरे की files overwrite करने से रोकती हैं।
