19 مايو 2026

ثلاثة مشاريع تشتغل بنفس اللحظة — Three Projects Running At Once

ثلاثة مشاريع تشتغل بنفس اللحظة
الـ Worktrees هي السبب اللي يخلي المطور المتمرس يسلّم أسرع منك بمرات.
 
لما تكون في وسط شغل على فيتشر جديد ويجيك طلب عاجل، وش تسوي؟ تحفظ شغلك، تبدّل الفرع، تحل المشكلة، ترجع، وتقضي عشر دقايق تتفكر وين وقفت. هذا التبديل المستمر ما هو مجرد إزعاج، هو وقت حقيقي ضايع وتشتت فعلي. المطور المتمرس ما يبدّل الفرع أصلاً، يفتح مجلداً ثانياً ويكمل من هناك.
 
🧩 إيش هو بالضبط
 
الـ Git Worktree هي ميزة مدمجة داخل Git نفسه، ما تحتاج تثبّت أي شيء إضافي. الفكرة ببساطة إن نفس الـ repository (المستودع) يقدر يكون مفتوحاً في أكثر من مجلد على جهازك في نفس الوقت، وكل مجلد على فرع (branch) مختلف تماماً.
 
تخيل إن مشروعك هو مطبخ كبير وفيه أكثر من طاولة شغل. كل طاولة عليها طبق مختلف تشتغل عليه، بس كل الطباخين يسحبون المقادير من نفس المخزن. ما في طاولة تتأثر بالثانية، وكل شيء يسير بشكل مستقل.
 
⚙️ كيف يشتغل
 
Git بطبيعته يسمح لك بفرع واحد نشط في كل وقت. لما تكتب git switch، يبدّل كل الملفات في مجلدك لتطابق الفرع الجديد. الـ Worktree يكسر هذا القيد بطريقة ذكية.
 
لما تنشئ worktree جديد، Git يعمل مجلداً منفصلاً على جهازك مرتبطاً بنفس الـ repository. الاثنان يشاركان نفس تاريخ الـ commits، بس ملفات كل واحد معزولة تماماً عن الثاني. يعني تقدر تشتغل على ثلاث أشياء في نفس اللحظة بدون أي تعارض.
 
سيناريو ملموس: أنت تشتغل على فيتشر الدفع في مشروعك. جاءك بلاغ إن في باغ عاجل في صفحة تسجيل الدخول. بدل ما تشيل شغلك:
 
1️⃣ تكتب أمر واحد تنشئ فيه worktree جديد على فرع الإصلاح
2️⃣ تفتح المجلد الجديد في محرر منفصل وتصلح الباغ
3️⃣ تعمل commit وترسل الإصلاح للريبو
4️⃣ ترجع على مجلدك الأصلي وتكمل شغل الـ payment feature بالضبط من نفس النقطة، بدون أي تغيير
 
🌍 وين تشوفه في حياتك
 
هذي الميزة مش بس للمطورين في الشركات الكبيرة. أي شخص عنده مشروع يتطور بسرعة يستفيد منها.
 
🤖 اللي يستخدم Claude Code: الذكاء الاصطناعي (AI) يقدر يشتغل على ثلاث مهام بالتوازي في worktrees منفصلة بينما أنت تراجع النتائج. هذا بالضبط كيف يتضاعف إنتاجك.
🧑‍💻 المطور المستقل: يخدم أكثر من عميل على نفس الكود بدون ما يخلط بين تعديلاتهم، لأن شغل كل عميل موجود في مجلده الخاص.
🏗️ فرق التطوير: المطور يفتح worktree لمهمته بدون ما يلمس شغل باقي الفريق، وكل شخص يكمل بشكل مستقل.
🔬 الاختبار والمقارنة: تشغّل نسخة الإنتاج ونسخة التطوير في نفس الوقت على جهازك وتقارن بينهم مباشرة.
 
🛠️ الأدوات اللي تستخدمها فعلاً
 
🔧 Git
Git نفسه هو الأداة الأساسية والـ Worktree مدمج فيه. ما تحتاج تثبّت أي شيء إضافي على الإطلاق.
كيف تبدأ:
1️⃣ تأكد إن Git مثبّت عندك: اكتب git --version في الـ terminal
2️⃣ إذا ما كان موجوداً، حمّله من git-scm.com
3️⃣ الأمر الأساسي اللي تحتاجه: git worktree add ../اسم-المجلد اسم-الفرع
 
🔧 VS Code
محرر الكود الأشهر يدعم فتح أكثر من نافذة في نفس الوقت، وكل نافذة تشير لـ worktree مختلف. هذا يخليك تشوف الكودين جنباً لجنب.
كيف تبدأ:
1️⃣ حمّله من code.visualstudio.com إذا ما كان عندك
2️⃣ بعد إنشاء الـ worktree، افتح مجلده بكتابة: code ../اسم-المجلد في الـ terminal
3️⃣ عندك الحين نافذتان مستقلتان تماماً، كل واحدة على فرع مختلف، وتقدر تشتغل على الاثنين بنفس الوقت
 
🔧 GitHub Desktop
واجهة رسومية لـ Git تسهّل تصفح الفروع والـ commits بدون أوامر نصية. مفيدة لتتابع ما يصير في مشروعك بشكل بصري واضح.
كيف تبدأ:
1️⃣ حمّله من desktop.github.com
2️⃣ افتح مشروعك الموجود فيه
3️⃣ استخدمه جنباً لجنب مع الـ terminal لأن إنشاء الـ worktrees يحتاج أمر نصي، بس الواجهة تعطيك صورة واضحة لكل الفروع والتاريخ
 
💡 جرّب بنفسك: خطوة بخطوة
 
السيناريو: عندك مشروع ويب وتريد تصلح باغ عاجل بينما تكمل شغل على فيتشر جديد.
 
1️⃣ افتح الـ terminal وروح على مجلد مشروعك: cd my-project
2️⃣ أنشئ worktree جديد على فرع جديد للإصلاح: git worktree add ../my-project-fix -b fix/login
3️⃣ افتح المجلد الجديد في VS Code بكتابة: code ../my-project-fix وصلح الباغ وعمل commit
4️⃣ ارجع على نافذة مشروعك الأصلي واستمر في شغلك بالضبط من نفس النقطة، بدون أي تغيير أو تشتت
 
لما تخلص من الإصلاح وتدمجه، تحذف الـ worktree بأمر واحد: git worktree remove ../my-project-fix
 
وش تسوي بعد ذا
 
✅ أنشئ worktree واحد الحين على أي مشروع عندك، حتى لو بس عشان تشوف كيف يبدو المجلد الجديد على جهازك
✅ اكتب git worktree list وشوف كيف يتتبع Git كل الـ worktrees النشطة عندك في نفس اللحظة
✅ لو تستخدم Claude Code، كلّفه بمهمتين بالتوازي في worktrees منفصلة وراقب كيف يتعامل مع العزل بين المهام
 
القيد الحقيقي في التطوير ليس المعرفة، بل التشتت.
 
———— English ————
 
Three Projects Running At Once
Worktrees are how senior devs stay in flow while everyone else is stuck stashing and switching.
 
If you have ever been deep in a feature and had an urgent bug report land in your lap, you know the cost. You stash your work, switch branches, fix the bug, switch back, unstash, and spend ten minutes reconstructing your mental state. That context switching is not just annoying — it is one of the biggest hidden drains in software development. Worktrees eliminate it entirely.
 
What it actually is
 
A Git worktree is a feature built directly into Git that lets you check out multiple branches at the same time, each in its own separate folder on your machine. Not a copy of the repo. Not a fresh clone. The same repository, living in two or three places simultaneously, each folder tracking a different branch independently.
 
Think of it like having multiple desks in one office. Each desk has a different project spread across it. You walk from one desk to another without touching anything on the others. Nothing gets mixed up, nothing disappears, and you pick up exactly where you left off on each one.
 
⚙️ How it works
 
Git normally allows only one active branch per repository folder. When you run git switch, it rewrites all the files in your directory to match the new branch. Worktrees bypass this by creating linked working directories that each track their own branch.
 
Here is what happens when you add a worktree:
 
1️⃣ Git creates a new folder on your machine pointing to your existing repository
2️⃣ You specify which branch that new folder should track
3️⃣ Git checks out that branch's files into the new folder only
4️⃣ Your original folder stays completely untouched on its current branch
 
The two folders share the same git history, the same commits, and the same remote connection. They are simply working on different branches at the same time without interfering with each other.
 
🌿 Feature branch: your main folder keeps developing the new feature without interruption
🐛 Hotfix branch: the new worktree folder handles the urgent fix in parallel
🔀 Shared history: both worktrees see all past commits and push to the same remote
 
Where you see it
 
This is not an obscure power-user trick. It shows up naturally in workflows you probably already care about.
 
🤖 AI-assisted development: Claude Code uses worktrees to run multiple tasks in parallel. While you review the output on one task, it is already working on the next one in a separate worktree. This is how AI-assisted development actually multiplies your output.
🧑‍💻 Freelance work: serve multiple clients on one codebase without ever mixing up their changes, because each client's work lives in its own folder.
🏗️ Release engineering: keep a production branch open in one worktree for hotfixes while the development branch continues moving forward in another.
🔬 Testing and comparison: run two versions of your app simultaneously on the same machine and compare their behavior side by side in real time.
 
🛠️ Tools you actually use
 
🔧 Git
Git ships with worktree support built in. No plugins, no extensions, no extra installs required.
How to get started:
1️⃣ Confirm Git is installed by running git --version in your terminal
2️⃣ If not installed, download it from git-scm.com
3️⃣ The core command you need: git worktree add ../folder-name branch-name
 
🔧 VS Code
The most widely used code editor handles multiple worktrees cleanly by letting you open multiple windows, each pointing to a different worktree folder. You see both codebases at once.
How to get started:
1️⃣ Download from code.visualstudio.com if not already installed
2️⃣ After creating a worktree, open it in a new window with: code ../folder-name
3️⃣ You now have two fully independent editor windows running at the same time, each on its own branch
 
🔧 GitHub Desktop
A graphical interface for Git that makes browsing branches, commits, and history easier without the terminal. Useful for keeping a visual overview of what is happening across your project.
How to get started:
1️⃣ Download from desktop.github.com
2️⃣ Open your existing repository in the app
3️⃣ Use it alongside the terminal — worktree creation still needs a command, but the app gives you a clean visual layout of all branches and their state
 
💡 Try it yourself: step by step
 
Scenario: you are working on a new feature and an urgent login bug just came in. You want to fix it without losing your current work.
 
1️⃣ Open your terminal and navigate to your project: cd my-project
2️⃣ Create a new worktree on a new branch for the fix: git worktree add ../my-project-fix -b fix/login
3️⃣ Open the new folder in VS Code with: code ../my-project-fix then fix the bug and commit it from there
4️⃣ Return to your original terminal window and keep working on the feature exactly where you left off — nothing was touched, nothing was stashed, no context lost
 
When the fix is merged and done, remove the worktree cleanly with: git worktree remove ../my-project-fix
 
What to do next
 
✅ Create one worktree right now on any existing project, even just to see what the new folder looks like on your machine
✅ Run git worktree list and see how Git tracks all active worktrees simultaneously
✅ If you use Claude Code, assign it two tasks in parallel across separate worktrees and watch how it handles the isolation between them
 
The developers who ship fastest are not the ones who type faster — they are the ones who never lose their place.

الاكثر قيمة

ابدا البناء معي الآن

نجلس معا، نحلل مشكلتك، وابني لك الحل بالذكاء الاصطناعي خطوة بخطوة

60دقيقة
  • جلسة خاصة معك
  • بناء حقيقي خلال الجلسة
  • نتائج تاخذها معك فور الانتهاء
احجز جلسة بناء

مجانا 100%

استشارة مجانية حول مشكلتك

ابدا

المسار الكامل · اشتراك شهري

وصول كامل لكل الأدلة (29) بـ249 AED/شهر