diff --git a/.github/workflows/build-pdf.yml b/.github/workflows/build-pdf.yml new file mode 100644 index 000000000..28893ce87 --- /dev/null +++ b/.github/workflows/build-pdf.yml @@ -0,0 +1,90 @@ +name: Build Pro Git PDF + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.1' + bundler-cache: true + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y fonts-liberation fonts-dejavu fonts-arabeyes fonts-farsiweb + + - name: Install Ruby dependencies + run: | + bundle install + + - name: Build PDF + run: | + bundle exec rake book:build_pdf + + - name: Build all formats (optional) + run: | + bundle exec rake book:build + continue-on-error: true + + - name: Upload PDF as artifact + uses: actions/upload-artifact@v4 + with: + name: progit-arabic-pdf + path: progit.pdf + if-no-files-found: error + + - name: Upload all formats + uses: actions/upload-artifact@v4 + with: + name: progit-arabic-all-formats + path: | + progit.pdf + progit.epub + progit.mobi + progit.html + if-no-files-found: ignore + + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + + - name: Create Release + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + uses: softprops/action-gh-release@v2 + with: + tag_name: build-${{ steps.date.outputs.date }}-${{ github.run_number }} + name: Pro Git العربية - ${{ steps.date.outputs.date }} + body: | + 📚 **كتاب Pro Git - الإصدار الثاني (العربية)** + + تم بناء الكتاب تلقائياً من الكود المصدري. + + ### الملفات المتاحة: + - 📄 `progit.pdf` - نسخة PDF (موصى بها) + - 📱 `progit.epub` - نسخة EPUB للقراء الإلكترونية + - 📖 `progit.mobi` - نسخة Kindle + - 🌐 `progit.html` - نسخة HTML + + **Build ID:** ${{ github.run_number }} + **Commit:** ${{ github.sha }} + files: | + progit.pdf + progit.epub + progit.mobi + progit.html + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + continue-on-error: true diff --git a/A-git-in-other-environments.asc b/A-git-in-other-environments.asc index 32d7f6168..491c7d091 100644 --- a/A-git-in-other-environments.asc +++ b/A-git-in-other-environments.asc @@ -1,11 +1,11 @@ [[A-git-in-other-environments]] [appendix] -== Git in Other Environments +== Git in Other Environments (غيت في البيئات الأخرى) -If you read through the whole book, you've learned a lot about how to use Git at the command line. -You can work with local files, connect your repository to others over a network, and work effectively with others. -But the story doesn't end there; Git is usually used as part of a larger ecosystem, and the terminal isn't always the best way to work with it. -Now we'll take a look at some of the other kinds of environments where Git can be useful, and how other applications (including yours) work alongside Git. +إذا قرأت الكتاب بأكمله، فقد تعلمت الكثير عن كيفية استخدام Git (غيت) من سطر الأوامر (command line). +يمكنك العمل مع الملفات المحلية (local files)، وربط مستودعك (repository) بالآخرين عبر شبكة (network)، والعمل بفعالية مع الآخرين. +لكن القصة لا تنتهي عند هذا الحد؛ يُستخدم Git (غيت) عادةً كجزء من نظام بيئي أكبر (larger ecosystem)، وليست المحطة الطرفية (terminal) دائماً أفضل طريقة للعمل معه. +الآن سنلقي نظرة على بعض الأنواع الأخرى من البيئات (environments) حيث يمكن أن يكون Git (غيت) مفيداً، وكيف تعمل التطبيقات الأخرى (بما في ذلك تطبيقاتك) جنباً إلى جنب مع Git (غيت). include::book/A-git-in-other-environments/sections/guis.asc[] @@ -23,6 +23,6 @@ include::book/A-git-in-other-environments/sections/zsh.asc[] include::book/A-git-in-other-environments/sections/powershell.asc[] -=== Summary +=== Summary (الملخص) -You've learned how to harness Git's power from inside the tools that you use during your everyday work, and also how to access Git repositories from your own programs. +لقد تعلمت كيفية تسخير قوة Git (غيت) من داخل الأدوات التي تستخدمها أثناء عملك اليومي، وأيضاً كيفية الوصول إلى مستودعات Git (Git repositories) من برامجك الخاصة. diff --git a/B-embedding-git-in-your-applications.asc b/B-embedding-git-in-your-applications.asc index f3e602979..d74021173 100644 --- a/B-embedding-git-in-your-applications.asc +++ b/B-embedding-git-in-your-applications.asc @@ -1,12 +1,12 @@ [[B-embedding-git-in-your-applications]] [appendix] -== Embedding Git in your Applications +== Embedding Git in your Applications (تضمين Git في تطبيقاتك) -If your application is for developers, chances are good that it could benefit from integration with source control. -Even non-developer applications, such as document editors, could potentially benefit from version-control features, and Git's model works very well for many different scenarios. +إذا كان تطبيقك موجهاً للمطورين (developers)، فهناك احتمالات جيدة بأنه قد يستفيد من التكامل (integration) مع التحكم في كود المصدر (source control). +حتى التطبيقات غير المخصصة للمطورين، مثل محرري المستندات (document editors)، يمكن أن تستفيد من ميزات التحكم في الإصدارات (version-control features)، ويعمل نموذج Git (غيت) بشكل جيد جداً في العديد من السيناريوهات المختلفة. -If you need to integrate Git with your application, you have essentially two options: spawn a shell and call the `git` command-line program, or embed a Git library into your application. -Here we'll cover command-line integration and several of the most popular embeddable Git libraries. +إذا كنت بحاجة إلى دمج Git (غيت) مع تطبيقك، فلديك أساساً خياران: تفريخ غلاف (spawn a shell) واستدعاء برنامج سطر أوامر `git`، أو تضمين مكتبة Git (embed a Git library) في تطبيقك. +سنغطي هنا تكامل سطر الأوامر (command-line integration) والعديد من مكتبات Git القابلة للتضمين (embeddable Git libraries) الأكثر شيوعاً. include::book/B-embedding-git/sections/command-line.asc[] diff --git a/C-git-commands.asc b/C-git-commands.asc index 3e3523ef7..c9c314871 100644 --- a/C-git-commands.asc +++ b/C-git-commands.asc @@ -1,71 +1,71 @@ [[C-git-commands]] [appendix] -== Git Commands +== Git Commands (أوامر Git) -Throughout the book we have introduced dozens of Git commands and have tried hard to introduce them within something of a narrative, adding more commands to the story slowly. -However, this leaves us with examples of usage of the commands somewhat scattered throughout the whole book. +خلال هذا الكتاب قدمنا العشرات من أوامر Git وحاولنا جاهدين تقديمها ضمن نوع من السرد (narrative)، مضيفين المزيد من الأوامر إلى القصة ببطء. +ومع ذلك، يتركنا هذا مع أمثلة على استخدام الأوامر مبعثرة (scattered) إلى حد ما في جميع أنحاء الكتاب. -In this appendix, we'll go through all the Git commands we addressed throughout the book, grouped roughly by what they're used for. -We'll talk about what each command very generally does and then point out where in the book you can find us having used it. +في هذا الملحق، سنستعرض جميع أوامر Git التي تناولناها في هذا الكتاب، مجمعة تقريباً حسب الغرض من استخدامها. +سنتحدث عما يفعله كل أمر بشكل عام جداً ثم نشير إلى مكان استخدامه في الكتاب. [TIP] ==== -You can abbreviate long options. -For example, you can type in `git commit --a`, which acts as if you typed `git commit --amend`. -This only works when the letters after `--` are unique for one option. -Do use the full option when writing scripts. +يمكنك اختصار الخيارات الطويلة (long options). +على سبيل المثال، يمكنك كتابة `git commit --a`، والذي يعمل كما لو كنت قد كتبت `git commit --amend`. +يعمل هذا فقط عندما تكون الأحرف التي تلي `--` فريدة لخيار واحد. +احرص على استخدام الخيار الكامل (full option) عند كتابة البرامج النصية (scripts). ==== -=== Setup and Config +=== Setup and Config (الإعداد والتكوين) -There are two commands that are used quite a lot, from the first invocations of Git to common every day tweaking and referencing, the `config` and `help` commands. +هناك أمران يتم استخدامهما كثيراً، بدءاً من الاستدعاءات (invocations) الأولى لـ Git وصولاً إلى التعديلات والمراجع اليومية الشائعة، وهما الأمريان `config` و `help`. ==== git config -Git has a default way of doing hundreds of things. -For a lot of these things, you can tell Git to default to doing them a different way, or set your preferences. -This involves everything from telling Git what your name is to specific terminal color preferences or what editor you use. -There are several files this command will read from and write to so you can set values globally or down to specific repositories. +لدى Git طريقة افتراضية (default way) للقيام بمئات الأشياء. +بالنسبة للعديد من هذه الأشياء، يمكنك إخبار Git بالقيام بها بطريقة مختلفة بشكل افتراضي، أو تعيين تفضيلاتك (preferences). +يتضمن هذا كل شيء بدءاً من إخبار Git باسمك إلى تفضيلات ألوان المحطة الطرفية (terminal color preferences) المحددة أو المحرر الذي تستخدمه. +هناك العديد من الملفات التي سيقرأ منها هذا الأمر ويكتب إليها بحيث يمكنك تعيين القيم بشكل عام (globally) أو حتى لمستودعات محددة (specific repositories). -The `git config` command has been used in nearly every chapter of the book. +تم استخدام أمر `git config` في كل فصل تقريباً من هذا الكتاب. -In <> we used it to specify our name, email address and editor preference before we even got started using Git. +في <> استخدمناه لتحديد اسمنا وعنوان بريدنا الإلكتروني والمحرر المفضل لدينا قبل أن نبدأ في استخدام Git. -In <> we showed how you could use it to create shorthand commands that expand to long option sequences so you don't have to type them every time. +في <> أوضحنا كيف يمكنك استخدامه لإنشاء أوامر مختصرة (shorthand commands) تتوسع إلى تسلسلات خيارات طويلة (long option sequences) حتى لا تضطر إلى كتابتها في كل مرة. -In <> we used it to make `--rebase` the default when you run `git pull`. +في <> استخدمناه لجعل `--rebase` هو الافتراضي (default) عند تشغيل `git pull`. -In <> we used it to set up a default store for your HTTP passwords. +في <> استخدمناه لإعداد مخزن افتراضي (default store) لكلمات مرور HTTP الخاصة بك. -In <> we showed how to set up smudge and clean filters on content coming in and out of Git. +في <> أوضحنا كيفية إعداد مرشحات التلطيخ والتنظيف (smudge and clean filters) على المحتوى القادم والخارج من Git. -Finally, basically the entirety of <> is dedicated to the command. +أخيراً، تم تخصيص معظم <> بالكامل لهذا الأمر. [[ch_core_editor]] -==== git config core.editor commands +==== git config core.editor commands (أوامر git config core.editor) -Accompanying the configuration instructions in <>, many editors can be set as follows: +مرافقة لتعليمات التكوين (configuration instructions) في <>، يمكن إعداد العديد من المحررات على النحو التالي: -.Exhaustive list of `core.editor` configuration commands +.Exhaustive list of `core.editor` configuration commands (قائمة شاملة بأوامر تكوين `core.editor`) [cols="1,2",options="header"] |============================== -|Editor | Configuration command +|المحرر (Editor) | أمر التكوين (Configuration command) |Atom |`git config --global core.editor "atom --wait"` |BBEdit (macOS, with command line tools) |`git config --global core.editor "bbedit -w"` |Emacs |`git config --global core.editor emacs` |Gedit (Linux) |`git config --global core.editor "gedit --wait --new-window"` -|Gvim (Windows 64-bit) |`git config --global core.editor "'C:\Program Files\Vim\vim72\gvim.exe' --nofork '%*'"` (Also see note below) +|Gvim (Windows 64-bit) |`git config --global core.editor "'C:\Program Files\Vim\vim72\gvim.exe' --nofork '%*'"` (انظر الملاحظة أدناه أيضاً) |Helix |`git config --global core.editor "hx"` |Kate (Linux) |`git config --global core.editor "kate --block"` |nano |`git config --global core.editor "nano -w"` |Notepad (Windows 64-bit) |`git config core.editor notepad` -|Notepad++ (Windows 64-bit) |`git config --global core.editor "'C:\Program Files\Notepad+\+\notepad++.exe' -multiInst -notabbar -nosession -noPlugin"` (Also see note below) +|Notepad++ (Windows 64-bit) |`git config --global core.editor "'C:\Program Files\Notepad+\+\notepad++.exe' -multiInst -notabbar -nosession -noPlugin"` (انظر الملاحظة أدناه أيضاً) |Scratch (Linux)|`git config --global core.editor "scratch-text-editor"` |Sublime Text (macOS) |`git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl --new-window --wait"` -|Sublime Text (Windows 64-bit) |`git config --global core.editor "'C:\Program Files\Sublime Text 3\sublime_text.exe' -w"` (Also see note below) +|Sublime Text (Windows 64-bit) |`git config --global core.editor "'C:\Program Files\Sublime Text 3\sublime_text.exe' -w"` (انظر الملاحظة أدناه أيضاً) |TextEdit (macOS)|`git config --global core.editor "open --wait-apps --new -e"` |Textmate |`git config --global core.editor "mate -w"` -|Textpad (Windows 64-bit) |`git config --global core.editor "'C:\Program Files\TextPad 5\TextPad.exe' -m"` (Also see note below) +|Textpad (Windows 64-bit) |`git config --global core.editor "'C:\Program Files\TextPad 5\TextPad.exe' -m"` (انظر الملاحظة أدناه أيضاً) |UltraEdit (Windows 64-bit) | `git config --global core.editor Uedit32` |Vim |`git config --global core.editor "vim --nofork"` |Visual Studio Code |`git config --global core.editor "code --wait"` @@ -76,506 +76,506 @@ Accompanying the configuration instructions in <>, [NOTE] ==== -If you have a 32-bit editor on a Windows 64-bit system, the program will be installed in `C:\Program Files (x86)\` rather than `C:\Program Files\` as in the table above. +إذا كان لديك محرر 32 بت (32-bit editor) على نظام تشغيل Windows 64 بت (Windows 64-bit system)، فسيتم تثبيت البرنامج في `C:\Program Files (x86)\` بدلاً من `C:\Program Files\` كما في الجدول أعلاه. ==== ==== git help -The `git help` command is used to show you all the documentation shipped with Git about any command. -While we're giving a rough overview of most of the more popular ones in this appendix, for a full listing of all of the possible options and flags for every command, you can always run `git help `. +يُستخدم أمر `git help` لعرض جميع الوثائق (documentation) المرفقة مع Git حول أي أمر. +بينما نقدم نظرة عامة تقريبية عن معظم الأوامر الأكثر شيوعاً في هذا الملحق، للحصول على قائمة كاملة بجميع الخيارات والعلامات (flags) الممكنة لكل أمر، يمكنك دائماً تشغيل `git help `. -We introduced the `git help` command in <> and showed you how to use it to find more information about the `git shell` in <>. +لقد قدمنا أمر `git help` في <> وأوضحنا لك كيفية استخدامه للعثور على مزيد من المعلومات حول `git shell` في <>. -=== Getting and Creating Projects +=== Getting and Creating Projects (الحصول على المشاريع وإنشاؤها) -There are two ways to get a Git repository. -One is to copy it from an existing repository on the network or elsewhere and the other is to create a new one in an existing directory. +هناك طريقتان للحصول على مستودع Git (Git repository). +إحداهما هي نسخه من مستودع موجود على الشبكة أو في أي مكان آخر والأخرى هي إنشاء مستودع جديد في دليل (directory) موجود. ==== git init -To take a directory and turn it into a new Git repository so you can start version controlling it, you can simply run `git init`. +لأخذ دليل (directory) وتحويله إلى مستودع Git (Git repository) جديد حتى تتمكن من البدء في التحكم في إصداراته، يمكنك ببساطة تشغيل `git init`. -We first introduce this in <>, where we show creating a brand new repository to start working with. +نقدم هذا لأول مرة في <>، حيث نوضح إنشاء مستودع جديد تماماً (brand new repository) للبدء في العمل معه. -We talk briefly about how you can change the default branch name from "`master`" in <>. +نتحدث باختصار عن كيف يمكنك تغيير اسم الفرع الافتراضي (default branch name) من "`master`" في <>. -We use this command to create an empty bare repository for a server in <>. +نستخدم هذا الأمر لإنشاء مستودع مجرد (bare repository) فارغ لخادم (server) في <>. -Finally, we go through some of the details of what it actually does behind the scenes in <>. +أخيراً، نستعرض بعض تفاصيل ما يفعله بالفعل خلف الكواليس في <>. ==== git clone -The `git clone` command is actually something of a wrapper around several other commands. -It creates a new directory, goes into it and runs `git init` to make it an empty Git repository, adds a remote (`git remote add`) to the URL that you pass it (by default named `origin`), runs a `git fetch` from that remote repository and then checks out the latest commit into your working directory with `git checkout`. +أمر `git clone` هو في الواقع نوع من الغلاف (wrapper) حول عدة أوامر أخرى. +فهو ينشئ دليلاً (directory) جديداً، ويدخله ويشغل `git init` لجعله مستودع Git فارغاً، ويضيف مستودعاً بعيداً (remote) (`git remote add`) إلى عنوان URL الذي تمرره إليه (يُسمى افتراضياً `origin`)، ويشغل `git fetch` من ذلك المستودع البعيد ثم يسحب (checks out) آخر تأكيد (latest commit) إلى دليل عملك (working directory) باستخدام `git checkout`. -The `git clone` command is used in dozens of places throughout the book, but we'll just list a few interesting places. +يتم استخدام أمر `git clone` في العشرات من الأماكن طوال الكتاب، لكننا سندرج فقط بعض الأماكن المثيرة للاهتمام. -It's basically introduced and explained in <>, where we go through a few examples. +تم تقديمه وشرحه بشكل أساسي في <>، حيث نستعرض بعض الأمثلة. -In <> we look at using the `--bare` option to create a copy of a Git repository with no working directory. +في <> نلقي نظرة على استخدام الخيار `--bare` لإنشاء نسخة من مستودع Git بدون دليل عمل (working directory). -In <> we use it to unbundle a bundled Git repository. +في <> نستخدمه لفك حزم (unbundle) مستودع Git محزوم (bundled Git repository). -Finally, in <> we learn the `--recurse-submodules` option to make cloning a repository with submodules a little simpler. +أخيراً، في <> نتعلم الخيار `--recurse-submodules` لجعل استنساخ مستودع يحتوي على وحدات فرعية (submodules) أسهل قليلاً. -Though it's used in many other places through the book, these are the ones that are somewhat unique or where it is used in ways that are a little different. +على الرغم من أنه يُستخدم في العديد من الأماكن الأخرى طوال الكتاب، إلا أن هذه هي الأماكن الفريدة إلى حد ما أو حيث يتم استخدامه بطرق مختلفة قليلاً. -=== Basic Snapshotting +=== Basic Snapshotting (اللقطات الأساسية) -For the basic workflow of staging content and committing it to your history, there are only a few basic commands. +بالنسبة لسير العمل (workflow) الأساسي لتجهيز المحتوى (staging content) وتأكيده (committing) في سجلك (history)، لا توجد سوى بضعة أوامر أساسية. ==== git add -The `git add` command adds content from the working directory into the staging area (or "`index`") for the next commit. -When the `git commit` command is run, by default it only looks at this staging area, so `git add` is used to craft what exactly you would like your next commit snapshot to look like. +يضيف أمر `git add` المحتوى من دليل العمل (working directory) إلى منطقة التجهيز (staging area) (أو "`الفهرس (index)`") للتأكيد التالي (next commit). +عند تشغيل أمر `git commit`، فإنه يبحث افتراضياً في منطقة التجهيز هذه فقط، لذلك يُستخدم `git add` لصياغة كيف تريد بالضبط أن تبدو لقطة التأكيد التالية الخاصة بك (next commit snapshot). -This command is an incredibly important command in Git and is mentioned or used dozens of times in this book. -We'll quickly cover some of the unique uses that can be found. +هذا الأمر هو أمر مهم للغاية في Git وتم ذكره أو استخدامه عشرات المرات في هذا الكتاب. +سنغطي بسرعة بعض الاستخدامات الفريدة التي يمكن العثور عليها. -We first introduce and explain `git add` in detail in <>. +نقدم ونشرح `git add` بالتفصيل لأول مرة في <>. -We mention how to use it to resolve merge conflicts in <>. +نذكر كيفية استخدامه لحل تعارضات الدمج (resolve merge conflicts) في <>. -We go over using it to interactively stage only specific parts of a modified file in <>. +نستعرض استخدامه لتجهيز (stage) أجزاء محددة (specific parts) فقط من ملف معدل (modified file) بشكل تفاعلي (interactively) في <>. -Finally, we emulate it at a low level in <>, so you can get an idea of what it's doing behind the scenes. +أخيراً، نقوم بمحاكاته (emulate) على مستوى منخفض في <>، حتى تتمكن من الحصول على فكرة عما يفعله خلف الكواليس. ==== git status -The `git status` command will show you the different states of files in your working directory and staging area. -Which files are modified and unstaged and which are staged but not yet committed. -In its normal form, it also will show you some basic hints on how to move files between these stages. +سيعرض لك أمر `git status` الحالات المختلفة (different states) للملفات في دليل عملك (working directory) ومنطقة التجهيز (staging area). +أي الملفات المعدلة (modified) وغير المجهزة (unstaged) وأيها مجهزة (staged) ولكن لم يتم تأكيدها (committed) بعد. +في شكله العادي، سيعرض لك أيضاً بعض التلميحات (hints) الأساسية حول كيفية نقل الملفات بين هذه المراحل (stages). -We first cover `status` in <>, both in its basic and simplified forms. -While we use it throughout the book, pretty much everything you can do with the `git status` command is covered there. +نغطي `status` لأول مرة في <>، سواء في أشكاله الأساسية أو المبسطة (simplified). +بينما نستخدمه طوال الكتاب، فإن كل ما يمكنك فعله باستخدام أمر `git status` يتم تغطيته تقريباً هناك. ==== git diff -The `git diff` command is used when you want to see differences between any two trees. -This could be the difference between your working environment and your staging area (`git diff` by itself), between your staging area and your last commit (`git diff --staged`), or between two commits (`git diff master branchB`). +يُستخدم أمر `git diff` عندما تريد رؤية الاختلافات (differences) بين أي شجرتين (trees). +قد يكون هذا هو الاختلاف بين بيئة عملك (working environment) ومنطقة التجهيز (staging area) (`git diff` بمفرده)، أو بين منطقة التجهيز وآخر تأكيد لك (`git diff --staged`)، أو بين تأكيدين (`git diff master branchB`). -We first look at the basic uses of `git diff` in <>, where we show how to see what changes are staged and which are not yet staged. +نلقي نظرة أولاً على الاستخدامات الأساسية لـ `git diff` في <>، حيث نوضح كيفية معرفة ما هي التغييرات المجهزة (staged) والتي لم يتم تجهيزها بعد (not yet staged). -We use it to look for possible whitespace issues before committing with the `--check` option in <>. +نستخدمه للبحث عن مشكلات المسافات البيضاء (whitespace issues) المحتملة قبل التأكيد (committing) باستخدام الخيار `--check` في <>. -We see how to check the differences between branches more effectively with the `git diff A...B` syntax in <>. +نرى كيفية التحقق من الاختلافات بين الفروع (branches) بشكل أكثر فعالية باستخدام بنية الجملة `git diff A...B` في <>. -We use it to filter out whitespace differences with `-b` and how to compare different stages of conflicted files with `--theirs`, `--ours` and `--base` in <>. +نستخدمه لتصفية (filter out) اختلافات المسافات البيضاء (whitespace differences) باستخدام `-b` وكيفية مقارنة المراحل المختلفة للملفات المتعارضة (conflicted files) مع `--theirs`، `--ours` و `--base` في <>. -Finally, we use it to effectively compare submodule changes with `--submodule` in <>. +أخيراً، نستخدمه لمقارنة تغييرات الوحدات الفرعية (submodule changes) بفعالية باستخدام `--submodule` في <>. ==== git difftool -The `git difftool` command simply launches an external tool to show you the difference between two trees in case you want to use something other than the built in `git diff` command. +يقوم أمر `git difftool` ببساطة بتشغيل أداة خارجية (external tool) لإظهار الفرق بين شجرتين (trees) في حال كنت تريد استخدام شيء آخر غير الأمر المدمج `git diff`. -We only briefly mention this in <>. +نذكر هذا باختصار فقط في <>. ==== git commit -The `git commit` command takes all the file contents that have been staged with `git add` and records a new permanent snapshot in the database and then moves the branch pointer on the current branch up to it. +يأخذ أمر `git commit` جميع محتويات الملفات التي تم تجهيزها (staged) بواسطة `git add` ويسجل لقطة دائمة جديدة (new permanent snapshot) في قاعدة البيانات ثم ينقل مؤشر الفرع (branch pointer) على الفرع الحالي إليها. -We first cover the basics of committing in <>. -There we also demonstrate how to use the `-a` flag to skip the `git add` step in daily workflows and how to use the `-m` flag to pass a commit message in on the command line instead of firing up an editor. +نغطي أساسيات التأكيد لأول مرة في <>. +هناك نوضح أيضاً كيفية استخدام العلامة (flag) `-a` لتخطي خطوة `git add` في مسارات العمل اليومية (daily workflows) وكيفية استخدام العلامة `-m` لتمرير رسالة تأكيد (commit message) في سطر الأوامر (command line) بدلاً من تشغيل محرر. -In <> we cover using the `--amend` option to redo the most recent commit. +في <> نغطي استخدام الخيار `--amend` لإعادة (redo) التأكيد الأخير. -In <>, we go into much more detail about what `git commit` does and why it does it like that. +في <>، نتعمق في تفاصيل ما يفعله `git commit` ولماذا يفعله بهذه الطريقة. -We looked at how to sign commits cryptographically with the `-S` flag in <>. +نظرنا في كيفية توقيع (sign) التأكيدات تشفيرياً (cryptographically) باستخدام العلامة `-S` في <>. -Finally, we take a look at what the `git commit` command does in the background and how it's actually implemented in <>. +أخيراً، نلقي نظرة على ما يفعله أمر `git commit` في الخلفية وكيف يتم تنفيذه بالفعل في <>. ==== git reset -The `git reset` command is primarily used to undo things, as you can possibly tell by the verb. -It moves around the `HEAD` pointer and optionally changes the `index` or staging area and can also optionally change the working directory if you use `--hard`. -This final option makes it possible for this command to lose your work if used incorrectly, so make sure you understand it before using it. +يُستخدم أمر `git reset` بشكل أساسي للتراجع (undo) عن الأشياء، كما يمكنك أن تخمن من الفعل. +إنه يحرك مؤشر `HEAD` ويغير اختيارياً `الفهرس (index)` أو منطقة التجهيز (staging area) ويمكنه أيضاً تغيير دليل العمل (working directory) اختيارياً إذا كنت تستخدم `--hard`. +هذا الخيار الأخير يجعل من الممكن لهذا الأمر أن يفقدك عملك إذا تم استخدامه بشكل غير صحيح، لذا تأكد من فهمك له قبل استخدامه. -We first effectively cover the simplest use of `git reset` in <>, where we use it to unstage a file we had run `git add` on. +نغطي بشكل فعال أبسط استخدام لـ `git reset` في <> لأول مرة، حيث نستخدمه لإلغاء تجهيز (unstage) ملف قمنا بتشغيل `git add` عليه. -We then cover it in quite some detail in <>, which is entirely devoted to explaining this command. +ثم نغطيه بتفصيل كبير في <>، وهو مخصص بالكامل لشرح هذا الأمر. -We use `git reset --hard` to abort a merge in <>, where we also use `git merge --abort`, which is a bit of a wrapper for the `git reset` command. +نستخدم `git reset --hard` لإجهاض (abort) دمج (merge) في <>، حيث نستخدم أيضاً `git merge --abort`، وهو نوع من الغلاف (wrapper) لأمر `git reset`. ==== git rm -The `git rm` command is used to remove files from the staging area and working directory for Git. -It is similar to `git add` in that it stages a removal of a file for the next commit. +يُستخدم أمر `git rm` لإزالة الملفات من منطقة التجهيز (staging area) ودليل العمل (working directory) لـ Git. +إنه مشابه لـ `git add` حيث أنه يُجهز (stages) إزالة ملف للتأكيد التالي. -We cover the `git rm` command in some detail in <>, including recursively removing files and only removing files from the staging area but leaving them in the working directory with `--cached`. +نغطي أمر `git rm` بشيء من التفصيل في <>، بما في ذلك إزالة الملفات بشكل متكرر (recursively) وإزالة الملفات من منطقة التجهيز فقط مع تركها في دليل العمل باستخدام `--cached`. -The only other differing use of `git rm` in the book is in <> where we briefly use and explain the `--ignore-unmatch` when running `git filter-branch`, which simply makes it not error out when the file we are trying to remove doesn't exist. -This can be useful for scripting purposes. +الاستخدام الآخر المختلف الوحيد لـ `git rm` في الكتاب هو في <> حيث نستخدم ونشرح باختصار `--ignore-unmatch` عند تشغيل `git filter-branch`، والذي ببساطة يجعله لا يخرج بخطأ (error out) عندما لا يكون الملف الذي نحاول إزالته موجوداً. +قد يكون هذا مفيداً لأغراض البرمجة النصية (scripting). ==== git mv -The `git mv` command is a thin convenience command to move a file and then run `git add` on the new file and `git rm` on the old file. +أمر `git mv` هو أمر ملاءمة خفيف (thin convenience command) لنقل (move) ملف ثم تشغيل `git add` على الملف الجديد و `git rm` على الملف القديم. -We only briefly mention this command in <>. +نذكر هذا الأمر باختصار فقط في <>. ==== git clean -The `git clean` command is used to remove unwanted files from your working directory. -This could include removing temporary build artifacts or merge conflict files. +يُستخدم أمر `git clean` لإزالة الملفات غير المرغوب فيها من دليل عملك (working directory). +قد يشمل ذلك إزالة القطع الأثرية المؤقتة للبناء (temporary build artifacts) أو ملفات تعارض الدمج (merge conflict files). -We cover many of the options and scenarios in which you might used the clean command in <>. +نغطي العديد من الخيارات (options) والسيناريوهات (scenarios) التي قد تستخدم فيها أمر clean في <>. -=== Branching and Merging +=== Branching and Merging (التفرع والدمج) -There are just a handful of commands that implement most of the branching and merging functionality in Git. +لا يوجد سوى حفنة (handful) من الأوامر التي تنفذ معظم وظائف التفرع (branching) والدمج (merging) في Git. ==== git branch -The `git branch` command is actually something of a branch management tool. -It can list the branches you have, create a new branch, delete branches and rename branches. +أمر `git branch` هو في الواقع نوع من أدوات إدارة الفروع (branch management tool). +يمكنه سرد (list) الفروع الموجودة لديك، وإنشاء فرع جديد (new branch)، وحذف الفروع (delete branches) وإعادة تسمية الفروع (rename branches). -Most of <> is dedicated to the `branch` command and it's used throughout the entire chapter. -We first introduce it in <> and we go through most of its other features (listing and deleting) in <>. +معظم <> مخصص لأمر `branch` ويُستخدم طوال الفصل بأكمله. +نقدمه أولاً في <> ونستعرض معظم ميزاته الأخرى (الإدراج (listing) والحذف (deleting)) في <>. -In <> we use the `git branch -u` option to set up a tracking branch. +في <> نستخدم الخيار `git branch -u` لإعداد فرع تتبع (tracking branch). -Finally, we go through some of what it does in the background in <>. +أخيراً، نستعرض بعض ما يفعله في الخلفية (background) في <>. ==== git checkout -The `git checkout` command is used to switch branches and check content out into your working directory. +يُستخدم أمر `git checkout` لتبديل الفروع (switch branches) وسحب (checkout) المحتوى إلى دليل عملك (working directory). -We first encounter the command in <> along with the `git branch` command. +نصادف الأمر لأول مرة في <> جنباً إلى جنب مع أمر `git branch`. -We see how to use it to start tracking branches with the `--track` flag in <>. +نرى كيفية استخدامه لبدء تتبع الفروع (tracking branches) باستخدام العلامة `--track` في <>. -We use it to reintroduce file conflicts with `--conflict=diff3` in <>. +نستخدمه لإعادة إدخال (reintroduce) تعارضات الملفات باستخدام `--conflict=diff3` في <>. -We go into closer detail on its relationship with `git reset` in <>. +نتعمق أكثر في تفاصيل علاقته بـ `git reset` في <>. -Finally, we go into some implementation detail in <>. +أخيراً، ندخل في بعض تفاصيل التنفيذ (implementation detail) في <>. ==== git merge -The `git merge` tool is used to merge one or more branches into the branch you have checked out. -It will then advance the current branch to the result of the merge. +تُستخدم أداة `git merge` لدمج فرع (branch) أو أكثر في الفرع الذي قمت بسحبه (checked out). +سيؤدي ذلك بعد ذلك إلى تقدم الفرع الحالي (advance the current branch) إلى نتيجة الدمج (result of the merge). -The `git merge` command was first introduced in <>. -Though it is used in various places in the book, there are very few variations of the `merge` command -- generally just `git merge ` with the name of the single branch you want to merge in. +تم تقديم أمر `git merge` لأول مرة في <>. +على الرغم من استخدامه في أماكن مختلفة في الكتاب، إلا أن هناك عدداً قليلاً جداً من الاختلافات لأمر `merge` -- بشكل عام فقط `git merge ` مع اسم الفرع الوحيد الذي تريد دمجه. -We covered how to do a squashed merge (where Git merges the work but pretends like it's just a new commit without recording the history of the branch you're merging in) at the very end of <>. +لقد غطينا كيفية إجراء دمج مضغوط (squashed merge) (حيث يدمج Git العمل ولكنه يتظاهر بأنه مجرد تأكيد جديد (new commit) دون تسجيل سجل (history) الفرع الذي تقوم بدمجه) في نهاية <>. -We went over a lot about the merge process and command, including the `-Xignore-space-change` command and the `--abort` flag to abort a problem merge in <>. +لقد مررنا بالكثير حول عملية الدمج (merge process) والأمر نفسه، بما في ذلك أمر `-Xignore-space-change` والعلامة `--abort` لإجهاض (abort) دمج يمثل مشكلة في <>. -We learned how to verify signatures before merging if your project is using GPG signing in <>. +لقد تعلمنا كيفية التحقق من التوقيعات (verify signatures) قبل الدمج إذا كان مشروعك يستخدم توقيع GPG في <>. -Finally, we learned about Subtree merging in <>. +أخيراً، تعلمنا عن دمج الشجرة الفرعية (Subtree merging) في <>. ==== git mergetool -The `git mergetool` command simply launches an external merge helper in case you have issues with a merge in Git. +يقوم أمر `git mergetool` ببساطة بتشغيل مساعد دمج خارجي (external merge helper) في حالة وجود مشكلات في دمج (merge) في Git. -We mention it quickly in <> and go into detail on how to implement your own external merge tool in <>. +نذكره بسرعة في <> ونتعمق في التفاصيل حول كيفية تنفيذ أداة دمج خارجية (external merge tool) خاصة بك في <>. ==== git log -The `git log` command is used to show the reachable recorded history of a project from the most recent commit snapshot backwards. -By default it will only show the history of the branch you're currently on, but can be given different or even multiple heads or branches from which to traverse. -It is also often used to show differences between two or more branches at the commit level. +يُستخدم أمر `git log` لإظهار السجل المسجل (recorded history) الذي يمكن الوصول إليه (reachable) لمشروع من لقطة التأكيد الأحدث (most recent commit snapshot) إلى الوراء. +بشكل افتراضي، سيعرض فقط سجل الفرع (branch) الذي تتواجد عليه حالياً، ولكن يمكن إعطاؤه رؤوساً (heads) أو فروعاً (branches) مختلفة أو حتى متعددة لاجتيازها (traverse). +يُستخدم أيضاً غالباً لإظهار الاختلافات بين فرعين أو أكثر على مستوى التأكيد (commit level). -This command is used in nearly every chapter of the book to demonstrate the history of a project. +يُستخدم هذا الأمر في كل فصل تقريباً من هذا الكتاب لتوضيح سجل (history) المشروع. -We introduce the command and cover it in some depth in <>. -There we look at the `-p` and `--stat` option to get an idea of what was introduced in each commit and the `--pretty` and `--oneline` options to view the history more concisely, along with some simple date and author filtering options. +نقدم الأمر ونغطيه بشيء من العمق في <>. +هناك نلقي نظرة على خيار `-p` و `--stat` للحصول على فكرة عما تم إدخاله في كل تأكيد (commit) والخيارات `--pretty` و `--oneline` لعرض السجل بشكل أكثر إيجازاً، جنباً إلى جنب مع بعض خيارات تصفية (filtering) التاريخ والمؤلف البسيطة. -In <> we use it with the `--decorate` option to easily visualize where our branch pointers are located and we also use the `--graph` option to see what divergent histories look like. +في <> نستخدمه مع الخيار `--decorate` لتصور (visualize) مكان وجود مؤشرات فروعنا بسهولة ونستخدم أيضاً الخيار `--graph` لنرى كيف تبدو التواريخ المتباينة (divergent histories). -In <> and <> we cover the `branchA..branchB` syntax to use the `git log` command to see what commits are unique to a branch relative to another branch. -In <> we go through this fairly extensively. +في <> و <> نغطي بنية الجملة (syntax) لـ `branchA..branchB` لاستخدام أمر `git log` لمعرفة ما هي التأكيدات الفريدة (unique) لفرع بالنسبة لفرع آخر. +في <> نستعرض هذا بشكل مكثف (fairly extensively). -In <> and <> we cover using the `branchA...branchB` format and the `--left-right` syntax to see what is in one branch or the other but not in both. -In <> we also look at how to use the `--merge` option to help with merge conflict debugging as well as using the `--cc` option to look at merge commit conflicts in your history. +في <> و <> نغطي استخدام تنسيق `branchA...branchB` وبنية الجملة `--left-right` لمعرفة ما هو موجود في أحد الفروع أو الآخر ولكن ليس في كلاهما. +في <> نلقي نظرة أيضاً على كيفية استخدام الخيار `--merge` للمساعدة في تصحيح أخطاء تعارض الدمج (merge conflict debugging) وكذلك استخدام الخيار `--cc` للنظر في تعارضات تأكيد الدمج (merge commit conflicts) في سجلك (history). -In <> we use the `-g` option to view the Git reflog through this tool instead of doing branch traversal. +في <> نستخدم الخيار `-g` لعرض سجل المراجع (reflog) في Git من خلال هذه الأداة بدلاً من القيام باجتياز الفرع (branch traversal). -In <> we look at using the `-S` and `-L` options to do fairly sophisticated searches for something that happened historically in the code such as seeing the history of a function. +في <> نلقي نظرة على استخدام الخيارين `-S` و `-L` لإجراء عمليات بحث متطورة (sophisticated searches) إلى حد ما عن شيء حدث تاريخياً في الكود مثل رؤية سجل دالة (history of a function). -In <> we see how to use `--show-signature` to add a validation string to each commit in the `git log` output based on if it was validly signed or not. +في <> نرى كيفية استخدام `--show-signature` لإضافة سلسلة تحقق (validation string) إلى كل تأكيد (commit) في مخرجات `git log` بناءً على ما إذا كان موقعاً بشكل صالح (validly signed) أم لا. ==== git stash -The `git stash` command is used to temporarily store uncommitted work in order to clean out your working directory without having to commit unfinished work on a branch. +يُستخدم أمر `git stash` لتخزين العمل غير المؤكد (uncommitted work) مؤقتاً من أجل تنظيف دليل عملك (working directory) دون الحاجة إلى تأكيد عمل غير مكتمل على فرع. -This is basically entirely covered in <>. +تمت تغطية هذا بشكل كامل في <>. ==== git tag -The `git tag` command is used to give a permanent bookmark to a specific point in the code history. -Generally this is used for things like releases. +يُستخدم أمر `git tag` لإعطاء علامة مرجعية دائمة (permanent bookmark) لنقطة محددة في سجل الكود (code history). +بشكل عام، يتم استخدام هذا لأشياء مثل الإصدارات (releases). -This command is introduced and covered in detail in <> and we use it in practice in <>. +تم تقديم هذا الأمر وتغطيته بالتفصيل في <> ونستخدمه عملياً في <>. -We also cover how to create a GPG signed tag with the `-s` flag and verify one with the `-v` flag in <>. +نغطي أيضاً كيفية إنشاء علامة موقعة (signed tag) بـ GPG باستخدام العلامة `-s` والتحقق من إحداها باستخدام العلامة `-v` في <>. -=== Sharing and Updating Projects +=== Sharing and Updating Projects (مشاركة وتحديث المشاريع) -There are not very many commands in Git that access the network, nearly all of the commands operate on the local database. -When you are ready to share your work or pull changes from elsewhere, there are a handful of commands that deal with remote repositories. +لا يوجد العديد من الأوامر في Git التي تصل إلى الشبكة، فكل الأوامر تقريباً تعمل على قاعدة البيانات المحلية (local database). +عندما تكون مستعداً لمشاركة عملك أو سحب (pull) التغييرات من مكان آخر، هناك حفنة (handful) من الأوامر التي تتعامل مع المستودعات البعيدة (remote repositories). ==== git fetch -The `git fetch` command communicates with a remote repository and fetches down all the information that is in that repository that is not in your current one and stores it in your local database. +يتواصل أمر `git fetch` مع مستودع بعيد (remote repository) ويجلب جميع المعلومات الموجودة في ذلك المستودع والتي ليست موجودة في مستودعك الحالي ويخزنها في قاعدة بياناتك المحلية (local database). -We first look at this command in <> and we continue to see examples of its use in <>. +نلقي نظرة على هذا الأمر لأول مرة في <> ونستمر في رؤية أمثلة على استخدامه في <>. -We also use it in several of the examples in <>. +كما نستخدمه في العديد من الأمثلة في <>. -We use it to fetch a single specific reference that is outside of the default space in <> and we see how to fetch from a bundle in <>. +نستخدمه لجلب مرجع معين واحد (single specific reference) يقع خارج المساحة الافتراضية في <> ونرى كيفية الجلب من حزمة (bundle) في <>. -We set up highly custom refspecs in order to make `git fetch` do something a little different than the default in <>. +نحن نقوم بإعداد مواصفات مراجع مخصصة للغاية (highly custom refspecs) لجعل `git fetch` يقوم بشيء مختلف قليلاً عن الافتراضي في <>. ==== git pull -The `git pull` command is basically a combination of the `git fetch` and `git merge` commands, where Git will fetch from the remote you specify and then immediately try to merge it into the branch you're on. +أمر `git pull` هو في الأساس مزيج من أمري `git fetch` و `git merge`، حيث سيقوم Git (غيت) بالجلب من المستودع البعيد الذي تحدده ثم يحاول على الفور دمجه (merge it) في الفرع الذي أنت عليه. -We introduce it quickly in <> and show how to see what it will merge if you run it in <>. +نقدمه بسرعة في <> ونوضح كيفية معرفة ما سيتم دمجه إذا قمت بتشغيله في <>. -We also see how to use it to help with rebasing difficulties in <>. +نرى أيضاً كيفية استخدامه للمساعدة في صعوبات إعادة التأسيس (rebasing difficulties) في <>. -We show how to use it with a URL to pull in changes in a one-off fashion in <>. +نوضح كيفية استخدامه مع عنوان URL لسحب (pull) التغييرات لمرة واحدة (one-off) في <>. -Finally, we very quickly mention that you can use the `--verify-signatures` option to it in order to verify that commits you are pulling have been GPG signed in <>. +أخيراً، نذكر بسرعة أنه يمكنك استخدام الخيار `--verify-signatures` معه للتحقق من أن التأكيدات التي تقوم بسحبها قد تم توقيعها بـ GPG في <>. ==== git push -The `git push` command is used to communicate with another repository, calculate what your local database has that the remote one does not, and then pushes the difference into the other repository. -It requires write access to the other repository and so normally is authenticated somehow. +يُستخدم أمر `git push` للتواصل مع مستودع (repository) آخر، وحساب ما تمتلكه قاعدة بياناتك المحلية (local database) ولا يمتلكه المستودع البعيد (remote)، ثم دفع (pushes) الفرق إلى المستودع الآخر. +يتطلب الأمر إمكانية الكتابة (write access) إلى المستودع الآخر، لذا عادةً ما تتم المصادقة (authenticated) عليه بطريقة ما. -We first look at the `git push` command in <>. -Here we cover the basics of pushing a branch to a remote repository. -In <> we go a little deeper into pushing specific branches and in <> we see how to set up tracking branches to automatically push to. -In <> we use the `--delete` flag to delete a branch on the server with `git push`. +نلقي نظرة لأول مرة على أمر `git push` في <>. +هنا نغطي أساسيات دفع (pushing) فرع إلى مستودع بعيد (remote repository). +في <> نتعمق أكثر قليلاً في دفع فروع محددة وفي <> نرى كيفية إعداد فروع التتبع (tracking branches) للدفع إليها تلقائياً. +في <> نستخدم العلامة `--delete` لحذف فرع (delete a branch) على الخادم (server) باستخدام `git push`. -Throughout <> we see several examples of using `git push` to share work on branches through multiple remotes. +طوال <> نرى عدة أمثلة على استخدام `git push` لمشاركة العمل على الفروع (branches) عبر مستودعات بعيدة متعددة (multiple remotes). -We see how to use it to share tags that you have made with the `--tags` option in <>. +نرى كيفية استخدامه لمشاركة العلامات (tags) التي قمت بإجرائها باستخدام الخيار `--tags` في <>. -In <> we use the `--recurse-submodules` option to check that all of our submodules work has been published before pushing the superproject, which can be really helpful when using submodules. +في <> نستخدم الخيار `--recurse-submodules` للتحقق من نشر (published) جميع أعمال الوحدات الفرعية (submodules) الخاصة بنا قبل دفع المشروع الرئيسي (superproject)، والذي يمكن أن يكون مفيداً جداً عند استخدام الوحدات الفرعية. -In <> we talk briefly about the `pre-push` hook, which is a script we can setup to run before a push completes to verify that it should be allowed to push. +في <> نتحدث باختصار عن الخطاف (hook) `pre-push`، وهو برنامج نصي (script) يمكننا إعداده ليعمل قبل اكتمال الدفع (push completes) للتحقق من السماح بالدفع. -Finally, in <> we look at pushing with a full refspec instead of the general shortcuts that are normally used. -This can help you be very specific about what work you wish to share. +أخيراً، في <> نلقي نظرة على الدفع (pushing) بمواصفة مرجع كاملة (full refspec) بدلاً من الاختصارات (shortcuts) العامة المستخدمة عادةً. +يمكن أن يساعدك هذا في أن تكون محدداً جداً بشأن العمل الذي ترغب في مشاركته. ==== git remote -The `git remote` command is a management tool for your record of remote repositories. -It allows you to save long URLs as short handles, such as "`origin`" so you don't have to type them out all the time. -You can have several of these and the `git remote` command is used to add, change and delete them. +أمر `git remote` هو أداة إدارة (management tool) لسجلك (record) الخاص بالمستودعات البعيدة (remote repositories). +يسمح لك بحفظ عناوين URL الطويلة كمقابض قصيرة (short handles)، مثل "`origin`" حتى لا تضطر إلى كتابتها طوال الوقت. +يمكن أن يكون لديك العديد منها ويُستخدم أمر `git remote` لإضافتها (add)، وتغييرها (change)، وحذفها (delete). -This command is covered in detail in <>, including listing, adding, removing and renaming them. +تمت تغطية هذا الأمر بالتفصيل في <>، بما في ذلك إدراجها (listing) وإضافتها (adding) وإزالتها (removing) وإعادة تسميتها (renaming). -It is used in nearly every subsequent chapter in the book too, but always in the standard `git remote add ` format. +ويُستخدم أيضاً في كل فصل تقريباً من الفصول اللاحقة في الكتاب، ولكن دائماً بالتنسيق القياسي `git remote add `. ==== git archive -The `git archive` command is used to create an archive file of a specific snapshot of the project. +يُستخدم أمر `git archive` لإنشاء ملف أرشيف (archive file) للقطة (snapshot) محددة من المشروع. -We use `git archive` to create a tarball of a project for sharing in <>. +نستخدم `git archive` لإنشاء كرة قطران (tarball) لمشروع لمشاركته في <>. ==== git submodule -The `git submodule` command is used to manage external repositories within a normal repositories. -This could be for libraries or other types of shared resources. -The `submodule` command has several sub-commands (`add`, `update`, `sync`, etc) for managing these resources. +يُستخدم أمر `git submodule` لإدارة المستودعات الخارجية (external repositories) داخل مستودعات عادية. +قد يكون هذا لمكتبات (libraries) أو أنواع أخرى من الموارد المشتركة (shared resources). +يحتوي الأمر `submodule` على عدة أوامر فرعية (sub-commands) (`add` و `update` و `sync` وما إلى ذلك) لإدارة هذه الموارد. -This command is only mentioned and entirely covered in <>. +تم ذكر هذا الأمر وتغطيته بالكامل فقط في <>. -=== Inspection and Comparison +=== Inspection and Comparison (الفحص والمقارنة) ==== git show -The `git show` command can show a Git object in a simple and human readable way. -Normally you would use this to show the information about a tag or a commit. +يمكن لأمر `git show` إظهار كائن Git (Git object) بطريقة بسيطة وقابلة للقراءة البشرية (human readable way). +عادةً ما تستخدم هذا لإظهار المعلومات حول علامة (tag) أو تأكيد (commit). -We first use it to show annotated tag information in <>. +نستخدمه لأول مرة لإظهار معلومات العلامة التوضيحية (annotated tag information) في <>. -Later we use it quite a bit in <> to show the commits that our various revision selections resolve to. +لاحقاً نستخدمه كثيراً في <> لإظهار التأكيدات (commits) التي تنحل إليها اختياراتنا المختلفة للمراجعات (revision selections). -One of the more interesting things we do with `git show` is in <> to extract specific file contents of various stages during a merge conflict. +أحد الأشياء الأكثر إثارة للاهتمام التي نقوم بها باستخدام `git show` موجود في <> لاستخراج محتويات ملفات محددة من مراحل (stages) مختلفة أثناء تعارض الدمج (merge conflict). ==== git shortlog -The `git shortlog` command is used to summarize the output of `git log`. -It will take many of the same options that the `git log` command will but instead of listing out all of the commits it will present a summary of the commits grouped by author. +يُستخدم أمر `git shortlog` لتلخيص مخرجات (summarize the output) أمر `git log`. +سيأخذ العديد من نفس الخيارات التي يأخذها أمر `git log` ولكن بدلاً من إدراج جميع التأكيدات (commits)، فإنه سيقدم ملخصاً (summary) للتأكيدات مجمعة حسب المؤلف (grouped by author). -We showed how to use it to create a nice changelog in <>. +أوضحنا كيفية استخدامه لإنشاء سجل تغييرات (changelog) جميل في <>. ==== git describe -The `git describe` command is used to take anything that resolves to a commit and produces a string that is somewhat human-readable and will not change. -It's a way to get a description of a commit that is as unambiguous as a commit SHA-1 but more understandable. +يُستخدم أمر `git describe` لأخذ أي شيء ينحل (resolves) إلى تأكيد (commit) وينتج سلسلة (string) قابلة للقراءة البشرية إلى حد ما ولن تتغير. +إنها طريقة للحصول على وصف لتأكيد (description of a commit) واضح مثل قيمة SHA-1 للتأكيد ولكنه أكثر قابلية للفهم. -We use `git describe` in <> and <> to get a string to name our release file after. +نستخدم `git describe` في <> و <> للحصول على سلسلة لتسمية ملف الإصدار (release file) الخاص بنا بها. -=== Debugging +=== Debugging (تصحيح الأخطاء) -Git has a couple of commands that are used to help debug an issue in your code. -This ranges from figuring out where something was introduced to figuring out who introduced it. +يحتوي Git على زوج من الأوامر التي تُستخدم للمساعدة في تصحيح (debug) مشكلة في كودك. +يتراوح هذا من معرفة مكان إدخال شيء ما إلى معرفة من قام بإدخاله. ==== git bisect -The `git bisect` tool is an incredibly helpful debugging tool used to find which specific commit was the first one to introduce a bug or problem by doing an automatic binary search. +تُعد أداة `git bisect` أداة تصحيح أخطاء (debugging tool) مفيدة للغاية تُستخدم للعثور على التأكيد (commit) المحدد الذي كان أول من أدخل خطأً (bug) أو مشكلة (problem) عن طريق إجراء بحث ثنائي تلقائي (automatic binary search). -It is fully covered in <> and is only mentioned in that section. +مغطاة بالكامل في <> ومذكورة فقط في ذلك القسم. ==== git blame -The `git blame` command annotates the lines of any file with which commit was the last one to introduce a change to each line of the file and what person authored that commit. -This is helpful in order to find the person to ask for more information about a specific section of your code. +يُعلق (annotates) أمر `git blame` على سطور أي ملف مبيناً أي تأكيد (commit) كان الأخير الذي أدخل تغييراً على كل سطر من الملف ومن هو الشخص الذي صاغ (authored) ذلك التأكيد. +هذا مفيد للعثور على الشخص الذي يجب أن تطلب منه مزيداً من المعلومات حول قسم معين من كودك. -It is covered in <> and is only mentioned in that section. +تم تغطيته في <> ومذكور فقط في ذلك القسم. ==== git grep -The `git grep` command can help you find any string or regular expression in any of the files in your source code, even older versions of your project. +يمكن أن يساعدك أمر `git grep` في العثور على أي سلسلة (string) أو تعبير نمطي (regular expression) في أي من الملفات الموجودة في كودك المصدري (source code)، حتى الإصدارات الأقدم (older versions) من مشروعك. -It is covered in <> and is only mentioned in that section. +تم تغطيته في <> ومذكور فقط في ذلك القسم. -=== Patching +=== Patching (الترقيع) -A few commands in Git are centered around the concept of thinking of commits in terms of the changes they introduce, as though the commit series is a series of patches. -These commands help you manage your branches in this manner. +تتمحور بضعة أوامر في Git حول مفهوم التفكير في التأكيدات (commits) من حيث التغييرات التي تُدخلها، كما لو كانت سلسلة التأكيدات (commit series) عبارة عن سلسلة من التصحيحات (series of patches). +تساعدك هذه الأوامر على إدارة فروعك (branches) بهذه الطريقة. ==== git cherry-pick -The `git cherry-pick` command is used to take the change introduced in a single Git commit and try to re-introduce it as a new commit on the branch you're currently on. -This can be useful to only take one or two commits from a branch individually rather than merging in the branch which takes all the changes. +يُستخدم أمر `git cherry-pick` لأخذ التغيير (change) المُدخل في تأكيد Git (Git commit) واحد ومحاولة إعادة إدخاله (re-introduce) كتأكيد جديد (new commit) على الفرع (branch) الذي أنت عليه حالياً. +يمكن أن يكون هذا مفيداً لأخذ تأكيد واحد أو اثنين فقط من فرع بشكل فردي (individually) بدلاً من دمج (merging) الفرع الذي يأخذ جميع التغييرات. -Cherry picking is described and demonstrated in <>. +تم وصف وتوضيح عملية Cherry picking في <>. ==== git rebase -The `git rebase` command is basically an automated `cherry-pick`. -It determines a series of commits and then cherry-picks them one by one in the same order somewhere else. +أمر `git rebase` هو أساساً عملية `cherry-pick` تلقائية (automated). +إنه يحدد سلسلة من التأكيدات (series of commits) ثم يقوم بانتقائها (cherry-picks) واحداً تلو الآخر بنفس الترتيب في مكان آخر. -Rebasing is covered in detail in <>, including covering the collaborative issues involved with rebasing branches that are already public. +تمت تغطية إعادة التأسيس (Rebasing) بالتفصيل في <>، بما في ذلك تغطية المشكلات التعاونية (collaborative issues) المتعلقة بإعادة تأسيس الفروع العامة (public) بالفعل. -We use it in practice during an example of splitting your history into two separate repositories in <>, using the `--onto` flag as well. +نستخدمه عملياً أثناء مثال على تقسيم سجلك (splitting your history) إلى مستودعين منفصلين (two separate repositories) في <>، باستخدام العلامة `--onto` أيضاً. -We go through running into a merge conflict during rebasing in <>. +نمر بالوقوع في تعارض دمج (merge conflict) أثناء إعادة التأسيس (rebasing) في <>. -We also use it in an interactive scripting mode with the `-i` option in <>. +نستخدمه أيضاً في وضع البرمجة النصية التفاعلي (interactive scripting mode) مع الخيار `-i` في <>. ==== git revert -The `git revert` command is essentially a reverse `git cherry-pick`. -It creates a new commit that applies the exact opposite of the change introduced in the commit you're targeting, essentially undoing or reverting it. +أمر `git revert` هو في الأساس عكس (reverse) `git cherry-pick`. +فهو ينشئ تأكيداً جديداً (new commit) يطبق العكس تماماً (exact opposite) للتغيير (change) المُدخل في التأكيد المستهدف (commit you're targeting)، مما يؤدي في الأساس إلى التراجع (undoing) عنه أو عكسه (reverting it). -We use this in <> to undo a merge commit. +نستخدم هذا في <> للتراجع (undo) عن تأكيد دمج (merge commit). -=== Email +=== Email (البريد الإلكتروني) -Many Git projects, including Git itself, are entirely maintained over mailing lists. -Git has a number of tools built into it that help make this process easier, from generating patches you can easily email to applying those patches from an email box. +تتم صيانة العديد من مشاريع Git (غيت)، بما في ذلك Git نفسه، بالكامل عبر القوائم البريدية (mailing lists). +يحتوي Git على عدد من الأدوات المضمنة فيه والتي تساعد على جعل هذه العملية أسهل، من إنشاء التصحيحات (generating patches) التي يمكنك إرسالها عبر البريد الإلكتروني بسهولة إلى تطبيق تلك التصحيحات من صندوق بريد إلكتروني (email box). ==== git apply -The `git apply` command applies a patch created with the `git diff` or even GNU diff command. -It is similar to what the `patch` command might do with a few small differences. +يُطبق (applies) أمر `git apply` تصحيحاً (patch) تم إنشاؤه باستخدام `git diff` أو حتى أمر GNU diff. +إنه مشابه لما قد يفعله أمر `patch` مع بعض الاختلافات الصغيرة. -We demonstrate using it and the circumstances in which you might do so in <>. +نوضح كيفية استخدامه والظروف التي قد تقوم فيها بذلك في <>. ==== git am -The `git am` command is used to apply patches from an email inbox, specifically one that is mbox formatted. -This is useful for receiving patches over email and applying them to your project easily. +يُستخدم أمر `git am` لتطبيق التصحيحات (apply patches) من صندوق بريد وارد (email inbox)، وتحديداً الصندوق المنسق بصيغة mbox. +هذا مفيد لاستلام التصحيحات (receiving patches) عبر البريد الإلكتروني وتطبيقها على مشروعك بسهولة. -We covered usage and workflow around `git am` in <> including using the `--resolved`, `-i` and `-3` options. +لقد غطينا الاستخدام وسير العمل (workflow) حول `git am` في <> بما في ذلك استخدام الخيارات `--resolved` و `-i` و `-3`. -There are also a number of hooks you can use to help with the workflow around `git am` and they are all covered in <>. +هناك أيضاً عدد من الخطافات (hooks) التي يمكنك استخدامها للمساعدة في سير العمل (workflow) حول `git am` وقد تمت تغطيتها جميعاً في <>. -We also use it to apply patch formatted GitHub Pull Request changes in <>. +نستخدمه أيضاً لتطبيق تغييرات طلب سحب GitHub المنسقة على شكل تصحيح (patch formatted GitHub Pull Request changes) في <>. ==== git format-patch -The `git format-patch` command is used to generate a series of patches in mbox format that you can use to send to a mailing list properly formatted. +يُستخدم أمر `git format-patch` لإنشاء سلسلة من التصحيحات (series of patches) بتنسيق mbox والتي يمكنك استخدامها لإرسالها إلى قائمة بريدية (mailing list) بتنسيق صحيح (properly formatted). -We go through an example of contributing to a project using the `git format-patch` tool in <>. +نستعرض مثالاً للمساهمة (contributing) في مشروع باستخدام أداة `git format-patch` في <>. ==== git imap-send -The `git imap-send` command uploads a mailbox generated with `git format-patch` into an IMAP drafts folder. +يحمل (uploads) أمر `git imap-send` صندوق بريد (mailbox) تم إنشاؤه باستخدام `git format-patch` في مجلد مسودات IMAP (IMAP drafts folder). -We go through an example of contributing to a project by sending patches with the `git imap-send` tool in <>. +نستعرض مثالاً للمساهمة في مشروع عن طريق إرسال تصحيحات باستخدام أداة `git imap-send` في <>. ==== git send-email -The `git send-email` command is used to send patches that are generated with `git format-patch` over email. +يُستخدم أمر `git send-email` لإرسال التصحيحات (send patches) التي يتم إنشاؤها باستخدام `git format-patch` عبر البريد الإلكتروني (over email). -We go through an example of contributing to a project by sending patches with the `git send-email` tool in <>. +نستعرض مثالاً للمساهمة في مشروع عن طريق إرسال تصحيحات باستخدام أداة `git send-email` في <>. ==== git request-pull -The `git request-pull` command is simply used to generate an example message body to email to someone. -If you have a branch on a public server and want to let someone know how to integrate those changes without sending the patches over email, you can run this command and send the output to the person you want to pull the changes in. +يُستخدم أمر `git request-pull` ببساطة لإنشاء نص رسالة مثال (example message body) لإرساله بالبريد الإلكتروني إلى شخص ما. +إذا كان لديك فرع على خادم عام (public server) وتريد إعلام شخص ما بكيفية دمج (integrate) هذه التغييرات دون إرسال التصحيحات (patches) عبر البريد الإلكتروني، فيمكنك تشغيل هذا الأمر وإرسال الإخراج (output) إلى الشخص الذي تريد أن يسحب التغييرات. -We demonstrate how to use `git request-pull` to generate a pull message in <>. +نوضح كيفية استخدام `git request-pull` لإنشاء رسالة سحب (pull message) في <>. -=== External Systems +=== External Systems (الأنظمة الخارجية) -Git comes with a few commands to integrate with other version control systems. +يأتي Git مزوداً ببعض الأوامر للتكامل (integrate) مع أنظمة التحكم في الإصدارات الأخرى (other version control systems). ==== git svn -The `git svn` command is used to communicate with the Subversion version control system as a client. -This means you can use Git to checkout from and commit to a Subversion server. +يُستخدم أمر `git svn` للتواصل مع نظام التحكم في الإصدار Subversion كعميل (client). +هذا يعني أنه يمكنك استخدام Git (غيت) للسحب (checkout) والتأكيد (commit) إلى خادم Subversion. -This command is covered in depth in <>. +تمت تغطية هذا الأمر بتعمق في <>. ==== git fast-import -For other version control systems or importing from nearly any format, you can use `git fast-import` to quickly map the other format to something Git can easily record. +بالنسبة لأنظمة التحكم في الإصدارات الأخرى أو الاستيراد (importing) من أي تنسيق (format) تقريباً، يمكنك استخدام `git fast-import` لتعيين (map) التنسيق الآخر بسرعة إلى شيء يمكن لـ Git تسجيله (record) بسهولة. -This command is covered in depth in <>. +تمت تغطية هذا الأمر بتعمق في <>. -=== Administration +=== Administration (الإدارة) -If you're administering a Git repository or need to fix something in a big way, Git provides a number of administrative commands to help you out. +إذا كنت تدير مستودع Git أو كنت بحاجة إلى إصلاح شيء ما بشكل كبير، يوفر Git عدداً من الأوامر الإدارية (administrative commands) لمساعدتك. ==== git gc -The `git gc` command runs "`garbage collection`" on your repository, removing unnecessary files in your database and packing up the remaining files into a more efficient format. +يقوم أمر `git gc` بتشغيل "`جمع القمامة (garbage collection)`" على مستودعك، مما يؤدي إلى إزالة الملفات غير الضرورية (unnecessary files) في قاعدة بياناتك (database) وحزم الملفات المتبقية (packing up) في تنسيق أكثر كفاءة (efficient format). -This command normally runs in the background for you, though you can manually run it if you wish. -We go over some examples of this in <>. +يعمل هذا الأمر بشكل طبيعي في الخلفية نيابة عنك، على الرغم من أنه يمكنك تشغيله يدوياً إذا كنت ترغب في ذلك. +نستعرض بعض الأمثلة على ذلك في <>. ==== git fsck -The `git fsck` command is used to check the internal database for problems or inconsistencies. +يُستخدم أمر `git fsck` لفحص قاعدة البيانات الداخلية (internal database) بحثاً عن المشاكل (problems) أو عدم التناسق (inconsistencies). -We only quickly use this once in <> to search for dangling objects. +نستخدم هذا الأمر بسرعة مرة واحدة فقط في <> للبحث عن الكائنات المتدلية (dangling objects). ==== git reflog -The `git reflog` command goes through a log of where all the heads of your branches have been as you work to find commits you may have lost through rewriting histories. +يمر أمر `git reflog` عبر سجل (log) لمكان وجود جميع رؤوس (heads) فروعك أثناء عملك للعثور على التأكيدات (commits) التي ربما فقدتها من خلال إعادة كتابة التواريخ (rewriting histories). -We cover this command mainly in <>, where we show normal usage to and how to use `git log -g` to view the same information with `git log` output. +نغطي هذا الأمر بشكل أساسي في <>، حيث نعرض الاستخدام العادي له وكيفية استخدام `git log -g` لعرض نفس المعلومات مع إخراج `git log`. -We also go through a practical example of recovering such a lost branch in <>. +نستعرض أيضاً مثالاً عملياً (practical example) لاستعادة مثل هذا الفرع المفقود (lost branch) في <>. ==== git filter-branch -The `git filter-branch` command is used to rewrite loads of commits according to certain patterns, like removing a file everywhere or filtering the entire repository down to a single subdirectory for extracting a project. +يُستخدم أمر `git filter-branch` لإعادة كتابة (rewrite) كميات كبيرة من التأكيدات (loads of commits) وفقاً لأنماط معينة (certain patterns)، مثل إزالة ملف من كل مكان أو تصفية المستودع بأكمله (filtering the entire repository) ليصبح دليلاً فرعياً واحداً (single subdirectory) لاستخراج مشروع (extracting a project). -In <> we explain the command and explore several different options such as `--commit-filter`, `--subdirectory-filter` and `--tree-filter`. +في <> نشرح الأمر ونستكشف عدة خيارات مختلفة مثل `--commit-filter` و `--subdirectory-filter` و `--tree-filter`. -In <> we use it to fix up imported external repositories. +في <> نستخدمه لإصلاح المستودعات الخارجية المستوردة (imported external repositories). -=== Plumbing Commands +=== Plumbing Commands (أوامر السباكة) -There were also quite a number of lower level plumbing commands that we encountered in the book. +كان هناك أيضاً عدد لا بأس به من أوامر السباكة ذات المستوى الأدنى (lower level plumbing commands) التي صادفناها في الكتاب. -The first one we encounter is `ls-remote` in <> which we use to look at the raw references on the server. +أولها الذي نصادفه هو `ls-remote` في <> والذي نستخدمه للنظر في المراجع الخام (raw references) على الخادم (server). -We use `ls-files` in <>, <> and <> to take a more raw look at what your staging area looks like. +نستخدم `ls-files` في <> و <> و <> لإلقاء نظرة أكثر تجريداً على شكل منطقة التجهيز (staging area) الخاصة بك. -We also mention `rev-parse` in <> to take just about any string and turn it into an object SHA-1. +نذكر أيضاً `rev-parse` في <> لأخذ أي سلسلة تقريباً وتحويلها إلى قيمة SHA-1 لكائن (object SHA-1). -However, most of the low level plumbing commands we cover are in <>, which is more or less what the chapter is focused on. -We tried to avoid use of them throughout most of the rest of the book. +ومع ذلك، فإن معظم أوامر السباكة (plumbing commands) ذات المستوى المنخفض (low level) التي نغطيها موجودة في <>، وهو إلى حد ما ما يركز عليه الفصل. +لقد حاولنا تجنب استخدامها طوال معظم بقية الكتاب. diff --git a/book/01-introduction/sections/about-version-control.asc b/book/01-introduction/sections/about-version-control.asc index 182fcedc0..d8753735a 100644 --- a/book/01-introduction/sections/about-version-control.asc +++ b/book/01-introduction/sections/about-version-control.asc @@ -1,61 +1,61 @@ -=== About Version Control +=== About Version Control (حول التحكم في الإصدارات) (((version control))) -What is "`version control`", and why should you care? -Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. -For the examples in this book, you will use software source code as the files being version controlled, though in reality you can do this with nearly any type of file on a computer. +ما هو "`version control`" (نظام التحكم في الإصدارات)، ولماذا يجب أن تهتم به؟ +Version control (نظام التحكم في الإصدارات) هو نظام يقوم بتسجيل التغييرات على ملف أو مجموعة من الملفات بمرور الوقت بحيث يمكنك استدعاء إصدارات محددة لاحقاً. +بالنسبة للأمثلة في هذا الكتاب، ستستخدم كود المصدر البرمجي (software source code) كملفات يتم التحكم في إصداراتها، على الرغم من أنه في الواقع يمكنك القيام بذلك مع أي نوع من الملفات تقريباً على الكمبيوتر. -If you are a graphic or web designer and want to keep every version of an image or layout (which you would most certainly want to), a Version Control System (VCS) is a very wise thing to use. -It allows you to revert selected files back to a previous state, revert the entire project back to a previous state, compare changes over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more. -Using a VCS also generally means that if you screw things up or lose files, you can easily recover. -In addition, you get all this for very little overhead. +إذا كنت مصمم جرافيك أو ويب وترغب في الاحتفاظ بكل إصدار من صورة أو تخطيط (وهو ما سترغب به بالتأكيد)، فإن استخدام Version Control System (VCS) (نظام التحكم في الإصدارات) هو أمر حكيم جداً. +إنه يتيح لك إعادة الملفات المحددة إلى حالة سابقة (revert)، وإعادة المشروع بأكمله إلى حالة سابقة، ومقارنة التغييرات بمرور الوقت، ومعرفة من قام بتعديل شيء ما قد يتسبب في مشكلة، ومن أدخل مشكلة ومتى، والمزيد. +استخدام VCS (نظام التحكم في الإصدارات) يعني أيضاً بشكل عام أنه إذا أفسدت الأمور أو فقدت ملفات، يمكنك بسهولة الاسترداد (recover). +بالإضافة إلى ذلك، يمكنك الحصول على كل هذا مقابل القليل جداً من العبء الإضافي (overhead). -==== Local Version Control Systems +==== Local Version Control Systems (أنظمة التحكم في الإصدارات المحلية) (((version control,local))) -Many people's version-control method of choice is to copy files into another directory (perhaps a time-stamped directory, if they're clever). -This approach is very common because it is so simple, but it is also incredibly error prone. -It is easy to forget which directory you're in and accidentally write to the wrong file or copy over files you don't mean to. +طريقة Version-control (التحكم في الإصدارات) المفضلة لدى الكثير من الناس هي نسخ الملفات إلى دليل آخر (ربما دليل يحمل طابعاً زمنياً، إذا كانوا أذكياء). +هذا النهج شائع جداً لأنه بسيط للغاية، ولكنه أيضاً عرضة للخطأ بشكل لا يصدق. +من السهل أن تنسى الدليل الذي تتواجد فيه وتكتب عن طريق الخطأ في الملف الخاطئ أو تنسخ فوق ملفات لا تقصدها. -To deal with this issue, programmers long ago developed local VCSs that had a simple database that kept all the changes to files under revision control. +للتعامل مع هذه المشكلة، قام المبرمجون منذ فترة طويلة بتطوير أنظمة VCS (أنظمة التحكم في الإصدارات) محلية تحتوي على قاعدة بيانات بسيطة تحتفظ بجميع التغييرات التي تطرأ على الملفات تحت Revision control (نظام التحكم في المراجعة). -.Local version control diagram +.Local version control diagram (مخطط نظام التحكم في الإصدارات المحلي) image::images/local.png[Local version control diagram] -One of the most popular VCS tools was a system called RCS, which is still distributed with many computers today. -https://www.gnu.org/software/rcs/[RCS^] works by keeping patch sets (that is, the differences between files) in a special format on disk; it can then re-create what any file looked like at any point in time by adding up all the patches. +أحد أكثر أدوات VCS (أنظمة التحكم في الإصدارات) شيوعاً كان نظاماً يسمى RCS، والذي لا يزال يتم توزيعه مع العديد من أجهزة الكمبيوتر اليوم. +يعمل https://www.gnu.org/software/rcs/[RCS^] عن طريق الاحتفاظ بمجموعات التصحيح (patch sets) (أي الاختلافات بين الملفات) بتنسيق خاص على القرص؛ يمكنه بعد ذلك إعادة إنشاء شكل أي ملف في أي وقت عن طريق جمع جميع التصحيحات (patches). -==== Centralized Version Control Systems +==== Centralized Version Control Systems (أنظمة التحكم في الإصدارات المركزية) (((version control,centralized))) -The next major issue that people encounter is that they need to collaborate with developers on other systems. -To deal with this problem, Centralized Version Control Systems (CVCSs) were developed. -These systems (such as CVS, Subversion, and Perforce) have a single server that contains all the versioned files, and a number of clients that check out files from that central place.(((CVS)))(((Subversion)))(((Perforce))) -For many years, this has been the standard for version control. +المشكلة الرئيسية التالية التي يواجهها الأشخاص هي أنهم بحاجة إلى التعاون مع مطورين على أنظمة أخرى. +للتعامل مع هذه المشكلة، تم تطوير Centralized Version Control Systems (CVCSs) (أنظمة التحكم في الإصدارات المركزية). +تحتوي هذه الأنظمة (مثل CVS و Subversion و Perforce) على خادم واحد (single server) يحتوي على جميع الملفات ذات الإصدارات، وعدد من العملاء (clients) الذين يقومون بسحب (check out) الملفات من ذلك المكان المركزي.(((CVS)))(((Subversion)))(((Perforce))) +لسنوات عديدة، كان هذا هو المعيار للتحكم في الإصدارات. -.Centralized version control diagram +.Centralized version control diagram (مخطط نظام التحكم في الإصدارات المركزي) image::images/centralized.png[Centralized version control diagram] -This setup offers many advantages, especially over local VCSs. -For example, everyone knows to a certain degree what everyone else on the project is doing. -Administrators have fine-grained control over who can do what, and it's far easier to administer a CVCS than it is to deal with local databases on every client. +يوفر هذا الإعداد العديد من المزايا، خاصة على أنظمة VCS (أنظمة التحكم في الإصدارات) المحلية. +على سبيل المثال، يعرف الجميع إلى حد معين ما يفعله كل شخص آخر في المشروع. +يتمتع المسؤولون (Administrators) بتحكم دقيق في من يمكنه فعل ماذا، ومن الأسهل بكثير إدارة نظام CVCS (نظام تحكم في الإصدارات مركزي) بدلاً من التعامل مع قواعد البيانات المحلية على كل عميل (client). -However, this setup also has some serious downsides. -The most obvious is the single point of failure that the centralized server represents. -If that server goes down for an hour, then during that hour nobody can collaborate at all or save versioned changes to anything they're working on. -If the hard disk the central database is on becomes corrupted, and proper backups haven't been kept, you lose absolutely everything -- the entire history of the project except whatever single snapshots people happen to have on their local machines. -Local VCSs suffer from this same problem -- whenever you have the entire history of the project in a single place, you risk losing everything. +ومع ذلك، فإن هذا الإعداد يحتوي أيضاً على بعض السلبيات الخطيرة. +الأكثر وضوحاً هو نقطة الفشل الوحيدة (single point of failure) التي يمثلها الخادم المركزي (centralized server). +إذا تعطل ذلك الخادم لمدة ساعة، فخلال تلك الساعة لا يمكن لأي شخص التعاون على الإطلاق أو حفظ التغييرات ذات الإصدارات لأي شيء يعملون عليه. +إذا تلف القرص الصلب الموجود عليه قاعدة البيانات المركزية (central database)، ولم يتم الاحتفاظ بنسخ احتياطية (backups) مناسبة، فإنك تفقد كل شيء تماماً -- السجل الكامل (entire history) للمشروع باستثناء أي لقطات (snapshots) فردية قد يمتلكها الأشخاص على أجهزتهم المحلية. +تعاني أنظمة VCS (أنظمة التحكم في الإصدارات) المحلية من نفس هذه المشكلة -- متى ما كان لديك السجل الكامل للمشروع في مكان واحد، فإنك تخاطر بفقدان كل شيء. -==== Distributed Version Control Systems +==== Distributed Version Control Systems (أنظمة التحكم في الإصدارات الموزعة) (((version control,distributed))) -This is where Distributed Version Control Systems (DVCSs) step in. -In a DVCS (such as Git, Mercurial or Darcs), clients don't just check out the latest snapshot of the files; rather, they fully mirror the repository, including its full history. -Thus, if any server dies, and these systems were collaborating via that server, any of the client repositories can be copied back up to the server to restore it. -Every clone is really a full backup of all the data. +هنا تتدخل Distributed Version Control Systems (DVCSs) (أنظمة التحكم في الإصدارات الموزعة). +في نظام DVCS (مثل Git أو Mercurial أو Darcs)، لا يكتفي العملاء (clients) بسحب أحدث لقطة (snapshot) للملفات فحسب؛ بل إنهم يعكسون (mirror) المستودع (repository) بالكامل، بما في ذلك سجله الكامل (full history). +وبالتالي، إذا تعطل أي خادم، وكانت هذه الأنظمة تتعاون عبر ذلك الخادم، يمكن نسخ أي من مستودعات العملاء مرة أخرى إلى الخادم لاستعادته (restore it). +كل نسخة (clone) هي في الواقع نسخة احتياطية كاملة (full backup) من جميع البيانات. -.Distributed version control diagram +.Distributed version control diagram (مخطط نظام التحكم في الإصدارات الموزع) image::images/distributed.png[Distributed version control diagram] -Furthermore, many of these systems deal pretty well with having several remote repositories they can work with, so you can collaborate with different groups of people in different ways simultaneously within the same project. -This allows you to set up several types of workflows that aren't possible in centralized systems, such as hierarchical models. +علاوة على ذلك، فإن العديد من هذه الأنظمة تتعامل بشكل جيد مع وجود العديد من Remote repositories (المستودعات البعيدة) التي يمكنهم العمل معها، بحيث يمكنك التعاون مع مجموعات مختلفة من الأشخاص بطرق مختلفة في وقت واحد داخل نفس المشروع. +يتيح لك ذلك إعداد عدة أنواع من مسارات العمل (workflows) غير الممكنة في الأنظمة المركزية، مثل النماذج الهرمية (hierarchical models). diff --git a/book/01-introduction/sections/command-line.asc b/book/01-introduction/sections/command-line.asc index e7fd185bb..5cbb48805 100644 --- a/book/01-introduction/sections/command-line.asc +++ b/book/01-introduction/sections/command-line.asc @@ -1,11 +1,11 @@ -=== The Command Line +=== The Command Line (سطر الأوامر) -There are a lot of different ways to use Git. -There are the original command-line tools, and there are many graphical user interfaces of varying capabilities. -For this book, we will be using Git on the command line. -For one, the command line is the only place you can run _all_ Git commands -- most of the GUIs implement only a partial subset of Git functionality for simplicity. -If you know how to run the command-line version, you can probably also figure out how to run the GUI version, while the opposite is not necessarily true. -Also, while your choice of graphical client is a matter of personal taste, _all_ users will have the command-line tools installed and available. +هناك الكثير من الطرق المختلفة لاستخدام Git. +هناك أدوات سطر الأوامر (command-line tools) الأصلية، وهناك العديد من واجهات المستخدم الرسومية (graphical user interfaces) ذات الإمكانيات المتفاوتة. +في هذا الكتاب، سنستخدم Git على سطر الأوامر (command line). +أولاً، سطر الأوامر (command line) هو المكان الوحيد الذي يمكنك فيه تشغيل _جميع_ أوامر Git -- فمعظم واجهات المستخدم الرسومية (GUIs) تنفذ فقط مجموعة فرعية جزئية من وظائف Git للتبسيط. +إذا كنت تعرف كيفية تشغيل إصدار سطر الأوامر (command-line version)، فربما يمكنك أيضاً معرفة كيفية تشغيل إصدار واجهة المستخدم الرسومية (GUI version)، بينما العكس ليس صحيحاً بالضرورة. +أيضاً، في حين أن اختيارك للعميل الرسومي (graphical client) هو مسألة ذوق شخصي، فإن _جميع_ المستخدمين سيكون لديهم أدوات سطر الأوامر (command-line tools) مثبتة ومتاحة. -So we will expect you to know how to open Terminal in macOS or Command Prompt or PowerShell in Windows. -If you don't know what we're talking about here, you may need to stop and research that quickly so that you can follow the rest of the examples and descriptions in this book. +لذلك نتوقع منك أن تعرف كيفية فتح نافذة Terminal في نظام macOS أو Command Prompt أو PowerShell في نظام Windows. +إذا كنت لا تعرف عما نتحدث عنه هنا، فقد تحتاج إلى التوقف والبحث عن ذلك بسرعة حتى تتمكن من متابعة بقية الأمثلة والأوصاف في هذا الكتاب. diff --git a/book/01-introduction/sections/first-time-setup.asc b/book/01-introduction/sections/first-time-setup.asc index 10b7049ce..25de0b359 100644 --- a/book/01-introduction/sections/first-time-setup.asc +++ b/book/01-introduction/sections/first-time-setup.asc @@ -1,40 +1,40 @@ [[_first_time]] -=== First-Time Git Setup +=== First-Time Git Setup (إعداد Git لأول مرة) -Now that you have Git on your system, you'll want to do a few things to customize your Git environment. -You should have to do these things only once on any given computer; they'll stick around between upgrades. -You can also change them at any time by running through the commands again. +الآن بعد أن أصبح لديك Git على نظامك، ستحتاج إلى القيام ببعض الأشياء لتخصيص بيئة Git الخاصة بك. +يجب أن تفعل هذه الأشياء مرة واحدة فقط على أي كمبيوتر معين؛ وسوف تستمر بين الترقيات (upgrades). +يمكنك أيضاً تغييرها في أي وقت عن طريق تشغيل الأوامر مرة أخرى. -Git comes with a tool called `git config` that lets you get and set configuration variables that control all aspects of how Git looks and operates.(((git commands, config))) -These variables can be stored in three different places: +يأتي Git مع أداة تسمى `git config` تتيح لك الحصول على متغيرات التكوين (configuration variables) وتعيينها والتي تتحكم في جميع جوانب كيفية ظهور Git وعمله.(((git commands, config))) +يمكن تخزين هذه المتغيرات في ثلاثة أماكن مختلفة: -1. `[path]/etc/gitconfig` file: Contains values applied to every user on the system and all their repositories. - If you pass the option `--system` to `git config`, it reads and writes from this file specifically. - Because this is a system configuration file, you would need administrative or superuser privilege to make changes to it. -2. `~/.gitconfig` or `~/.config/git/config` file: Values specific personally to you, the user. - You can make Git read and write to this file specifically by passing the `--global` option, and this affects _all_ of the repositories you work with on your system. -3. `config` file in the Git directory (that is, `.git/config`) of whatever repository you're currently using: Specific to that single repository. - You can force Git to read from and write to this file with the `--local` option, but that is in fact the default. - Unsurprisingly, you need to be located somewhere in a Git repository for this option to work properly. +1. ملف `[path]/etc/gitconfig`: يحتوي على القيم المطبقة على كل مستخدم على النظام وجميع مستودعاته. + إذا قمت بتمرير الخيار `--system` إلى `git config`، فإنه يقرأ ويكتب من هذا الملف على وجه التحديد. + نظراً لأن هذا ملف تكوين نظام (system configuration file)، فستحتاج إلى امتيازات إدارية (administrative) أو مستخدم متميز (superuser) لإجراء تغييرات عليه. +2. ملف `~/.gitconfig` أو `~/.config/git/config`: قيم خاصة بك شخصياً، أيها المستخدم. + يمكنك جعل Git يقرأ ويكتب في هذا الملف على وجه التحديد عن طريق تمرير الخيار `--global`، وهذا يؤثر على _جميع_ المستودعات التي تعمل معها على نظامك. +3. ملف `config` في دليل Git (أي `.git/config`) لأي مستودع (repository) تستخدمه حالياً: خاص بهذا المستودع الفردي. + يمكنك إجبار Git على القراءة من هذا الملف والكتابة إليه باستخدام الخيار `--local`، ولكن هذا هو في الواقع السلوك الافتراضي. + ليس من المستغرب أنك بحاجة إلى أن تكون موجوداً في مكان ما داخل مستودع Git لكي يعمل هذا الخيار بشكل صحيح. -Each level overrides values in the previous level, so values in `.git/config` trump those in `[path]/etc/gitconfig`. +كل مستوى يتجاوز (overrides) القيم الموجودة في المستوى السابق، وبالتالي فإن القيم في `.git/config` تتفوق (trump) على تلك الموجودة في `[path]/etc/gitconfig`. -On Windows systems, Git looks for the `.gitconfig` file in the `$HOME` directory (`C:\Users\$USER` for most people). -It also still looks for `[path]/etc/gitconfig`, although it's relative to the MSys root, which is wherever you decide to install Git on your Windows system when you run the installer. -If you are using version 2.x or later of Git for Windows, there is also a system-level config file at `C:\Documents and Settings\All Users\Application Data\Git\config` on Windows XP, and in `C:\ProgramData\Git\config` on Windows Vista and newer. -This config file can only be changed by `git config -f ` as an admin. +في أنظمة Windows، يبحث Git عن ملف `.gitconfig` في دليل `$HOME` (`C:\Users\$USER` لمعظم الأشخاص). +كما أنه لا يزال يبحث عن `[path]/etc/gitconfig`، على الرغم من أنه نسبي إلى جذر MSys (MSys root)، وهو المكان الذي تقرر فيه تثبيت Git على نظام Windows الخاص بك عند تشغيل أداة التثبيت. +إذا كنت تستخدم الإصدار 2.x أو أحدث من Git for Windows، فهناك أيضاً ملف تكوين على مستوى النظام (system-level config file) في `C:\Documents and Settings\All Users\Application Data\Git\config` في Windows XP، وفي `C:\ProgramData\Git\config` في Windows Vista والأحدث. +لا يمكن تغيير ملف التكوين هذا إلا بواسطة `git config -f ` كمسؤول (admin). -You can view all of your settings and where they are coming from using: +يمكنك عرض جميع إعداداتك ومكان ورودها باستخدام: [source,console] ---- $ git config --list --show-origin ---- -==== Your Identity +==== Your Identity (هويتك) -The first thing you should do when you install Git is to set your user name and email address. -This is important because every Git commit uses this information, and it's immutably baked into the commits you start creating: +أول شيء يجب عليك فعله عند تثبيت Git هو تعيين اسم المستخدم وعنوان البريد الإلكتروني الخاص بك. +هذا مهم لأن كل عملية تأكيد (Git commit) تستخدم هذه المعلومات، وتكون مدمجة (immutably baked) بشكل دائم في عمليات التأكيد (commits) التي تبدأ في إنشائها: [source,console] ---- @@ -42,29 +42,29 @@ $ git config --global user.name "John Doe" $ git config --global user.email johndoe@example.com ---- -Again, you need to do this only once if you pass the `--global` option, because then Git will always use that information for your user on that system. -If you want to override this with a different name or email address for specific projects, you can run the command without the `--global` option when you're in that project. +مرة أخرى، تحتاج إلى القيام بذلك مرة واحدة فقط إذا مررت الخيار `--global`، لأن Git سيستخدم دائماً تلك المعلومات للمستخدم الخاص بك على هذا النظام. +إذا كنت تريد تجاوز هذا باسم مختلف أو عنوان بريد إلكتروني لمشاريع معينة، فيمكنك تشغيل الأمر بدون الخيار `--global` عندما تكون في ذلك المشروع. -Many of the GUI tools will help you do this when you first run them. +ستساعدك العديد من أدوات واجهة المستخدم الرسومية (GUI tools) على القيام بذلك عند تشغيلها لأول مرة. [[_editor]] -==== Your Editor +==== Your Editor (المحرر الخاص بك) -Now that your identity is set up, you can configure the default text editor that will be used when Git needs you to type in a message. -If not configured, Git uses your system's default editor. +الآن بعد إعداد هويتك، يمكنك تكوين محرر النصوص الافتراضي (default text editor) الذي سيتم استخدامه عندما يحتاج Git منك لكتابة رسالة. +إذا لم يتم تكوينه، يستخدم Git المحرر الافتراضي (default editor) لنظامك. -If you want to use a different text editor, such as Emacs, you can do the following: +إذا كنت ترغب في استخدام محرر نصوص مختلف، مثل Emacs، فيمكنك القيام بما يلي: [source,console] ---- $ git config --global core.editor emacs ---- -On a Windows system, if you want to use a different text editor, you must specify the full path to its executable file. -This can be different depending on how your editor is packaged. +في نظام Windows، إذا كنت ترغب في استخدام محرر نصوص مختلف، فيجب عليك تحديد المسار الكامل لملفه التنفيذي (executable file). +يمكن أن يكون هذا مختلفاً بناءً على كيفية حزم المحرر الخاص بك. -In the case of Notepad++, a popular programming editor, you are likely to want to use the 32-bit version, since at the time of writing the 64-bit version doesn't support all plug-ins. -If you are on a 32-bit Windows system, or you have a 64-bit editor on a 64-bit system, you'll type something like this: +في حالة Notepad++، وهو محرر برمجة شائع، من المحتمل أن ترغب في استخدام إصدار 32 بت، لأنه في وقت كتابة هذا التقرير، لم يكن إصدار 64 بت يدعم جميع المكونات الإضافية (plug-ins). +إذا كنت تستخدم نظام Windows 32 بت، أو كان لديك محرر 64 بت على نظام 64 بت، فستكتب شيئاً كهذا: [source,console] ---- @@ -73,32 +73,32 @@ $ git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -m [NOTE] ==== -Vim, Emacs and Notepad++ are popular text editors often used by developers on Unix-based systems like Linux and macOS or a Windows system. -If you are using another editor, or a 32-bit version, please find specific instructions for how to set up your favorite editor with Git in <>. +Vim و Emacs و Notepad++ هي محررات نصوص شائعة غالباً ما يستخدمها المطورون على الأنظمة المستندة إلى Unix مثل Linux و macOS أو نظام Windows. +إذا كنت تستخدم محرراً آخر، أو إصدار 32 بت، فيرجى العثور على إرشادات محددة حول كيفية إعداد المحرر المفضل لديك مع Git في <>. ==== [WARNING] ==== -You may find, if you don't setup your editor like this, you get into a really confusing state when Git attempts to launch it. -An example on a Windows system may include a prematurely terminated Git operation during a Git initiated edit. +قد تجد أنه إذا لم تقم بإعداد المحرر الخاص بك على هذا النحو، فستدخل في حالة محيرة حقاً عندما يحاول Git تشغيله. +من الأمثلة على ذلك في نظام Windows عملية Git يتم إنهاؤها قبل الأوان أثناء تعديل بدأه Git. ==== [[_new_default_branch]] -==== Your default branch name +==== Your default branch name (اسم الفرع الافتراضي الخاص بك) -By default Git will create a branch called _master_ when you create a new repository with `git init`. -From Git version 2.28 onwards, you can set a different name for the initial branch. +بشكل افتراضي سيقوم Git بإنشاء فرع (branch) يسمى _master_ عند إنشاء مستودع جديد (new repository) باستخدام `git init`. +بدءاً من إصدار Git 2.28 فصاعداً، يمكنك تعيين اسم مختلف للفرع الأولي (initial branch). -To set _main_ as the default branch name do: +لتعيين _main_ كاسم الفرع الافتراضي قم بما يلي: [source,console] ---- $ git config --global init.defaultBranch main ---- -==== Checking Your Settings +==== Checking Your Settings (التحقق من إعداداتك) -If you want to check your configuration settings, you can use the `git config --list` command to list all the settings Git can find at that point: +إذا كنت ترغب في التحقق من إعدادات التكوين (configuration settings) الخاصة بك، يمكنك استخدام الأمر `git config --list` لسرد جميع الإعدادات التي يمكن لـ Git العثور عليها في تلك المرحلة: [source,console] ---- @@ -112,10 +112,10 @@ color.diff=auto ... ---- -You may see keys more than once, because Git reads the same key from different files (`[path]/etc/gitconfig` and `~/.gitconfig`, for example). -In this case, Git uses the last value for each unique key it sees. +قد ترى المفاتيح (keys) أكثر من مرة، لأن Git يقرأ نفس المفتاح من ملفات مختلفة (`[path]/etc/gitconfig` و `~/.gitconfig`، على سبيل المثال). +في هذه الحالة، يستخدم Git القيمة الأخيرة لكل مفتاح فريد يراه. -You can also check what Git thinks a specific key's value is by typing `git config `:(((git commands, config))) +يمكنك أيضاً التحقق مما يعتقده Git كقيمة لمفتاح معين عن طريق كتابة `git config `:(((git commands, config))) [source,console] ---- @@ -125,12 +125,12 @@ John Doe [NOTE] ==== -Since Git might read the same configuration variable value from more than one file, it's possible that you have an unexpected value for one of these values and you don't know why. -In cases like that, you can query Git as to the _origin_ for that value, and it will tell you which configuration file had the final say in setting that value: +نظراً لأن Git قد يقرأ نفس قيمة متغير التكوين من أكثر من ملف واحد، فمن المحتمل أن يكون لديك قيمة غير متوقعة لإحدى هذه القيم ولا تعرف السبب. +في مثل هذه الحالات، يمكنك الاستعلام من Git عن _مصدر (origin)_ تلك القيمة، وسيخبرك بملف التكوين الذي كانت له الكلمة الأخيرة في تعيين تلك القيمة: [source,console] ---- $ git config --show-origin rerere.autoUpdate file:/home/johndoe/.gitconfig false ---- -==== +==== \ No newline at end of file diff --git a/book/01-introduction/sections/help.asc b/book/01-introduction/sections/help.asc index 68d76a4cf..6d1838641 100644 --- a/book/01-introduction/sections/help.asc +++ b/book/01-introduction/sections/help.asc @@ -1,7 +1,7 @@ [[_git_help]] -=== Getting Help +=== Getting Help (الحصول على المساعدة) -If you ever need help while using Git, there are three equivalent ways to get the comprehensive manual page (manpage) help for any of the Git commands: +إذا احتجت في أي وقت إلى مساعدة أثناء استخدام Git، فهناك ثلاث طرق متكافئة (equivalent ways) للحصول على مساعدة صفحة الدليل الشاملة (comprehensive manual page - manpage) لأي من أوامر Git: [source,console] ---- @@ -10,18 +10,18 @@ $ git --help $ man git- ---- -For example, you can get the manpage help for the `git config` command by running this:(((git commands, help))) +على سبيل المثال، يمكنك الحصول على مساعدة صفحة الدليل (manpage help) للأمر `git config` عن طريق تشغيل هذا:(((git commands, help))) [source,console] ---- $ git help config ---- -These commands are nice because you can access them anywhere, even offline. -If the manpages and this book aren't enough and you need in-person help, you can try the `#git`, `#github`, or `#gitlab` channels on the Libera Chat IRC server, which can be found at https://libera.chat/[^]. -These channels are regularly filled with hundreds of people who are all very knowledgeable about Git and are often willing to help.(((IRC))) +هذه الأوامر رائعة لأنه يمكنك الوصول إليها في أي مكان، حتى في حالة عدم الاتصال بالإنترنت (offline). +إذا لم تكن صفحات الدليل (manpages) وهذا الكتاب كافية وكنت بحاجة إلى مساعدة شخصية (in-person help)، فيمكنك تجربة قنوات `#git` أو `#github` أو `#gitlab` على خادم Libera Chat IRC، والتي يمكن العثور عليها على https://libera.chat/[^]. +تمتلئ هذه القنوات بانتظام بمئات الأشخاص الذين هم جميعاً على دراية كبيرة بـ Git وغالباً ما يكونون مستعدين للمساعدة.(((IRC))) -In addition, if you don't need the full-blown manpage help, but just need a quick refresher on the available options for a Git command, you can ask for the more concise "`help`" output with the `-h` option, as in: +بالإضافة إلى ذلك، إذا كنت لا تحتاج إلى مساعدة صفحة الدليل الشاملة (full-blown manpage help)، ولكنك تحتاج فقط إلى تنشيط سريع للمعلومات (quick refresher) حول الخيارات المتاحة لأمر Git، فيمكنك طلب إخراج "`مساعدة (help)`" أكثر إيجازاً باستخدام الخيار `-h`، كما في: [source,console] ---- @@ -47,4 +47,4 @@ usage: git add [] [--] ... --chmod (+|-)x override the executable bit of the listed files --pathspec-from-file read pathspec from file --pathspec-file-nul with --pathspec-from-file, pathspec elements are separated with NUL character ----- +---- \ No newline at end of file diff --git a/book/01-introduction/sections/history.asc b/book/01-introduction/sections/history.asc index 7ab05fd3b..9a95d93ac 100644 --- a/book/01-introduction/sections/history.asc +++ b/book/01-introduction/sections/history.asc @@ -1,20 +1,20 @@ -=== A Short History of Git +=== A Short History of Git (تاريخ موجز لنظام Git) -As with many great things in life, Git began with a bit of creative destruction and fiery controversy. +كما هو الحال مع العديد من الأشياء العظيمة في الحياة، بدأ Git (نظام إدارة الإصدارات) بقليل من التدمير الإبداعي والجدل الحاد. -The Linux kernel is an open source software project of fairly large scope.(((Linux))) -During the early years of the Linux kernel maintenance (1991–2002), changes to the software were passed around as patches and archived files. -In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper.(((BitKeeper))) +يعد نواة لينكس (Linux kernel) مشروع برمجيات مفتوح المصدر (open source) واسع النطاق إلى حد ما.(((Linux))) +خلال السنوات الأولى من صيانة نواة لينكس (Linux kernel maintenance) (1991-2002)، تم تمرير التغييرات على البرنامج في شكل تصحيحات (patches) وملفات مؤرشفة (archived files). +في عام 2002، بدأ مشروع نواة لينكس (Linux kernel project) في استخدام نظام DVCS (نظام تحكم في الإصدارات موزع) مسجل الملكية يسمى BitKeeper.(((BitKeeper))) -In 2005, the relationship between the community that developed the Linux kernel and the commercial company that developed BitKeeper broke down, and the tool's free-of-charge status was revoked. -This prompted the Linux development community (and in particular Linus Torvalds, the creator of Linux) to develop their own tool based on some of the lessons they learned while using BitKeeper.(((Linus Torvalds))) -Some of the goals of the new system were as follows: +في عام 2005، انهارت العلاقة بين المجتمع الذي طور نواة لينكس (Linux kernel) والشركة التجارية التي طورت BitKeeper، وتم إلغاء الحالة المجانية (free-of-charge) للأداة. +دفع هذا مجتمع تطوير لينكس (Linux development community) (وعلى وجه الخصوص Linus Torvalds، منشئ Linux) إلى تطوير أداتهم الخاصة بناءً على بعض الدروس التي تعلموها أثناء استخدام BitKeeper.(((Linus Torvalds))) +كانت بعض أهداف النظام الجديد كما يلي: -* Speed -* Simple design -* Strong support for non-linear development (thousands of parallel branches) -* Fully distributed -* Able to handle large projects like the Linux kernel efficiently (speed and data size) +* السرعة (Speed) +* تصميم بسيط (Simple design) +* دعم قوي للتطوير غير الخطي (non-linear development) (آلاف الفروع المتوازية - parallel branches) +* موزع بالكامل (Fully distributed) +* قادر على التعامل مع المشاريع الكبيرة مثل نواة لينكس (Linux kernel) بكفاءة (السرعة وحجم البيانات) -Since its birth in 2005, Git has evolved and matured to be easy to use and yet retain these initial qualities. -It's amazingly fast, it's very efficient with large projects, and it has an incredible branching system for non-linear development (see <>). +منذ ولادته في عام 2005، تطور Git ونضج ليكون سهل الاستخدام مع الاحتفاظ بهذه الصفات الأولية. +إنه سريع بشكل مذهل، وفعال للغاية مع المشاريع الكبيرة، ولديه نظام تفرع (branching system) مذهل للتطوير غير الخطي (non-linear development) (انظر <>). diff --git a/book/01-introduction/sections/installing.asc b/book/01-introduction/sections/installing.asc index d4f6dcbd1..626c899ac 100644 --- a/book/01-introduction/sections/installing.asc +++ b/book/01-introduction/sections/installing.asc @@ -1,73 +1,73 @@ -=== Installing Git +=== Installing Git (تثبيت Git) -Before you start using Git, you have to make it available on your computer. -Even if it's already installed, it's probably a good idea to update to the latest version. -You can either install it as a package or via another installer, or download the source code and compile it yourself. +قبل أن تبدأ في استخدام Git، يجب عليك جعله متاحاً على جهاز الكمبيوتر الخاص بك. +حتى إذا كان مثبتاً بالفعل، فمن الجيد تحديثه إلى أحدث إصدار. +يمكنك إما تثبيته كحزمة (package) أو عبر أداة تثبيت (installer) أخرى، أو تنزيل الكود المصدري (source code) وتجميعه (compile) بنفسك. [NOTE] ==== -This book was written using Git version 2. -Since Git is quite excellent at preserving backwards compatibility, any recent version should work just fine. -Though most of the commands we use should work even in ancient versions of Git, some of them might not or might act slightly differently. +تمت كتابة هذا الكتاب باستخدام Git الإصدار 2. +نظراً لأن Git ممتاز جداً في الحفاظ على التوافق مع الإصدارات السابقة (backwards compatibility)، فيجب أن يعمل أي إصدار حديث بشكل جيد. +على الرغم من أن معظم الأوامر التي نستخدمها يجب أن تعمل حتى في الإصدارات القديمة جداً من Git، إلا أن بعضها قد لا يعمل أو قد يعمل بشكل مختلف قليلاً. ==== -==== Installing on Linux +==== Installing on Linux (التثبيت على Linux) (((Linux, installing))) -If you want to install the basic Git tools on Linux via a binary installer, you can generally do so through the package management tool that comes with your distribution. -If you're on Fedora (or any closely-related RPM-based distribution, such as RHEL or CentOS), you can use `dnf`: +إذا كنت ترغب في تثبيت أدوات Git الأساسية على نظام Linux عبر أداة تثبيت ثنائية (binary installer)، فيمكنك القيام بذلك عموماً من خلال أداة إدارة الحزم (package management tool) المرفقة مع التوزيعة (distribution) الخاصة بك. +إذا كنت تستخدم Fedora (أو أي توزيعة أخرى تعتمد على RPM ارتباطاً وثيقاً، مثل RHEL أو CentOS)، فيمكنك استخدام `dnf`: [source,console] ---- $ sudo dnf install git-all ---- -If you're on a Debian-based distribution, such as Ubuntu, try `apt`: +إذا كنت تستخدم توزيعة مبنية على Debian، مثل Ubuntu، فجرّب `apt`: [source,console] ---- $ sudo apt install git-all ---- -For more options, there are instructions for installing on several different Unix distributions on the Git website, at https://git-scm.com/download/linux[^]. +لمزيد من الخيارات، هناك إرشادات للتثبيت على العديد من توزيعات Unix المختلفة على موقع Git الإلكتروني، على الرابط https://git-scm.com/download/linux[^]. -==== Installing on macOS +==== Installing on macOS (التثبيت على macOS) (((macOS, installing))) -There are several ways to install Git on macOS. -The easiest is probably to install the Xcode Command Line Tools.(((Xcode))) -On Mavericks (10.9) or above you can do this simply by trying to run `git` from the Terminal the very first time. +هناك عدة طرق لتثبيت Git على نظام macOS. +ربما تكون أسهل طريقة هي تثبيت Xcode Command Line Tools (أدوات سطر أوامر Xcode).(((Xcode))) +على نظام Mavericks (10.9) أو أعلى، يمكنك القيام بذلك ببساطة عن طريق محاولة تشغيل أمر `git` من Terminal لأول مرة على الإطلاق. [source,console] ---- $ git --version ---- -If you don't have it installed already, it will prompt you to install it. +إذا لم يكن مثبتاً لديك بالفعل، فسيطلب منك تثبيته. -If you want a more up to date version, you can also install it via a binary installer. -A macOS Git installer is maintained and available for download at the Git website, at https://git-scm.com/download/mac[^]. +إذا كنت تريد إصداراً أحدث، فيمكنك أيضاً تثبيته عبر أداة تثبيت ثنائية (binary installer). +تتم صيانة أداة تثبيت macOS Git وهي متاحة للتنزيل على موقع Git الإلكتروني، على الرابط https://git-scm.com/download/mac[^]. -.Git macOS installer +.Git macOS installer (أداة تثبيت Git لنظام macOS) image::images/git-osx-installer.png[Git macOS installer] -==== Installing on Windows +==== Installing on Windows (التثبيت على Windows) -There are also a few ways to install Git on Windows.(((Windows, installing))) -The most official build is available for download on the Git website. -Just go to https://git-scm.com/download/win[^] and the download will start automatically. -Note that this is a project called Git for Windows, which is separate from Git itself; for more information on it, go to https://gitforwindows.org[^]. +هناك أيضاً عدة طرق لتثبيت Git على نظام Windows.(((Windows, installing))) +البنية (build) الرسمية الأكثر توفراً للتنزيل موجودة على موقع Git الإلكتروني. +فقط اذهب إلى https://git-scm.com/download/win[^] وسيبدأ التنزيل تلقائياً. +لاحظ أن هذا مشروع يسمى Git for Windows (Git لنظام Windows)، وهو منفصل عن Git نفسه؛ لمزيد من المعلومات عنه، اذهب إلى https://gitforwindows.org[^]. -To get an automated installation you can use the https://community.chocolatey.org/packages/git[Git Chocolatey package^]. -Note that the Chocolatey package is community maintained. +للحصول على تثبيت آلي (automated installation) يمكنك استخدام https://community.chocolatey.org/packages/git[Git Chocolatey package^] (حزمة Git عبر Chocolatey). +لاحظ أن حزمة Chocolatey تتم صيانتها بواسطة المجتمع (community maintained). -==== Installing from Source +==== Installing from Source (التثبيت من المصدر) -Some people may instead find it useful to install Git from source, because you'll get the most recent version. -The binary installers tend to be a bit behind, though as Git has matured in recent years, this has made less of a difference. +قد يجد بعض الأشخاص بدلاً من ذلك أنه من المفيد تثبيت Git من المصدر (from source)، لأنك ستحصل على أحدث إصدار. +تميل أدوات التثبيت الثنائية (binary installers) إلى التأخر قليلاً، على الرغم من أنه مع نضوج Git في السنوات الأخيرة، أصبح هذا الفارق أقل أهمية. -If you do want to install Git from source, you need to have the following libraries that Git depends on: autotools, curl, zlib, openssl, expat, and libiconv. -For example, if you're on a system that has `dnf` (such as Fedora) or `apt-get` (such as a Debian-based system), you can use one of these commands to install the minimal dependencies for compiling and installing the Git binaries: +إذا كنت تريد بالفعل تثبيت Git من المصدر (from source)، فأنت بحاجة إلى توفر المكتبات التالية التي يعتمد عليها Git: autotools، curl، zlib، openssl، expat، و libiconv. +على سبيل المثال، إذا كنت تستخدم نظاماً يحتوي على `dnf` (مثل Fedora) أو `apt-get` (مثل نظام مبني على Debian)، فيمكنك استخدام أحد هذه الأوامر لتثبيت الحد الأدنى من التبعيات (dependencies) لترجمة وتثبيت ملفات Git الثنائية (Git binaries): [source,console] ---- @@ -77,7 +77,7 @@ $ sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev \ gettext libz-dev libssl-dev ---- -In order to be able to add the documentation in various formats (doc, html, info), these additional dependencies are required: +من أجل التمكن من إضافة الوثائق بتنسيقات مختلفة (doc, html, info)، فإن هذه التبعيات الإضافية مطلوبة: [source,console] ---- @@ -87,37 +87,37 @@ $ sudo apt-get install asciidoc xmlto docbook2x [NOTE] ==== -Users of RHEL and RHEL-derivatives like CentOS and Scientific Linux will have to https://docs.fedoraproject.org/en-US/epel/#how_can_i_use_these_extra_packages[enable the EPEL repository^] to download the `docbook2X` package. +سيتعين على مستخدمي RHEL ومشتقات RHEL مثل CentOS و Scientific Linux تمكين https://docs.fedoraproject.org/en-US/epel/#how_can_i_use_these_extra_packages[enable the EPEL repository^] (تمكين مستودع EPEL) لتنزيل حزمة `docbook2X`. ==== -If you're using a Debian-based distribution (Debian/Ubuntu/Ubuntu-derivatives), you also need the `install-info` package: +إذا كنت تستخدم توزيعة مبنية على Debian (مثل Debian/Ubuntu/مشتقات Ubuntu)، فأنت بحاجة أيضاً إلى حزمة `install-info`: [source,console] ---- $ sudo apt-get install install-info ---- -If you're using a RPM-based distribution (Fedora/RHEL/RHEL-derivatives), you also need the `getopt` package (which is already installed on a Debian-based distro): +إذا كنت تستخدم توزيعة مبنية على RPM (مثل Fedora/RHEL/مشتقات RHEL)، فأنت بحاجة أيضاً إلى حزمة `getopt` (وهي مثبتة بالفعل في توزيعات Debian): [source,console] ---- $ sudo dnf install getopt ---- -Additionally, if you're using Fedora/RHEL/RHEL-derivatives, you need to do this: +بالإضافة إلى ذلك، إذا كنت تستخدم Fedora/RHEL/مشتقات RHEL، فأنت بحاجة إلى القيام بذلك: [source,console] ---- $ sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi ---- -due to binary name differences. +بسبب الاختلافات في الأسماء الثنائية (binary name differences). -When you have all the necessary dependencies, you can go ahead and grab the latest tagged release tarball from several places. -You can get it via the kernel.org site, at https://www.kernel.org/pub/software/scm/git[^], or the mirror on the GitHub website, at https://github.com/git/git/tags[^]. -It's generally a little clearer what the latest version is on the GitHub page, but the kernel.org page also has release signatures if you want to verify your download. +عندما يكون لديك جميع التبعيات (dependencies) الضرورية، يمكنك المضي قدماً والحصول على أحدث إصدار مصدر (tarball release) من عدة أماكن. +يمكنك الحصول عليه عبر موقع kernel.org، على الرابط https://www.kernel.org/pub/software/scm/git[^]، أو عبر المرآة (mirror) الموجودة على موقع GitHub، على الرابط https://github.com/git/git/tags[^]. +من الواضح بشكل عام ما هو الإصدار الأحدث على صفحة GitHub، لكن صفحة kernel.org تحتوي أيضاً على توقيعات الإصدار (release signatures) إذا كنت تريد التحقق من التنزيل الخاص بك. -Then, compile and install: +ثم قم بعمليات الترجمة (compile) والتثبيت (install): [source,console] ---- @@ -129,7 +129,7 @@ $ make all doc info $ sudo make install install-doc install-html install-info ---- -After this is done, you can also get Git via Git itself for updates: +بعد الانتهاء من ذلك، يمكنك أيضاً الحصول على Git عبر Git نفسه من أجل التحديثات (updates): [source,console] ---- diff --git a/book/01-introduction/sections/what-is-git.asc b/book/01-introduction/sections/what-is-git.asc index 466201b23..cd25d638a 100644 --- a/book/01-introduction/sections/what-is-git.asc +++ b/book/01-introduction/sections/what-is-git.asc @@ -1,109 +1,109 @@ [[what_is_git_section]] -=== What is Git? +=== What is Git? (ما هو Git؟) -So, what is Git in a nutshell? -This is an important section to absorb, because if you understand what Git is and the fundamentals of how it works, then using Git effectively will probably be much easier for you. -As you learn Git, try to clear your mind of the things you may know about other VCSs, such as CVS, Subversion or Perforce -- doing so will help you avoid subtle confusion when using the tool. -Even though Git's user interface is fairly similar to these other VCSs, Git stores and thinks about information in a very different way, and understanding these differences will help you avoid becoming confused while using it.(((Subversion)))(((Perforce))) +إذن، ما هو Git (نظام إدارة الإصدارات) باختصار؟ +هذا قسم مهم يجب استيعابه، لأنك إذا فهمت ما هو Git وأساسيات كيفية عمله، فمن المحتمل أن يكون استخدام Git بشكل فعال أسهل بكثير بالنسبة لك. +أثناء تعلمك لـ Git، حاول تصفية ذهنك من الأشياء التي قد تعرفها عن أنظمة VCS (أنظمة التحكم في الإصدارات) الأخرى، مثل CVS أو Subversion أو Perforce -- القيام بذلك سيساعدك على تجنب الارتباك الدقيق عند استخدام الأداة. +على الرغم من أن واجهة المستخدم الخاصة بـ Git مشابهة تماماً لأنظمة VCS (أنظمة التحكم في الإصدارات) الأخرى، إلا أن Git يقوم بتخزين المعلومات والتفكير فيها بطريقة مختلفة تماماً، وفهم هذه الاختلافات سيساعدك على تجنب الارتباك أثناء استخدامه.(((Subversion)))(((Perforce))) -==== Snapshots, Not Differences +==== Snapshots, Not Differences (لقطات، وليس اختلافات) -The major difference between Git and any other VCS (Subversion and friends included) is the way Git thinks about its data. -Conceptually, most other systems store information as a list of file-based changes. -These other systems (CVS, Subversion, Perforce, and so on) think of the information they store as a set of files and the changes made to each file over time (this is commonly described as _delta-based_ version control). +الفرق الرئيسي بين Git وأي نظام VCS (نظام تحكم في الإصدارات) آخر (بما في ذلك Subversion وأصدقائه) هو الطريقة التي يفكر بها Git في بياناته. +من الناحية المفاهيمية، تخزن معظم الأنظمة الأخرى المعلومات كقائمة من التغييرات القائمة على الملفات. +تفكر هذه الأنظمة الأخرى (CVS و Subversion و Perforce وما إلى ذلك) في المعلومات التي تخزنها كمجموعة من الملفات والتغييرات التي يتم إجراؤها على كل ملف بمرور الوقت (يوصف هذا عادةً بنظام التحكم في الإصدارات _القائم على الفروق (delta-based)_). -.Storing data as changes to a base version of each file +.Storing data as changes to a base version of each file (تخزين البيانات كتغييرات على إصدار أساسي لكل ملف) image::images/deltas.png[Storing data as changes to a base version of each file] -Git doesn't think of or store its data this way. -Instead, Git thinks of its data more like a series of snapshots of a miniature filesystem. -With Git, every time you commit, or save the state of your project, Git basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot. -To be efficient, if files have not changed, Git doesn't store the file again, just a link to the previous identical file it has already stored. -Git thinks about its data more like a *stream of snapshots*. +لا يفكر Git أو يخزن بياناته بهذه الطريقة. +بدلاً من ذلك، يفكر Git في بياناته بشكل أقرب إلى سلسلة من اللقطات (snapshots) لنظام ملفات مصغر (miniature filesystem). +مع Git، في كل مرة تقوم فيها بعملية تأكيد (commit)، أو حفظ حالة مشروعك، يلتقط Git في الأساس صورة لما تبدو عليه جميع ملفاتك في تلك اللحظة ويخزن مرجعاً (reference) لتلك اللقطة. +لكي يكون فعالاً، إذا لم تتغير الملفات، فإن Git لا يقوم بتخزين الملف مرة أخرى، بل مجرد رابط (link) للملف المطابق السابق الذي قام بتخزينه بالفعل. +يفكر Git في بياناته على أنها أقرب إلى *دفق من اللقطات (stream of snapshots)*. -.Storing data as snapshots of the project over time +.Storing data as snapshots of the project over time (تخزين البيانات كلقطات للمشروع بمرور الوقت) image::images/snapshots.png[Git stores data as snapshots of the project over time] -This is an important distinction between Git and nearly all other VCSs. -It makes Git reconsider almost every aspect of version control that most other systems copied from the previous generation. -This makes Git more like a mini filesystem with some incredibly powerful tools built on top of it, rather than simply a VCS. -We'll explore some of the benefits you gain by thinking of your data this way when we cover Git branching in <>. +هذا تمييز مهم بين Git وتقريباً جميع أنظمة VCS (أنظمة التحكم في الإصدارات) الأخرى. +إنه يجعل Git يعيد النظر في كل جانب تقريباً من جوانب التحكم في الإصدارات التي نسختها معظم الأنظمة الأخرى من الجيل السابق. +هذا يجعل Git يشبه نظام ملفات صغير مع بعض الأدوات القوية بشكل لا يصدق والمبنية فوقه، بدلاً من مجرد نظام VCS (نظام تحكم في الإصدارات). +سنستكشف بعض الفوائد التي تكتسبها من خلال التفكير في بياناتك بهذه الطريقة عندما نغطي التفرع في Git (Git branching) في <>. -==== Nearly Every Operation Is Local +==== Nearly Every Operation Is Local (تقريباً كل عملية تكون محلية) -Most operations in Git need only local files and resources to operate -- generally no information is needed from another computer on your network. -If you're used to a CVCS where most operations have that network latency overhead, this aspect of Git will make you think that the gods of speed have blessed Git with unworldly powers. -Because you have the entire history of the project right there on your local disk, most operations seem almost instantaneous. +تحتاج معظم العمليات في Git فقط إلى ملفات وموارد محلية (local) للعمل -- بشكل عام لا توجد حاجة إلى معلومات من كمبيوتر آخر على شبكتك. +إذا كنت معتاداً على نظام CVCS (نظام تحكم في الإصدارات مركزي) حيث يكون لمعظم العمليات عبء زمن انتقال الشبكة (network latency overhead)، فإن هذا الجانب من Git سيجعلك تعتقد أن آلهة السرعة قد باركت Git بقوى غير دنيوية. +نظراً لأن لديك السجل الكامل للمشروع (entire history of the project) موجوداً على قرصك المحلي (local disk)، فإن معظم العمليات تبدو شبه فورية. -For example, to browse the history of the project, Git doesn't need to go out to the server to get the history and display it for you -- it simply reads it directly from your local database. -This means you see the project history almost instantly. -If you want to see the changes introduced between the current version of a file and the file a month ago, Git can look up the file a month ago and do a local difference calculation, instead of having to either ask a remote server to do it or pull an older version of the file from the remote server to do it locally. +على سبيل المثال، لتصفح سجل المشروع (history of the project)، لا يحتاج Git إلى الخروج إلى الخادم للحصول على السجل وعرضه لك -- فهو يقرأه ببساطة مباشرة من قاعدة بياناتك المحلية (local database). +هذا يعني أنك ترى سجل المشروع على الفور تقريباً. +إذا كنت ترغب في رؤية التغييرات التي تم إدخالها بين الإصدار الحالي من ملف والملف منذ شهر مضى، يمكن لـ Git البحث عن الملف منذ شهر مضى وإجراء عملية حساب فرق محلية (local difference calculation)، بدلاً من الاضطرار إلى إما مطالبة خادم بعيد (remote server) بالقيام بذلك أو سحب (pull) إصدار أقدم من الملف من الخادم البعيد للقيام بذلك محلياً. -This also means that there is very little you can't do if you're offline or off VPN. -If you get on an airplane or a train and want to do a little work, you can commit happily (to your _local_ copy, remember?) until you get to a network connection to upload. -If you go home and can't get your VPN client working properly, you can still work. -In many other systems, doing so is either impossible or painful. -In Perforce, for example, you can't do much when you aren't connected to the server; in Subversion and CVS, you can edit files, but you can't commit changes to your database (because your database is offline). -This may not seem like a huge deal, but you may be surprised what a big difference it can make. +هذا يعني أيضاً أن هناك القليل جداً مما لا يمكنك فعله إذا كنت غير متصل بالإنترنت (offline) أو خارج VPN. +إذا ركبت طائرة أو قطاراً وأردت القيام ببعض العمل، يمكنك تأكيد التغييرات (commit) بسعادة (إلى نسختك _المحلية_، تذكر؟) حتى تحصل على اتصال بالشبكة للتحميل (upload). +إذا ذهبت إلى المنزل ولم تتمكن من تشغيل عميل VPN الخاص بك بشكل صحيح، فلا يزال بإمكانك العمل. +في العديد من الأنظمة الأخرى، يكون القيام بذلك إما مستحيلاً أو مؤلماً. +في Perforce، على سبيل المثال، لا يمكنك فعل الكثير عندما لا تكون متصلاً بالخادم؛ في Subversion و CVS، يمكنك تعديل الملفات، ولكن لا يمكنك تأكيد التغييرات (commit) إلى قاعدة بياناتك (لأن قاعدة بياناتك غير متصلة بالإنترنت). +قد لا يبدو هذا كصفقة ضخمة، ولكن قد تتفاجأ بالفارق الكبير الذي يمكن أن يحدثه. -==== Git Has Integrity +==== Git Has Integrity (Git يتمتع بالنزاهة) -Everything in Git is checksummed before it is stored and is then referred to by that checksum. -This means it's impossible to change the contents of any file or directory without Git knowing about it. -This functionality is built into Git at the lowest levels and is integral to its philosophy. -You can't lose information in transit or get file corruption without Git being able to detect it. +يتم إجراء اختبار المجموع (checksummed) لكل شيء في Git قبل تخزينه ثم يتم الإشارة إليه بواسطة اختبار المجموع (checksum) هذا. +هذا يعني أنه من المستحيل تغيير محتويات أي ملف أو دليل دون أن يعرف Git بذلك. +تم تضمين هذه الوظيفة في Git في أدنى المستويات وهي جزء لا يتجزأ من فلسفته. +لا يمكنك فقد المعلومات أثناء النقل أو التعرض لتلف الملفات دون أن يتمكن Git من اكتشاف ذلك. -The mechanism that Git uses for this checksumming is called a SHA-1 hash.(((SHA-1))) -This is a 40-character string composed of hexadecimal characters (0–9 and a–f) and calculated based on the contents of a file or directory structure in Git. -A SHA-1 hash looks something like this: +الآلية التي يستخدمها Git لاختبار المجموع (checksumming) هذا تسمى تجزئة SHA-1 (SHA-1 hash).(((SHA-1))) +هذه سلسلة مكونة من 40 حرفاً تتكون من أحرف سداسية عشرية (hexadecimal) (0–9 و a–f) ويتم حسابها بناءً على محتويات ملف أو بنية دليل (directory structure) في Git. +تبدو تجزئة SHA-1 (SHA-1 hash) كما يلي: [source] ---- 24b9da6552252987aa493b52f8696cd6d3b00373 ---- -You will see these hash values all over the place in Git because it uses them so much. -In fact, Git stores everything in its database not by file name but by the hash value of its contents. +سترى قيم التجزئة (hash values) هذه في كل مكان في Git لأنه يستخدمها كثيراً. +في الواقع، يقوم Git بتخزين كل شيء في قاعدة بياناته ليس باسم الملف ولكن بقيمة التجزئة (hash value) لمحتوياته. -==== Git Generally Only Adds Data +==== Git Generally Only Adds Data (Git يضيف البيانات بشكل عام فقط) -When you do actions in Git, nearly all of them only _add_ data to the Git database. -It is hard to get the system to do anything that is not undoable or to make it erase data in any way. -As with any VCS, you can lose or mess up changes you haven't committed yet, but after you commit a snapshot into Git, it is very difficult to lose, especially if you regularly push your database to another repository. +عندما تقوم بإجراءات في Git، فإن جميعها تقريباً تقوم فقط _بإضافة (add)_ البيانات إلى قاعدة بيانات Git. +من الصعب جعل النظام يفعل أي شيء لا يمكن التراجع عنه (undoable) أو جعله يمسح البيانات بأي شكل من الأشكال. +كما هو الحال مع أي نظام VCS (نظام تحكم في الإصدارات)، يمكنك أن تفقد أو تفسد التغييرات التي لم تقم بتأكيدها (commit) بعد، ولكن بعد تأكيد (commit) لقطة (snapshot) في Git، من الصعب جداً فقدانها، خاصة إذا كنت تقوم بدفع (push) قاعدة بياناتك بانتظام إلى مستودع (repository) آخر. -This makes using Git a joy because we know we can experiment without the danger of severely screwing things up. -For a more in-depth look at how Git stores its data and how you can recover data that seems lost, see <>. +هذا يجعل استخدام Git متعة لأننا نعلم أنه يمكننا التجربة دون خطر إفساد الأمور بشدة. +للحصول على نظرة أكثر تعمقاً حول كيفية تخزين Git لبياناته وكيف يمكنك استعادة البيانات التي تبدو مفقودة، راجع <>. -==== The Three States +==== The Three States (الحالات الثلاث) -Pay attention now -- here is the main thing to remember about Git if you want the rest of your learning process to go smoothly. -Git has three main states that your files can reside in: _modified_, _staged_, and _committed_: +انتبه الآن -- هذا هو الشيء الرئيسي الذي يجب تذكره عن Git إذا كنت تريد أن تسير بقية عملية التعلم الخاصة بك بسلاسة. +يحتوي Git على ثلاث حالات رئيسية يمكن أن تتواجد فيها ملفاتك: _modified (معدل)_، _staged (مُجَهّز)_، و _committed (مُؤَكَّد)_: -* Modified means that you have changed the file but have not committed it to your database yet. -* Staged means that you have marked a modified file in its current version to go into your next commit snapshot. -* Committed means that the data is safely stored in your local database. +* المعدل (Modified) يعني أنك قمت بتغيير الملف ولكنك لم تقم بتأكيده (commit) في قاعدة بياناتك بعد. +* المُجَهّز (Staged) يعني أنك قمت بوضع علامة على ملف معدل (modified file) في إصداره الحالي ليذهب في لقطة التأكيد (commit snapshot) التالية. +* المُؤَكَّد (Committed) يعني أنه تم تخزين البيانات بأمان في قاعدة بياناتك المحلية (local database). -This leads us to the three main sections of a Git project: the working tree, the staging area, and the Git directory. +يقودنا هذا إلى الأقسام الثلاثة الرئيسية لمشروع Git: شجرة العمل (working tree)، ومنطقة التجهيز (staging area)، ودليل Git (Git directory). -.Working tree, staging area, and Git directory +.Working tree, staging area, and Git directory (شجرة العمل، ومنطقة التجهيز، ودليل Git) image::images/areas.png["Working tree, staging area, and Git directory"] -The working tree is a single checkout of one version of the project. -These files are pulled out of the compressed database in the Git directory and placed on disk for you to use or modify. +شجرة العمل (working tree) هي سحب (checkout) واحد لإصدار واحد من المشروع. +يتم سحب هذه الملفات من قاعدة البيانات المضغوطة (compressed database) في دليل Git (Git directory) ووضعها على القرص لتستخدمها أو تعدلها. -The staging area is a file, generally contained in your Git directory, that stores information about what will go into your next commit. -Its technical name in Git parlance is the "`index`", but the phrase "`staging area`" works just as well. +منطقة التجهيز (staging area) هي ملف، يوجد عادةً في دليل Git الخاص بك، والذي يخزن معلومات حول ما سيدخل في عملية التأكيد (commit) التالية. +اسمها التقني في لغة Git هو "`الفهرس (index)`"، لكن عبارة "`منطقة التجهيز (staging area)`" تعمل بنفس الجودة. -The Git directory is where Git stores the metadata and object database for your project. -This is the most important part of Git, and it is what is copied when you _clone_ a repository from another computer. +دليل Git (Git directory) هو المكان الذي يخزن فيه Git البيانات الوصفية (metadata) وقاعدة بيانات الكائنات (object database) لمشروعك. +هذا هو الجزء الأهم من Git، وهو ما يتم نسخه عند _استنساخ (clone)_ مستودع من كمبيوتر آخر. -The basic Git workflow goes something like this: +يسير سير عمل Git (Git workflow) الأساسي على النحو التالي: -1. You modify files in your working tree. -2. You selectively stage just those changes you want to be part of your next commit, which adds _only_ those changes to the staging area. -3. You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory. +1. تقوم بتعديل الملفات في شجرة العمل (working tree) الخاصة بك. +2. تقوم بتجهيز (stage) التغييرات التي تريدها بشكل انتقائي لتكون جزءاً من عملية التأكيد (commit) التالية، مما يضيف _فقط_ تلك التغييرات إلى منطقة التجهيز (staging area). +3. تقوم بإجراء عملية تأكيد (commit)، والتي تأخذ الملفات كما هي في منطقة التجهيز (staging area) وتخزن تلك اللقطة (snapshot) بشكل دائم في دليل Git (Git directory) الخاص بك. -If a particular version of a file is in the Git directory, it's considered _committed_. -If it has been modified and was added to the staging area, it is _staged_. -And if it was changed since it was checked out but has not been staged, it is _modified_. -In <>, you'll learn more about these states and how you can either take advantage of them or skip the staged part entirely. +إذا كان إصدار معين من ملف موجوداً في دليل Git (Git directory)، فإنه يعتبر _مُؤَكَّداً (committed)_. +إذا تم تعديله وإضافته إلى منطقة التجهيز (staging area)، فهو _مُجَهّز (staged)_. +وإذا تم تغييره منذ سحبه (checked out) ولكن لم يتم تجهيزه، فهو _معدل (modified)_. +في <>، ستتعلم المزيد عن هذه الحالات وكيف يمكنك إما الاستفادة منها أو تخطي جزء التجهيز بالكامل. diff --git a/book/02-git-basics/sections/aliases.asc b/book/02-git-basics/sections/aliases.asc index 5d6d117cd..e46bc0ac7 100644 --- a/book/02-git-basics/sections/aliases.asc +++ b/book/02-git-basics/sections/aliases.asc @@ -1,13 +1,13 @@ [[_git_aliases]] -=== Git Aliases +=== Git Aliases (الأسماء المستعارة في Git) (((aliases))) -Before we move on to the next chapter, we want to introduce a feature that can make your Git experience simpler, easier, and more familiar: aliases. -For clarity's sake, we won't be using them anywhere else in this book, but if you go on to use Git with any regularity, aliases are something you should know about. +قبل أن ننتقل إلى الفصل التالي، نريد تقديم ميزة يمكن أن تجعل تجربة Git (Git experience) الخاصة بك أبسط وأسهل وأكثر ألفة: الأسماء المستعارة (aliases). +من أجل الوضوح، لن نستخدمها في أي مكان آخر في هذا الكتاب، ولكن إذا استمررت في استخدام Git بأي قدر من الانتظام، فإن الأسماء المستعارة (aliases) هي شيء يجب أن تعرفه. -Git doesn't automatically infer your command if you type it in partially. -If you don't want to type the entire text of each of the Git commands, you can easily set up an alias for each command using `git config`.(((git commands, config))) -Here are a couple of examples you may want to set up: +لا يستنتج Git أمرك (command) تلقائياً إذا كتبته جزئياً (partially). +إذا كنت لا ترغب في كتابة النص الكامل لكل أمر من أوامر Git، يمكنك بسهولة إعداد اسم مستعار (alias) لكل أمر باستخدام `git config`.(((git commands, config))) +إليك بعض الأمثلة التي قد ترغب في إعدادها: [source,console] ---- @@ -17,18 +17,18 @@ $ git config --global alias.ci commit $ git config --global alias.st status ---- -This means that, for example, instead of typing `git commit`, you just need to type `git ci`. -As you go on using Git, you'll probably use other commands frequently as well; don't hesitate to create new aliases. +هذا يعني، على سبيل المثال، أنه بدلاً من كتابة `git commit`، تحتاج فقط إلى كتابة `git ci`. +مع استمرارك في استخدام Git، ربما ستستخدم أوامر أخرى بشكل متكرر أيضاً؛ لا تتردد في إنشاء أسماء مستعارة (aliases) جديدة. -This technique can also be very useful in creating commands that you think should exist. -For example, to correct the usability problem you encountered with unstaging a file, you can add your own unstage alias to Git: +يمكن أن تكون هذه التقنية مفيدة جداً أيضاً في إنشاء الأوامر التي تعتقد أنها يجب أن تكون موجودة. +على سبيل المثال، لتصحيح مشكلة قابلية الاستخدام (usability problem) التي واجهتها مع إلغاء تجهيز (unstaging) ملف، يمكنك إضافة اسم مستعار (alias) خاص بك للإلغاء (unstage) إلى Git: [source,console] ---- $ git config --global alias.unstage 'reset HEAD --' ---- -This makes the following two commands equivalent: +هذا يجعل الأمرين التاليين متكافئين: [source,console] ---- @@ -36,15 +36,15 @@ $ git unstage fileA $ git reset HEAD -- fileA ---- -This seems a bit clearer. -It's also common to add a `last` command, like this: +يبدو هذا أكثر وضوحاً بعض الشيء. +من الشائع أيضاً إضافة أمر `last` (الأخير)، مثل هذا: [source,console] ---- $ git config --global alias.last 'log -1 HEAD' ---- -This way, you can see the last commit easily: +بهذه الطريقة، يمكنك رؤية آخر عملية تأكيد (last commit) بسهولة: [source,console] ---- @@ -58,13 +58,13 @@ Date: Tue Aug 26 19:48:51 2008 +0800 Signed-off-by: Scott Chacon ---- -As you can tell, Git simply replaces the new command with whatever you alias it for. -However, maybe you want to run an external command, rather than a Git subcommand. -In that case, you start the command with a `!` character. -This is useful if you write your own tools that work with a Git repository. -We can demonstrate by aliasing `git visual` to run `gitk`: +كما يمكنك أن تلاحظ، يستبدل Git ببساطة الأمر الجديد بأي شيء تقوم بتعيينه كاسم مستعار له (alias it for). +ومع ذلك، ربما تريد تشغيل أمر خارجي (external command)، بدلاً من أمر فرعي (subcommand) من Git. +في هذه الحالة، تبدأ الأمر بحرف `!`. +هذا مفيد إذا قمت بكتابة أدواتك الخاصة (own tools) التي تعمل مع مستودع Git (Git repository). +يمكننا توضيح ذلك عن طريق جعل `git visual` اسماً مستعاراً لتشغيل `gitk`: [source,console] ---- $ git config --global alias.visual '!gitk' ----- +---- \ No newline at end of file diff --git a/book/02-git-basics/sections/getting-a-repository.asc b/book/02-git-basics/sections/getting-a-repository.asc index 3b69efd08..25bbd94fc 100644 --- a/book/02-git-basics/sections/getting-a-repository.asc +++ b/book/02-git-basics/sections/getting-a-repository.asc @@ -1,47 +1,47 @@ [[_getting_a_repo]] -=== Getting a Git Repository +=== Getting a Git Repository (الحصول على مستودع Git) -You typically obtain a Git repository in one of two ways: +عادةً ما تحصل على مستودع Git (Git repository) بإحدى طريقتين: -1. You can take a local directory that is currently not under version control, and turn it into a Git repository, or -2. You can _clone_ an existing Git repository from elsewhere. +1. يمكنك أخذ دليل محلي (local directory) لا يخضع حالياً للتحكم في الإصدار (version control)، وتحويله إلى مستودع Git، أو +2. يمكنك _استنساخ (clone)_ مستودع Git موجود من مكان آخر. -In either case, you end up with a Git repository on your local machine, ready for work. +في كلتا الحالتين، ينتهي بك الأمر بوجود مستودع Git على جهازك المحلي، جاهز للعمل. -==== Initializing a Repository in an Existing Directory +==== Initializing a Repository in an Existing Directory (تهيئة مستودع في دليل موجود) -If you have a project directory that is currently not under version control and you want to start controlling it with Git, you first need to go to that project's directory. -If you've never done this, it looks a little different depending on which system you're running: +إذا كان لديك دليل مشروع لا يخضع حالياً للتحكم في الإصدار (version control) وتريد البدء في التحكم فيه باستخدام Git، فعليك أولاً الانتقال إلى دليل ذلك المشروع. +إذا لم تفعل ذلك من قبل، فسيبدو الأمر مختلفاً قليلاً بناءً على النظام الذي تقوم بتشغيله: -for Linux: +لنظام Linux: [source,console] ---- $ cd /home/user/my_project ---- -for macOS: +لنظام macOS: [source,console] ---- $ cd /Users/user/my_project ---- -for Windows: +لنظام Windows: [source,console] ---- $ cd C:/Users/user/my_project ---- -and type: +واكتب: [source,console] ---- $ git init ---- -This creates a new subdirectory named `.git` that contains all of your necessary repository files -- a Git repository skeleton. -At this point, nothing in your project is tracked yet. -See <> for more information about exactly what files are contained in the `.git` directory you just created.(((git commands, init))) +يؤدي هذا إلى إنشاء دليل فرعي جديد (new subdirectory) باسم `.git` يحتوي على جميع ملفات المستودع (repository files) الضرورية -- هيكل مستودع Git (Git repository skeleton). +في هذه المرحلة، لا يتم تتبع (tracked) أي شيء في مشروعك بعد. +راجع <> لمزيد من المعلومات حول الملفات الموجودة بالضبط في دليل `.git` الذي قمت بإنشائه للتو.(((git commands, init))) -If you want to start version-controlling existing files (as opposed to an empty directory), you should probably begin tracking those files and do an initial commit. -You can accomplish that with a few `git add` commands that specify the files you want to track, followed by a `git commit`: +إذا كنت ترغب في البدء في التحكم في إصدار الملفات الموجودة (على عكس الدليل الفارغ)، فربما يجب عليك البدء في تتبع (tracking) تلك الملفات وإجراء عملية تأكيد أولية (initial commit). +يمكنك إنجاز ذلك ببضعة أوامر `git add` تحدد الملفات التي تريد تتبعها، متبوعة بأمر `git commit`: [source,console] ---- @@ -50,38 +50,38 @@ $ git add LICENSE $ git commit -m 'Initial project version' ---- -We'll go over what these commands do in just a minute. -At this point, you have a Git repository with tracked files and an initial commit. +سنستعرض ما تفعله هذه الأوامر في غضون دقيقة. +في هذه المرحلة، لديك مستودع Git بملفات متتبعة (tracked files) وعملية تأكيد أولية (initial commit). [[_git_cloning]] -==== Cloning an Existing Repository +==== Cloning an Existing Repository (استنساخ مستودع موجود) -If you want to get a copy of an existing Git repository -- for example, a project you'd like to contribute to -- the command you need is `git clone`. -If you're familiar with other VCSs such as Subversion, you'll notice that the command is "clone" and not "checkout". -This is an important distinction -- instead of getting just a working copy, Git receives a full copy of nearly all data that the server has. -Every version of every file for the history of the project is pulled down by default when you run `git clone`. -In fact, if your server disk gets corrupted, you can often use nearly any of the clones on any client to set the server back to the state it was in when it was cloned (you may lose some server-side hooks and such, but all the versioned data would be there -- see <> for more details). +إذا كنت ترغب في الحصول على نسخة من مستودع Git (Git repository) موجود -- على سبيل المثال، مشروع ترغب في المساهمة فيه -- فإن الأمر الذي تحتاجه هو `git clone`. +إذا كنت على دراية بأنظمة VCS (أنظمة التحكم في الإصدارات) الأخرى مثل Subversion، فستلاحظ أن الأمر هو "استنساخ (clone)" وليس "سحب (checkout)". +هذا تمييز مهم -- فبدلاً من الحصول على مجرد نسخة عمل (working copy)، يتلقى Git نسخة كاملة (full copy) من جميع البيانات الموجودة على الخادم تقريباً. +يتم سحب كل إصدار من كل ملف لسجل (history) المشروع افتراضياً عند تشغيل `git clone`. +في الواقع، إذا تلف قرص الخادم، يمكنك غالباً استخدام أي من النسخ المستنسخة (clones) على أي عميل (client) لإعادة الخادم إلى الحالة التي كان عليها عند استنساخه (قد تفقد بعض خطافات جانب الخادم (server-side hooks) وما شابه، ولكن ستكون جميع البيانات ذات الإصدارات موجودة -- راجع <> لمزيد من التفاصيل). -You clone a repository with `git clone `.(((git commands, clone))) -For example, if you want to clone the Git linkable library called `libgit2`, you can do so like this: +أنت تستنسخ (clone) مستودعاً (repository) باستخدام `git clone `.(((git commands, clone))) +على سبيل المثال، إذا كنت تريد استنساخ مكتبة Git القابلة للربط المسماة `libgit2`، فيمكنك القيام بذلك على النحو التالي: [source,console] ---- $ git clone https://github.com/libgit2/libgit2 ---- -That creates a directory named `libgit2`, initializes a `.git` directory inside it, pulls down all the data for that repository, and checks out a working copy of the latest version. -If you go into the new `libgit2` directory that was just created, you'll see the project files in there, ready to be worked on or used. +يؤدي ذلك إلى إنشاء دليل باسم `libgit2`، وتهيئة دليل `.git` بداخله، وسحب (pulls down) جميع البيانات الخاصة بذلك المستودع، واستخراج (checks out) نسخة عمل (working copy) لأحدث إصدار. +إذا ذهبت إلى دليل `libgit2` الجديد الذي تم إنشاؤه للتو، فسترى ملفات المشروع هناك، جاهزة للعمل عليها أو استخدامها. -If you want to clone the repository into a directory named something other than `libgit2`, you can specify the new directory name as an additional argument: +إذا كنت تريد استنساخ المستودع (repository) في دليل باسم آخر غير `libgit2`، فيمكنك تحديد اسم الدليل الجديد كوسيطة (argument) إضافية: [source,console] ---- $ git clone https://github.com/libgit2/libgit2 mylibgit ---- -That command does the same thing as the previous one, but the target directory is called `mylibgit`. +يقوم هذا الأمر بنفس الشيء الذي يقوم به الأمر السابق، ولكن يسمى الدليل الهدف `mylibgit`. -Git has a number of different transfer protocols you can use. -The previous example uses the `https://` protocol, but you may also see `git://` or `user@server:path/to/repo.git`, which uses the SSH transfer protocol. -<> will introduce all of the available options the server can set up to access your Git repository and the pros and cons of each. +يحتوي Git على عدد من بروتوكولات النقل المختلفة (transfer protocols) التي يمكنك استخدامها. +يستخدم المثال السابق بروتوكول `https://`، ولكن قد ترى أيضاً `git://` أو `user@server:path/to/repo.git`، والذي يستخدم بروتوكول نقل SSH. +سيعرض <> جميع الخيارات المتاحة التي يمكن للخادم إعدادها للوصول إلى مستودع Git (Git repository) الخاص بك وإيجابيات وسلبيات كل منها. \ No newline at end of file diff --git a/book/02-git-basics/sections/recording-changes.asc b/book/02-git-basics/sections/recording-changes.asc index 8bcd785fe..8d9688b25 100644 --- a/book/02-git-basics/sections/recording-changes.asc +++ b/book/02-git-basics/sections/recording-changes.asc @@ -1,26 +1,26 @@ -=== Recording Changes to the Repository +=== Recording Changes to the Repository (تسجيل التغييرات في المستودع) -At this point, you should have a _bona fide_ Git repository on your local machine, and a checkout or _working copy_ of all of its files in front of you. -Typically, you'll want to start making changes and committing snapshots of those changes into your repository each time the project reaches a state you want to record. +في هذه المرحلة، يجب أن يكون لديك مستودع Git (Git repository) _حقيقي (bona fide)_ على جهازك المحلي، وسحب (checkout) أو _نسخة عمل (working copy)_ من جميع ملفاته أمامك. +عادةً، ستحتاج إلى البدء في إجراء التغييرات وتأكيد (committing) لقطات (snapshots) لتلك التغييرات في مستودعك في كل مرة يصل فيها المشروع إلى حالة ترغب في تسجيلها. -Remember that each file in your working directory can be in one of two states: _tracked_ or _untracked_. -Tracked files are files that were in the last snapshot, as well as any newly staged files; they can be unmodified, modified, or staged. -In short, tracked files are files that Git knows about. +تذكر أن كل ملف في دليل العمل الخاص بك (working directory) يمكن أن يكون في إحدى حالتين: _متتبع (tracked)_ أو _غير متتبع (untracked)_. +الملفات المتتبعة (Tracked files) هي الملفات التي كانت في اللقطة الأخيرة (last snapshot)، بالإضافة إلى أي ملفات مجهزة حديثاً (newly staged files)؛ يمكن أن تكون غير معدلة (unmodified)، أو معدلة (modified)، أو مجهزة (staged). +باختصار، الملفات المتتبعة (tracked files) هي الملفات التي يعرفها Git. -Untracked files are everything else -- any files in your working directory that were not in your last snapshot and are not in your staging area. -When you first clone a repository, all of your files will be tracked and unmodified because Git just checked them out and you haven't edited anything. +الملفات غير المتتبعة (Untracked files) هي كل شيء آخر -- أي ملفات في دليل العمل الخاص بك (working directory) لم تكن في لقطتك الأخيرة (last snapshot) وليست في منطقة التجهيز (staging area) الخاصة بك. +عندما تقوم باستنساخ مستودع (clone a repository) لأول مرة، سيتم تتبع جميع ملفاتك (tracked) وستكون غير معدلة (unmodified) لأن Git قد قام للتو بسحبها (checked them out) ولم تقم بتعديل أي شيء. -As you edit files, Git sees them as modified, because you've changed them since your last commit. -As you work, you selectively stage these modified files and then commit all those staged changes, and the cycle repeats. +أثناء تعديلك للملفات، يراها Git كمعدلة (modified)، لأنك قمت بتغييرها منذ آخر عملية تأكيد (commit). +أثناء عملك، تقوم بشكل انتقائي بتجهيز (stage) هذه الملفات المعدلة ثم تقوم بتأكيد (commit) جميع تلك التغييرات المجهزة، وتتكرر الدورة. -.The lifecycle of the status of your files +.The lifecycle of the status of your files (دورة حياة حالة ملفاتك) image::images/lifecycle.png[The lifecycle of the status of your files] [[_checking_status]] -==== Checking the Status of Your Files +==== Checking the Status of Your Files (التحقق من حالة ملفاتك) -The main tool you use to determine which files are in which state is the `git status` command.(((git commands, status))) -If you run this command directly after a clone, you should see something like this: +الأداة الرئيسية التي تستخدمها لتحديد الملفات الموجودة في أي حالة هي أمر `git status`.(((git commands, status))) +إذا قمت بتشغيل هذا الأمر مباشرة بعد الاستنساخ (clone)، يجب أن ترى شيئاً كهذا: [source,console] ---- @@ -30,23 +30,23 @@ Your branch is up-to-date with 'origin/master'. nothing to commit, working tree clean ---- -This means you have a clean working directory; in other words, none of your tracked files are modified. -Git also doesn't see any untracked files, or they would be listed here. -Finally, the command tells you which branch you're on and informs you that it has not diverged from the same branch on the server. -For now, that branch is always `master`, which is the default; you won't worry about it here. -<> will go over branches and references in detail. +هذا يعني أن لديك دليل عمل نظيف (clean working directory)؛ بعبارة أخرى، لم يتم تعديل أي من ملفاتك المتتبعة (tracked files). +لا يرى Git أيضاً أي ملفات غير متتبعة (untracked files)، وإلا لكانت مدرجة هنا. +أخيراً، يخبرك الأمر بالفرع (branch) الذي تتواجد عليه ويعلمك أنه لم ينحرف (diverged) عن نفس الفرع الموجود على الخادم. +في الوقت الحالي، هذا الفرع هو دائماً `master`، وهو الافتراضي؛ لن تقلق بشأنه هنا. +سيستعرض <> الفروع والمراجع (branches and references) بالتفصيل. [NOTE] ==== -GitHub changed the default branch name from `master` to `main` in mid-2020, and other Git hosts followed suit. -So you may find that the default branch name in some newly created repositories is `main` and not `master`. -In addition, the default branch name can be changed (as you have seen in <>), so you may see a different name for the default branch. +قام GitHub بتغيير اسم الفرع الافتراضي (default branch name) من `master` إلى `main` في منتصف عام 2020، وحذت مضيفات Git (Git hosts) الأخرى حذوه. +لذا قد تجد أن اسم الفرع الافتراضي في بعض المستودعات المنشأة حديثاً هو `main` وليس `master`. +بالإضافة إلى ذلك، يمكن تغيير اسم الفرع الافتراضي (كما رأيت في <>)، لذا قد ترى اسماً مختلفاً للفرع الافتراضي. -However, Git itself still uses `master` as the default, so we will use it throughout the book. +ومع ذلك، لا يزال Git نفسه يستخدم `master` كافتراضي، لذا سنستخدمه طوال الكتاب. ==== -Let's say you add a new file to your project, a simple `README` file. -If the file didn't exist before, and you run `git status`, you see your untracked file like so: +لنفترض أنك أضفت ملفاً جديداً إلى مشروعك، ملف `README` بسيط. +إذا لم يكن الملف موجوداً من قبل، وقمت بتشغيل `git status`، فسترى ملفك غير المتتبع (untracked file) كالتالي: [source,console] ---- @@ -62,23 +62,23 @@ Untracked files: nothing added to commit but untracked files present (use "git add" to track) ---- -You can see that your new `README` file is untracked, because it's under the "`Untracked files`" heading in your status output. -Untracked basically means that Git sees a file you didn't have in the previous snapshot (commit), and which hasn't yet been staged; Git won't start including it in your commit snapshots until you explicitly tell it to do so. -It does this so you don't accidentally begin including generated binary files or other files that you did not mean to include. -You do want to start including `README`, so let's start tracking the file. +يمكنك أن ترى أن ملف `README` الجديد الخاص بك غير متتبع (untracked)، لأنه يندرج تحت عنوان "`Untracked files`" (ملفات غير متتبعة) في مخرجات الحالة الخاصة بك. +يعني غير المتتبع (Untracked) في الأساس أن Git يرى ملفاً لم يكن لديك في اللقطة السابقة (عملية التأكيد - commit)، والذي لم يتم تجهيزه (staged) بعد؛ لن يبدأ Git في تضمينه في لقطات التأكيد الخاصة بك (commit snapshots) حتى تطلب منه صراحة القيام بذلك. +يفعل ذلك حتى لا تبدأ عن طريق الخطأ في تضمين الملفات الثنائية (binary files) التي تم إنشاؤها أو الملفات الأخرى التي لم تكن تنوي تضمينها. +أنت تريد البدء في تضمين `README`، لذا دعنا نبدأ في تتبع الملف (tracking the file). [[_tracking_files]] -==== Tracking New Files +==== Tracking New Files (تتبع الملفات الجديدة) -In order to begin tracking a new file, you use the command `git add`.(((git commands, add))) -To begin tracking the `README` file, you can run this: +من أجل البدء في تتبع ملف جديد، يمكنك استخدام الأمر `git add`.(((git commands, add))) +للبدء في تتبع ملف `README`، يمكنك تشغيل هذا: [source,console] ---- $ git add README ---- -If you run your status command again, you can see that your `README` file is now tracked and staged to be committed: +إذا قمت بتشغيل أمر الحالة (status command) الخاص بك مرة أخرى، يمكنك أن ترى أن ملف `README` الخاص بك أصبح الآن متتبعاً (tracked) ومجهزاً (staged) ليتم تأكيده (committed): [source,console] ---- @@ -92,15 +92,15 @@ Changes to be committed: ---- -You can tell that it's staged because it's under the "`Changes to be committed`" heading. -If you commit at this point, the version of the file at the time you ran `git add` is what will be in the subsequent historical snapshot. -You may recall that when you ran `git init` earlier, you then ran `git add ` -- that was to begin tracking files in your directory.(((git commands, init)))(((git commands, add))) -The `git add` command takes a path name for either a file or a directory; if it's a directory, the command adds all the files in that directory recursively. +يمكنك معرفة أنه مجهز (staged) لأنه يندرج تحت عنوان "`Changes to be committed`" (تغييرات سيتم تأكيدها). +إذا قمت بالتأكيد (commit) في هذه المرحلة، فإن إصدار الملف في الوقت الذي قمت فيه بتشغيل `git add` هو ما سيكون في اللقطة التاريخية (historical snapshot) اللاحقة. +قد تتذكر أنك عندما قمت بتشغيل `git init` سابقاً، قمت بعد ذلك بتشغيل `git add ` -- كان ذلك للبدء في تتبع الملفات في دليلك.(((git commands, init)))(((git commands, add))) +يأخذ أمر `git add` اسم مسار لملف أو دليل؛ إذا كان دليلاً، يضيف الأمر جميع الملفات الموجودة في ذلك الدليل بشكل متكرر (recursively). -==== Staging Modified Files +==== Staging Modified Files (تجهيز الملفات المعدلة) -Let's change a file that was already tracked. -If you change a previously tracked file called `CONTRIBUTING.md` and then run your `git status` command again, you get something that looks like this: +دعنا نغير ملفاً كان متتبعاً (tracked) بالفعل. +إذا قمت بتغيير ملف تم تتبعه مسبقاً يسمى `CONTRIBUTING.md` ثم قمت بتشغيل أمر `git status` الخاص بك مرة أخرى، ستحصل على شيء يبدو كالتالي: [source,console] ---- @@ -120,11 +120,11 @@ Changes not staged for commit: ---- -The `CONTRIBUTING.md` file appears under a section named "`Changes not staged for commit`" -- which means that a file that is tracked has been modified in the working directory but not yet staged. -To stage it, you run the `git add` command. -`git add` is a multipurpose command -- you use it to begin tracking new files, to stage files, and to do other things like marking merge-conflicted files as resolved. -It may be helpful to think of it more as "`add precisely this content to the next commit`" rather than "`add this file to the project`".(((git commands, add))) -Let's run `git add` now to stage the `CONTRIBUTING.md` file, and then run `git status` again: +يظهر ملف `CONTRIBUTING.md` ضمن قسم يسمى "`Changes not staged for commit`" (تغييرات غير مجهزة للتأكيد) -- مما يعني أن الملف المتتبع قد تم تعديله في دليل العمل (working directory) ولكن لم يتم تجهيزه (staged) بعد. +لتجهيزه، تقوم بتشغيل أمر `git add`. +`git add` هو أمر متعدد الأغراض -- تستخدمه للبدء في تتبع ملفات جديدة، ولتجهيز الملفات (stage files)، والقيام بأشياء أخرى مثل وضع علامة على الملفات المتعارضة في الدمج (merge-conflicted files) على أنها محلولة (resolved). +قد يكون من المفيد التفكير فيه على أنه "`أضف هذا المحتوى بالضبط إلى عملية التأكيد التالية (add precisely this content to the next commit)`" بدلاً من "`أضف هذا الملف إلى المشروع (add this file to the project)`".(((git commands, add))) +دعنا نشغل `git add` الآن لتجهيز (stage) ملف `CONTRIBUTING.md`، ثم نشغل `git status` مرة أخرى: [source,console] ---- @@ -140,10 +140,10 @@ Changes to be committed: ---- -Both files are staged and will go into your next commit. -At this point, suppose you remember one little change that you want to make in `CONTRIBUTING.md` before you commit it. -You open it again and make that change, and you're ready to commit. -However, let's run `git status` one more time: +كلا الملفين مجهزان (staged) وسيدخلان في عملية التأكيد (commit) التالية. +في هذه المرحلة، افترض أنك تذكرت تغييراً صغيراً واحداً تريد إجراءه في `CONTRIBUTING.md` قبل تأكيده (commit it). +تقوم بفتحه مرة أخرى وإجراء ذلك التغيير، وتكون جاهزاً للتأكيد. +ومع ذلك، دعنا نشغل `git status` مرة أخرى: [source,console] ---- @@ -165,12 +165,12 @@ Changes not staged for commit: ---- -What the heck? -Now `CONTRIBUTING.md` is listed as both staged _and_ unstaged. -How is that possible? -It turns out that Git stages a file exactly as it is when you run the `git add` command. -If you commit now, the version of `CONTRIBUTING.md` as it was when you last ran the `git add` command is how it will go into the commit, not the version of the file as it looks in your working directory when you run `git commit`. -If you modify a file after you run `git add`, you have to run `git add` again to stage the latest version of the file: +ما هذا بحق الجحيم؟ +الآن `CONTRIBUTING.md` مدرج على أنه مجهز (staged) _و_ غير مجهز (unstaged) في نفس الوقت. +كيف يكون هذا ممكناً؟ +اتضح أن Git يقوم بتجهيز (stages) الملف تماماً كما هو عندما تقوم بتشغيل أمر `git add`. +إذا قمت بالتأكيد (commit) الآن، فإن إصدار `CONTRIBUTING.md` كما كان عندما قمت بتشغيل أمر `git add` آخر مرة هو ما سيدخل في عملية التأكيد، وليس إصدار الملف كما يبدو في دليل العمل (working directory) الخاص بك عند تشغيلك `git commit`. +إذا قمت بتعديل ملف بعد تشغيل `git add`، فيجب عليك تشغيل `git add` مرة أخرى لتجهيز (stage) أحدث إصدار من الملف: [source,console] ---- @@ -185,11 +185,11 @@ Changes to be committed: modified: CONTRIBUTING.md ---- -==== Short Status +==== Short Status (حالة قصيرة) -While the `git status` output is pretty comprehensive, it's also quite wordy. -Git also has a short status flag so you can see your changes in a more compact way. -If you run `git status -s` or `git status --short` you get a far more simplified output from the command: +على الرغم من أن مخرجات `git status` شاملة تماماً، إلا أنها أيضاً مسهبة (wordy) جداً. +يحتوي Git أيضاً على علامة حالة قصيرة (short status flag) لتتمكن من رؤية تغييراتك بطريقة أكثر إحكاماً. +إذا قمت بتشغيل `git status -s` أو `git status --short` فستحصل على مخرجات أكثر تبسيطاً بكثير من الأمر: [source,console] ---- @@ -201,18 +201,18 @@ M lib/simplegit.rb ?? LICENSE.txt ---- -New files that aren't tracked have a `??` next to them, new files that have been added to the staging area have an `A`, modified files have an `M` and so on. -There are two columns to the output -- the left-hand column indicates the status of the staging area and the right-hand column indicates the status of the working tree. -So for example in that output, the `README` file is modified in the working directory but not yet staged, while the `lib/simplegit.rb` file is modified and staged. -The `Rakefile` was modified, staged and then modified again, so there are changes to it that are both staged and unstaged. +الملفات الجديدة غير المتتبعة (untracked) تحتوي على `??` بجوارها، والملفات الجديدة التي تمت إضافتها إلى منطقة التجهيز (staging area) تحتوي على `A`، والملفات المعدلة تحتوي على `M` وهكذا. +يوجد عمودان في المخرجات -- يشير العمود الأيسر إلى حالة منطقة التجهيز (staging area) ويشير العمود الأيمن إلى حالة شجرة العمل (working tree). +لذا على سبيل المثال في تلك المخرجات، ملف `README` معدل (modified) في دليل العمل (working directory) ولكن لم يتم تجهيزه (staged) بعد، في حين أن ملف `lib/simplegit.rb` معدل ومجهز. +تم تعديل `Rakefile` وتجهيزه ثم تعديله مرة أخرى، لذلك هناك تغييرات عليه مجهزة وغير مجهزة في نفس الوقت. [[_ignoring]] -==== Ignoring Files +==== Ignoring Files (تجاهل الملفات) -Often, you'll have a class of files that you don't want Git to automatically add or even show you as being untracked. -These are generally automatically generated files such as log files or files produced by your build system. -In such cases, you can create a file listing patterns to match them named `.gitignore`.(((ignoring files))) -Here is an example `.gitignore` file: +غالباً، سيكون لديك فئة من الملفات التي لا تريد من Git إضافتها تلقائياً أو حتى إظهارها لك كملفات غير متتبعة (untracked). +هذه عادةً ما تكون ملفات تم إنشاؤها تلقائياً مثل ملفات السجل (log files) أو الملفات التي ينتجها نظام البناء (build system) الخاص بك. +في مثل هذه الحالات، يمكنك إنشاء ملف يسرد الأنماط (patterns) لمطابقتها يسمى `.gitignore`.(((ignoring files))) +إليك مثال على ملف `.gitignore`: [source,console] ---- @@ -221,24 +221,24 @@ $ cat .gitignore *~ ---- -The first line tells Git to ignore any files ending in "`.o`" or "`.a`" -- object and archive files that may be the product of building your code. -The second line tells Git to ignore all files whose names end with a tilde (`~`), which is used by many text editors such as Emacs to mark temporary files. -You may also include a log, tmp, or pid directory; automatically generated documentation; and so on. -Setting up a `.gitignore` file for your new repository before you get going is generally a good idea so you don't accidentally commit files that you really don't want in your Git repository. +يخبر السطر الأول Git بتجاهل أي ملفات تنتهي بـ "`.o`" أو "`.a`" -- ملفات الكائنات والأرشيف (object and archive files) التي قد تكون نتاج بناء الكود الخاص بك. +يخبر السطر الثاني Git بتجاهل جميع الملفات التي تنتهي أسماؤها بعلامة تيلدا (`~`)، والتي يتم استخدامها من قبل العديد من محررات النصوص مثل Emacs لتمييز الملفات المؤقتة. +يمكنك أيضاً تضمين دليل السجل (log) أو tmp أو pid؛ والوثائق التي تم إنشاؤها تلقائياً؛ وما إلى ذلك. +يعد إعداد ملف `.gitignore` لمستودعك الجديد قبل البدء فكرة جيدة بشكل عام حتى لا تقوم بتأكيد (commit) ملفات لا تريدها حقاً في مستودع Git (Git repository) الخاص بك عن طريق الخطأ. -The rules for the patterns you can put in the `.gitignore` file are as follows: +قواعد الأنماط (patterns) التي يمكنك وضعها في ملف `.gitignore` هي كما يلي: -* Blank lines or lines starting with `#` are ignored. -* Standard glob patterns work, and will be applied recursively throughout the entire working tree. -* You can start patterns with a forward slash (`/`) to avoid recursivity. -* You can end patterns with a forward slash (`/`) to specify a directory. -* You can negate a pattern by starting it with an exclamation point (`!`). +* يتم تجاهل الأسطر الفارغة أو الأسطر التي تبدأ بـ `#`. +* تعمل أنماط glob القياسية (Standard glob patterns)، وسيتم تطبيقها بشكل متكرر عبر كامل شجرة العمل (entire working tree). +* يمكنك بدء الأنماط بشرطة مائلة للأمام (`/`) لتجنب التكرار (recursivity). +* يمكنك إنهاء الأنماط بشرطة مائلة للأمام (`/`) لتحديد دليل. +* يمكنك نفي النمط عن طريق بدئه بعلامة تعجب (`!`). -Glob patterns are like simplified regular expressions that shells use. -An asterisk (`\*`) matches zero or more characters; `[abc]` matches any character inside the brackets (in this case a, b, or c); a question mark (`?`) matches a single character; and brackets enclosing characters separated by a hyphen (`[0-9]`) matches any character between them (in this case 0 through 9). -You can also use two asterisks to match nested directories; `a/**/z` would match `a/z`, `a/b/z`, `a/b/c/z`, and so on. +أنماط Glob (Glob patterns) تشبه التعبيرات النمطية المبسطة (simplified regular expressions) التي تستخدمها القذائف (shells). +تتطابق علامة النجمة (`\*`) مع صفر أو أكثر من الأحرف؛ ويتطابق `[abc]` مع أي حرف داخل الأقواس (في هذه الحالة a أو b أو c)؛ وتتطابق علامة الاستفهام (`?`) مع حرف واحد؛ وتتطابق الأقواس التي تحيط بأحرف مفصولة بواصلة (`[0-9]`) مع أي حرف بينها (في هذه الحالة من 0 إلى 9). +يمكنك أيضاً استخدام نجمتين لمطابقة الدلائل المتداخلة (nested directories)؛ سوف يتطابق `a/**/z` مع `a/z` و `a/b/z` و `a/b/c/z` وما إلى ذلك. -Here is another example `.gitignore` file: +إليك مثال آخر لملف `.gitignore`: [source] ---- @@ -263,29 +263,29 @@ doc/**/*.pdf [TIP] ==== -GitHub maintains a fairly comprehensive list of good `.gitignore` file examples for dozens of projects and languages at https://github.com/github/gitignore[^] if you want a starting point for your project. +يحتفظ GitHub بقائمة شاملة إلى حد ما من الأمثلة الجيدة لملفات `.gitignore` لعشرات المشاريع واللغات على الرابط https://github.com/github/gitignore[^] إذا كنت تريد نقطة انطلاق لمشروعك. ==== [NOTE] ==== -In the simple case, a repository might have a single `.gitignore` file in its root directory, which applies recursively to the entire repository. -However, it is also possible to have additional `.gitignore` files in subdirectories. -The rules in these nested `.gitignore` files apply only to the files under the directory where they are located. -The Linux kernel source repository has 206 `.gitignore` files. +في الحالة البسيطة، قد يحتوي المستودع على ملف `.gitignore` واحد في دليله الجذري (root directory)، والذي ينطبق بشكل متكرر على المستودع بالكامل. +ومع ذلك، من الممكن أيضاً الحصول على ملفات `.gitignore` إضافية في الدلائل الفرعية. +تنطبق القواعد الموجودة في ملفات `.gitignore` المتداخلة هذه فقط على الملفات الموجودة أسفل الدليل الذي توجد فيه. +يحتوي مستودع كود مصدر نواة Linux على 206 ملف `.gitignore`. -It is beyond the scope of this book to get into the details of multiple `.gitignore` files; see `man gitignore` for the details. +يخرج عن نطاق هذا الكتاب الخوض في تفاصيل ملفات `.gitignore` المتعددة؛ راجع `man gitignore` للحصول على التفاصيل. ==== [[_git_diff_staged]] -==== Viewing Your Staged and Unstaged Changes +==== Viewing Your Staged and Unstaged Changes (عرض التغييرات المجهزة وغير المجهزة) -If the `git status` command is too vague for you -- you want to know exactly what you changed, not just which files were changed -- you can use the `git diff` command.(((git commands, diff))) -We'll cover `git diff` in more detail later, but you'll probably use it most often to answer these two questions: What have you changed but not yet staged? -And what have you staged that you are about to commit? -Although `git status` answers those questions very generally by listing the file names, `git diff` shows you the exact lines added and removed -- the patch, as it were. +إذا كان أمر `git status` غامضاً جداً بالنسبة لك -- وتريد أن تعرف بالضبط ما الذي قمت بتغييره، وليس فقط الملفات التي تم تغييرها -- يمكنك استخدام أمر `git diff`.(((git commands, diff))) +سنغطي `git diff` بمزيد من التفصيل لاحقاً، ولكن ربما ستستخدمه في أغلب الأحيان للإجابة على هذين السؤالين: ما الذي قمت بتغييره ولكن لم تقم بتجهيزه (staged) بعد؟ +وما الذي قمت بتجهيزه (staged) وأنت على وشك تأكيده (commit)؟ +على الرغم من أن `git status` يجيب على هذه الأسئلة بشكل عام جداً عن طريق سرد أسماء الملفات، إلا أن `git diff` يوضح لك الأسطر الدقيقة التي تمت إضافتها وإزالتها -- التصحيح (patch)، كما كان. -Let's say you edit and stage the `README` file again and then edit the `CONTRIBUTING.md` file without staging it. -If you run your `git status` command, you once again see something like this: +لنفترض أنك قمت بتعديل وتجهيز (stage) ملف `README` مرة أخرى ثم قمت بتعديل ملف `CONTRIBUTING.md` دون تجهيزه (without staging it). +إذا قمت بتشغيل أمر `git status` الخاص بك، سترى مرة أخرى شيئاً كهذا: [source,console] ---- @@ -304,7 +304,7 @@ Changes not staged for commit: modified: CONTRIBUTING.md ---- -To see what you've changed but not yet staged, type `git diff` with no other arguments: +لرؤية ما قمت بتغييره ولكن لم تقم بتجهيزه (staged) بعد، اكتب `git diff` بدون أي وسيطات أخرى: [source,console] ---- @@ -325,11 +325,11 @@ index 8ebb991..643e24f 100644 that highlights your work in progress (and note in the PR title that it's ---- -That command compares what is in your working directory with what is in your staging area. -The result tells you the changes you've made that you haven't yet staged. +يقارن هذا الأمر ما هو موجود في دليل العمل (working directory) الخاص بك بما هو موجود في منطقة التجهيز (staging area). +تخبرك النتيجة بالتغييرات التي أجريتها والتي لم تقم بتجهيزها بعد. -If you want to see what you've staged that will go into your next commit, you can use `git diff --staged`. -This command compares your staged changes to your last commit: +إذا كنت تريد رؤية ما قمت بتجهيزه (staged) وسيدخل في عملية التأكيد (commit) التالية، يمكنك استخدام `git diff --staged`. +يقارن هذا الأمر تغييراتك المجهزة (staged changes) بآخر عملية تأكيد (last commit) لك: [source,console] ---- @@ -343,11 +343,11 @@ index 0000000..03902a1 +My Project ---- -It's important to note that `git diff` by itself doesn't show all changes made since your last commit -- only changes that are still unstaged. -If you've staged all of your changes, `git diff` will give you no output. +من المهم ملاحظة أن `git diff` بحد ذاته لا يظهر جميع التغييرات التي تم إجراؤها منذ آخر عملية تأكيد لك -- فقط التغييرات التي لا تزال غير مجهزة (unstaged). +إذا قمت بتجهيز جميع تغييراتك، فلن يعطيك `git diff` أي مخرجات. -For another example, if you stage the `CONTRIBUTING.md` file and then edit it, you can use `git diff` to see the changes in the file that are staged and the changes that are unstaged. -If our environment looks like this: +كمثال آخر، إذا قمت بتجهيز (stage) ملف `CONTRIBUTING.md` ثم قمت بتعديله، يمكنك استخدام `git diff` لرؤية التغييرات في الملف المجهزة (staged) والتغييرات غير المجهزة (unstaged). +إذا كانت بيئتنا تبدو كالتالي: [source,console] ---- @@ -368,7 +368,7 @@ Changes not staged for commit: modified: CONTRIBUTING.md ---- -Now you can use `git diff` to see what is still unstaged: +الآن يمكنك استخدام `git diff` لرؤية ما لا يزال غير مجهز (unstaged): [source,console] ---- @@ -384,7 +384,7 @@ index 643e24f..87f08c8 100644 +# test line ---- -and `git diff --cached` to see what you've staged so far (`--staged` and `--cached` are synonyms): +و `git diff --cached` لرؤية ما قمت بتجهيزه حتى الآن (`--staged` و `--cached` مترادفان): [source,console] ---- @@ -406,36 +406,36 @@ index 8ebb991..643e24f 100644 ---- [NOTE] -.Git Diff in an External Tool +.Git Diff in an External Tool (Git Diff في أداة خارجية) ==== -We will continue to use the `git diff` command in various ways throughout the rest of the book. -There is another way to look at these diffs if you prefer a graphical or external diff viewing program instead. -If you run `git difftool` instead of `git diff`, you can view any of these diffs in software like emerge, vimdiff and many more (including commercial products). -Run `git difftool --tool-help` to see what is available on your system. +سنستمر في استخدام أمر `git diff` بطرق مختلفة طوال بقية الكتاب. +هناك طريقة أخرى لإلقاء نظرة على هذه الاختلافات إذا كنت تفضل برنامج عرض اختلافات (diff viewing program) رسومياً أو خارجياً بدلاً من ذلك. +إذا قمت بتشغيل `git difftool` بدلاً من `git diff`، يمكنك عرض أي من هذه الاختلافات في برامج مثل emerge و vimdiff والعديد غيرها (بما في ذلك المنتجات التجارية). +قم بتشغيل `git difftool --tool-help` لرؤية ما هو متاح على نظامك. ==== [[_committing_changes]] -==== Committing Your Changes +==== Committing Your Changes (تأكيد تغييراتك) -Now that your staging area is set up the way you want it, you can commit your changes. -Remember that anything that is still unstaged -- any files you have created or modified that you haven't run `git add` on since you edited them -- won't go into this commit. -They will stay as modified files on your disk. -In this case, let's say that the last time you ran `git status`, you saw that everything was staged, so you're ready to commit your changes.(((git commands, status))) -The simplest way to commit is to type `git commit`:(((git commands, commit))) +الآن بعد إعداد منطقة التجهيز (staging area) بالطريقة التي تريدها، يمكنك تأكيد (commit) تغييراتك. +تذكر أن أي شيء لا يزال غير مجهز (unstaged) -- أي ملفات قمت بإنشائها أو تعديلها ولم تقم بتشغيل `git add` عليها منذ تحريرها -- لن يدخل في عملية التأكيد هذه. +ستبقى كملفات معدلة (modified files) على قرصك. +في هذه الحالة، لنفترض أن آخر مرة قمت فيها بتشغيل `git status`، رأيت أن كل شيء تم تجهيزه (staged)، لذا فأنت جاهز لتأكيد (commit) تغييراتك.(((git commands, status))) +أبسط طريقة للتأكيد هي كتابة `git commit`:(((git commands, commit))) [source,console] ---- $ git commit ---- -Doing so launches your editor of choice. +يؤدي القيام بذلك إلى تشغيل المحرر الذي تختاره. [NOTE] ==== -This is set by your shell's `EDITOR` environment variable -- usually vim or emacs, although you can configure it with whatever you want using the `git config --global core.editor` command as you saw in <>.(((editor, changing default)))(((git commands, config))) +يتم تعيين هذا بواسطة متغير البيئة `EDITOR` الخاص بقشرتك (shell) -- عادةً vim أو emacs، على الرغم من أنه يمكنك تكوينه بأي شيء تريده باستخدام الأمر `git config --global core.editor` كما رأيت في <>.(((editor, changing default)))(((git commands, config))) ==== -The editor displays the following text (this example is a Vim screen): +يعرض المحرر النص التالي (هذا المثال هو شاشة Vim): [source] ---- @@ -455,18 +455,18 @@ The editor displays the following text (this example is a Vim screen): ".git/COMMIT_EDITMSG" 9L, 283C ---- -You can see that the default commit message contains the latest output of the `git status` command commented out and one empty line on top. -You can remove these comments and type your commit message, or you can leave them there to help you remember what you're committing. +يمكنك أن ترى أن رسالة التأكيد (commit message) الافتراضية تحتوي على أحدث مخرجات لأمر `git status` كتعليق (commented out) وسطراً فارغاً واحداً في الأعلى. +يمكنك إزالة هذه التعليقات وكتابة رسالة التأكيد (commit message) الخاصة بك، أو يمكنك تركها هناك لمساعدتك على تذكر ما تقوم بتأكيده. [NOTE] ==== -For an even more explicit reminder of what you've modified, you can pass the `-v` option to `git commit`. -Doing so also puts the diff of your change in the editor so you can see exactly what changes you're committing. +للحصول على تذكير أكثر وضوحاً بما قمت بتعديله، يمكنك تمرير الخيار `-v` إلى `git commit`. +يؤدي القيام بذلك أيضاً إلى وضع اختلاف (diff) التغيير الخاص بك في المحرر حتى تتمكن من رؤية التغييرات التي تقوم بتأكيدها بالضبط. ==== -When you exit the editor, Git creates your commit with that commit message (with the comments and diff stripped out). +عندما تخرج من المحرر، يقوم Git بإنشاء عملية التأكيد (commit) الخاصة بك برسالة التأكيد تلك (مع تجريد التعليقات والاختلافات). -Alternatively, you can type your commit message inline with the `commit` command by specifying it after a `-m` flag, like this: +بدلاً من ذلك، يمكنك كتابة رسالة التأكيد الخاصة بك سطرياً (inline) مع أمر `commit` عن طريق تحديدها بعد علامة `-m`، كالتالي: [source,console] ---- @@ -476,19 +476,19 @@ $ git commit -m "Story 182: fix benchmarks for speed" create mode 100644 README ---- -Now you've created your first commit! -You can see that the commit has given you some output about itself: which branch you committed to (`master`), what SHA-1 checksum the commit has (`463dc4f`), how many files were changed, and statistics about lines added and removed in the commit. +الآن قمت بإنشاء أول عملية تأكيد (commit) لك! +يمكنك أن ترى أن عملية التأكيد قد أعطتك بعض المخرجات حول نفسها: إلى أي فرع قمت بالتأكيد (`master`)، وما هو اختبار المجموع SHA-1 (SHA-1 checksum) الذي تحمله عملية التأكيد (`463dc4f`)، وكم عدد الملفات التي تم تغييرها، وإحصائيات حول الأسطر المضافة والمزالة في عملية التأكيد. -Remember that the commit records the snapshot you set up in your staging area. -Anything you didn't stage is still sitting there modified; you can do another commit to add it to your history. -Every time you perform a commit, you're recording a snapshot of your project that you can revert to or compare to later. +تذكر أن عملية التأكيد (commit) تسجل اللقطة (snapshot) التي قمت بإعدادها في منطقة التجهيز (staging area) الخاصة بك. +أي شيء لم تقم بتجهيزه لا يزال يقبع هناك معدلاً؛ يمكنك إجراء عملية تأكيد أخرى لإضافته إلى سجلك (history). +في كل مرة تقوم فيها بإجراء عملية تأكيد (commit)، فأنت تقوم بتسجيل لقطة (snapshot) لمشروعك يمكنك الرجوع إليها (revert) أو مقارنتها لاحقاً. -==== Skipping the Staging Area +==== Skipping the Staging Area (تخطي منطقة التجهيز) (((staging area, skipping))) -Although it can be amazingly useful for crafting commits exactly how you want them, the staging area is sometimes a bit more complex than you need in your workflow. -If you want to skip the staging area, Git provides a simple shortcut. -Adding the `-a` option to the `git commit` command makes Git automatically stage every file that is already tracked before doing the commit, letting you skip the `git add` part: +على الرغم من أنه يمكن أن يكون مفيداً بشكل مذهل لصياغة عمليات التأكيد (commits) بالطريقة التي تريدها بالضبط، إلا أن منطقة التجهيز (staging area) تكون أحياناً أكثر تعقيداً قليلاً مما تحتاجه في سير عملك. +إذا كنت تريد تخطي منطقة التجهيز، يوفر Git اختصاراً بسيطاً. +إضافة الخيار `-a` إلى أمر `git commit` يجعل Git يقوم تلقائياً بتجهيز (stage) كل ملف يتم تتبعه بالفعل قبل إجراء عملية التأكيد (commit)، مما يتيح لك تخطي جزء `git add`: [source,console] ---- @@ -507,18 +507,18 @@ $ git commit -a -m 'Add new benchmarks' 1 file changed, 5 insertions(+), 0 deletions(-) ---- -Notice how you don't have to run `git add` on the `CONTRIBUTING.md` file in this case before you commit. -That's because the `-a` flag includes all changed files. -This is convenient, but be careful; sometimes this flag will cause you to include unwanted changes. +لاحظ كيف أنك لست مضطراً لتشغيل `git add` على ملف `CONTRIBUTING.md` في هذه الحالة قبل التأكيد (commit). +وذلك لأن العلامة `-a` تتضمن جميع الملفات التي تم تغييرها. +هذا مريح، ولكن كن حذراً؛ أحياناً تتسبب هذه العلامة في تضمين تغييرات غير مرغوب فيها. [[_removing_files]] -==== Removing Files +==== Removing Files (إزالة الملفات) (((files, removing))) -To remove a file from Git, you have to remove it from your tracked files (more accurately, remove it from your staging area) and then commit. -The `git rm` command does that, and also removes the file from your working directory so you don't see it as an untracked file the next time around. +لإزالة ملف من Git، يجب عليك إزالته من ملفاتك المتتبعة (tracked files) (بشكل أكثر دقة، إزالته من منطقة التجهيز الخاصة بك) ثم التأكيد (commit). +يقوم أمر `git rm` بذلك، ويزيل الملف أيضاً من دليل العمل الخاص بك (working directory) بحيث لا تراه كملف غير متتبع (untracked file) في المرة القادمة. -If you simply remove the file from your working directory, it shows up under the "`Changes not staged for commit`" (that is, _unstaged_) area of your `git status` output: +إذا قمت ببساطة بإزالة الملف من دليل العمل الخاص بك، فسيظهر أسفل منطقة "`Changes not staged for commit`" (التغييرات غير المجهزة للتأكيد) (أي _غير المجهزة - unstaged_) في مخرجات `git status` الخاصة بك: [source,console] ---- @@ -535,7 +535,7 @@ Changes not staged for commit: no changes added to commit (use "git add" and/or "git commit -a") ---- -Then, if you run `git rm`, it stages the file's removal: +ثم، إذا قمت بتشغيل `git rm`، فإنه يقوم بتجهيز إزالة الملف (stages the file's removal): [source,console] ---- @@ -550,58 +550,58 @@ Changes to be committed: deleted: PROJECTS.md ---- -The next time you commit, the file will be gone and no longer tracked. -If you modified the file or had already added it to the staging area, you must force the removal with the `-f` option. -This is a safety feature to prevent accidental removal of data that hasn't yet been recorded in a snapshot and that can't be recovered from Git. +في المرة القادمة التي تقوم فيها بالتأكيد (commit)، سيختفي الملف ولن يتم تتبعه بعد الآن. +إذا قمت بتعديل الملف أو إضافته بالفعل إلى منطقة التجهيز (staging area)، فيجب عليك فرض الإزالة (force the removal) باستخدام الخيار `-f`. +هذه ميزة أمان (safety feature) لمنع الإزالة العرضية للبيانات التي لم يتم تسجيلها بعد في لقطة (snapshot) والتي لا يمكن استعادتها (recovered) من Git. -Another useful thing you may want to do is to keep the file in your working tree but remove it from your staging area. -In other words, you may want to keep the file on your hard drive but not have Git track it anymore. -This is particularly useful if you forgot to add something to your `.gitignore` file and accidentally staged it, like a large log file or a bunch of `.a` compiled files. -To do this, use the `--cached` option: +شيء مفيد آخر قد ترغب في القيام به هو الاحتفاظ بالملف في شجرة العمل الخاصة بك (working tree) ولكن إزالته من منطقة التجهيز الخاصة بك (staging area). +بعبارة أخرى، قد ترغب في الاحتفاظ بالملف على محرك الأقراص الثابتة الخاص بك ولكن لا تريد من Git تتبعه بعد الآن. +هذا مفيد بشكل خاص إذا نسيت إضافة شيء ما إلى ملف `.gitignore` الخاص بك وقمت بتجهيزه عن طريق الخطأ، مثل ملف سجل (log file) كبير أو مجموعة من الملفات المترجمة (compiled files) بصيغة `.a`. +للقيام بذلك، استخدم الخيار `--cached`: [source,console] ---- $ git rm --cached README ---- -You can pass files, directories, and file-glob patterns to the `git rm` command. -That means you can do things such as: +يمكنك تمرير الملفات والدلائل وأنماط مطابقة الملفات (file-glob patterns) إلى أمر `git rm`. +وهذا يعني أنه يمكنك القيام بأشياء مثل: [source,console] ---- $ git rm log/\*.log ---- -Note the backslash (`\`) in front of the `*`. -This is necessary because Git does its own filename expansion in addition to your shell's filename expansion. -This command removes all files that have the `.log` extension in the `log/` directory. -Or, you can do something like this: +لاحظ الشرطة المائلة للخلف (`\`) أمام `*`. +هذا ضروري لأن Git يقوم بتوسيع اسم الملف (filename expansion) الخاص به بالإضافة إلى توسيع اسم الملف الخاص بقشرتك (shell). +يزيل هذا الأمر جميع الملفات التي لها امتداد `.log` في دليل `log/`. +أو، يمكنك القيام بشيء من هذا القبيل: [source,console] ---- $ git rm \*~ ---- -This command removes all files whose names end with a `~`. +يزيل هذا الأمر جميع الملفات التي تنتهي أسماؤها بعلامة `~`. [[_git_mv]] -==== Moving Files +==== Moving Files (نقل الملفات) (((files, moving))) -Unlike many other VCSs, Git doesn't explicitly track file movement. -If you rename a file in Git, no metadata is stored in Git that tells it you renamed the file. -However, Git is pretty smart about figuring that out after the fact -- we'll deal with detecting file movement a bit later. +على عكس العديد من أنظمة VCS (أنظمة التحكم في الإصدارات) الأخرى، لا يتتبع Git حركة الملفات (file movement) صراحةً. +إذا قمت بإعادة تسمية (rename) ملف في Git، فلن يتم تخزين أي بيانات وصفية (metadata) في Git تخبره بأنك أعدت تسمية الملف. +ومع ذلك، فإن Git ذكي جداً في اكتشاف ذلك بعد حدوثه -- سنتعامل مع اكتشاف حركة الملفات لاحقاً. -Thus it's a bit confusing that Git has a `mv` command. -If you want to rename a file in Git, you can run something like: +وبالتالي فمن المربك بعض الشيء أن Git لديه أمر `mv`. +إذا كنت ترغب في إعادة تسمية ملف في Git، يمكنك تشغيل شيء مثل: [source,console] ---- $ git mv file_from file_to ---- -and it works fine. -In fact, if you run something like this and look at the status, you'll see that Git considers it a renamed file: +وهو يعمل بشكل جيد. +في الواقع، إذا قمت بتشغيل شيء من هذا القبيل وألقيت نظرة على الحالة، سترى أن Git يعتبره ملفاً أعيدت تسميته (renamed file): [source,console] ---- @@ -615,7 +615,7 @@ Changes to be committed: renamed: README.md -> README ---- -However, this is equivalent to running something like this: +ومع ذلك، هذا يعادل تشغيل شيء من هذا القبيل: [source,console] ---- @@ -624,6 +624,6 @@ $ git rm README.md $ git add README ---- -Git figures out that it's a rename implicitly, so it doesn't matter if you rename a file that way or with the `mv` command. -The only real difference is that `git mv` is one command instead of three -- it's a convenience function. -More importantly, you can use any tool you like to rename a file, and address the `add`/`rm` later, before you commit. +يكتشف Git أن هذا إعادة تسمية ضمنياً، لذلك لا يهم ما إذا كنت قد أعدت تسمية ملف بهذه الطريقة أو باستخدام أمر `mv`. +الفرق الحقيقي الوحيد هو أن `git mv` هو أمر واحد بدلاً من ثلاثة -- إنها وظيفة مريحة. +والأهم من ذلك، يمكنك استخدام أي أداة تريدها لإعادة تسمية ملف، ومعالجة `add`/`rm` لاحقاً، قبل التأكيد (commit). \ No newline at end of file diff --git a/book/02-git-basics/sections/remotes.asc b/book/02-git-basics/sections/remotes.asc index 80e98250a..688842952 100644 --- a/book/02-git-basics/sections/remotes.asc +++ b/book/02-git-basics/sections/remotes.asc @@ -1,26 +1,26 @@ [[_remote_repos]] -=== Working with Remotes +=== Working with Remotes (العمل مع المستودعات البعيدة) -To be able to collaborate on any Git project, you need to know how to manage your remote repositories. -Remote repositories are versions of your project that are hosted on the Internet or network somewhere. -You can have several of them, each of which generally is either read-only or read/write for you. -Collaborating with others involves managing these remote repositories and pushing and pulling data to and from them when you need to share work. -Managing remote repositories includes knowing how to add remote repositories, remove remotes that are no longer valid, manage various remote branches and define them as being tracked or not, and more. -In this section, we'll cover some of these remote-management skills. +لتتمكن من التعاون في أي مشروع Git، يجب أن تعرف كيف تدير مستودعاتك البعيدة (remote repositories). +المستودعات البعيدة هي نسخ من مشروعك مستضافة على الإنترنت أو على شبكة في مكان ما. +يمكن أن يكون لديك العديد منها، كل منها عموماً إما للقراءة فقط (read-only) أو للقراءة/الكتابة (read/write) بالنسبة لك. +التعاون مع الآخرين ينطوي على إدارة هذه المستودعات البعيدة ودفع (pushing) وسحب (pulling) البيانات منها وإليها عندما تحتاج إلى مشاركة العمل. +تتضمن إدارة المستودعات البعيدة معرفة كيفية إضافة مستودعات بعيدة، وإزالة المستودعات البعيدة التي لم تعد صالحة، وإدارة الفروع البعيدة (remote branches) المختلفة وتحديدها على أنها متتبعة (tracked) أم لا، والمزيد. +في هذا القسم، سنغطي بعض مهارات إدارة المستودعات البعيدة هذه. [NOTE] -.Remote repositories can be on your local machine. +.Remote repositories can be on your local machine. (يمكن أن تكون المستودعات البعيدة على جهازك المحلي.) ==== -It is entirely possible that you can be working with a "`remote`" repository that is, in fact, on the same host you are. -The word "`remote`" does not necessarily imply that the repository is somewhere else on the network or Internet, only that it is elsewhere. -Working with such a remote repository would still involve all the standard pushing, pulling and fetching operations as with any other remote. +من الممكن تماماً أن تعمل مع مستودع "`بعيد (remote)`" موجود، في الواقع، على نفس المضيف (host) الذي تعمل عليه. +كلمة "`بعيد (remote)`" لا تعني بالضرورة أن المستودع موجود في مكان آخر على الشبكة أو الإنترنت، بل تعني فقط أنه موجود في مكان آخر. +العمل مع مثل هذا المستودع البعيد سيظل ينطوي على جميع عمليات الدفع (pushing) والسحب (pulling) والجلب (fetching) القياسية كما هو الحال مع أي مستودع بعيد آخر. ==== -==== Showing Your Remotes +==== Showing Your Remotes (إظهار مستودعاتك البعيدة) -To see which remote servers you have configured, you can run the `git remote` command.(((git commands, remote))) -It lists the shortnames of each remote handle you've specified. -If you've cloned your repository, you should at least see `origin` -- that is the default name Git gives to the server you cloned from: +لمعرفة الخوادم البعيدة (remote servers) التي قمت بتكوينها، يمكنك تشغيل أمر `git remote`.(((git commands, remote))) +إنه يسرد الأسماء القصيرة (shortnames) لكل مقبض بعيد (remote handle) قمت بتحديده. +إذا قمت باستنساخ (cloned) مستودعك، يجب أن ترى على الأقل `origin` -- هذا هو الاسم الافتراضي الذي يعطيه Git للخادم الذي قمت بالاستنساخ منه: [source,console] ---- @@ -36,7 +36,7 @@ $ git remote origin ---- -You can also specify `-v`, which shows you the URLs that Git has stored for the shortname to be used when reading and writing to that remote: +يمكنك أيضاً تحديد `-v`، والذي يوضح لك عناوين URL التي قام Git بتخزينها للاسم القصير ليتم استخدامها عند القراءة والكتابة في ذلك المستودع البعيد: [source,console] ---- @@ -45,8 +45,8 @@ origin https://github.com/schacon/ticgit (fetch) origin https://github.com/schacon/ticgit (push) ---- -If you have more than one remote, the command lists them all. -For example, a repository with multiple remotes for working with several collaborators might look something like this. +إذا كان لديك أكثر من مستودع بعيد، يسردها الأمر جميعاً. +على سبيل المثال، قد يبدو المستودع الذي يحتوي على مستودعات بعيدة متعددة للعمل مع العديد من المتعاونين كالتالي. [source,console] ---- @@ -64,16 +64,16 @@ origin git@github.com:mojombo/grit.git (fetch) origin git@github.com:mojombo/grit.git (push) ---- -This means we can pull contributions from any of these users pretty easily. -We may additionally have permission to push to one or more of these, though we can't tell that here. +هذا يعني أنه يمكننا سحب المساهمات (pull contributions) من أي من هؤلاء المستخدمين بسهولة تامة. +قد يكون لدينا أيضاً إذن بالدفع (push) إلى واحد أو أكثر من هؤلاء، على الرغم من أننا لا نستطيع معرفة ذلك هنا. -Notice that these remotes use a variety of protocols; we'll cover more about this in <>. +لاحظ أن هذه المستودعات البعيدة تستخدم مجموعة متنوعة من البروتوكولات؛ سنغطي المزيد عن هذا في <>. -==== Adding Remote Repositories +==== Adding Remote Repositories (إضافة مستودعات بعيدة) -We've mentioned and given some demonstrations of how the `git clone` command implicitly adds the `origin` remote for you. -Here's how to add a new remote explicitly.(((git commands, remote))) -To add a new remote Git repository as a shortname you can reference easily, run `git remote add `: +لقد ذكرنا وقدمنا بعض العروض التوضيحية لكيفية قيام أمر `git clone` بإضافة المستودع البعيد `origin` لك ضمنياً (implicitly). +إليك كيفية إضافة مستودع بعيد جديد بشكل صريح (explicitly).(((git commands, remote))) +لإضافة مستودع Git بعيد جديد كاسم قصير يمكنك الرجوع إليه بسهولة، قم بتشغيل `git remote add `: [source,console] ---- @@ -87,8 +87,8 @@ pb https://github.com/paulboone/ticgit (fetch) pb https://github.com/paulboone/ticgit (push) ---- -Now you can use the string `pb` on the command line instead of the whole URL. -For example, if you want to fetch all the information that Paul has but that you don't yet have in your repository, you can run `git fetch pb`: +الآن يمكنك استخدام السلسلة `pb` في سطر الأوامر (command line) بدلاً من عنوان URL بأكمله. +على سبيل المثال، إذا كنت ترغب في جلب (fetch) جميع المعلومات التي يمتلكها Paul ولكن ليس لديك بعد في مستودعك، يمكنك تشغيل `git fetch pb`: [source,console] ---- @@ -102,65 +102,65 @@ From https://github.com/paulboone/ticgit * [new branch] ticgit -> pb/ticgit ---- -Paul's `master` branch is now accessible locally as `pb/master` -- you can merge it into one of your branches, or you can check out a local branch at that point if you want to inspect it. -We'll go over what branches are and how to use them in much more detail in <>. +أصبح فرع `master` الخاص بـ Paul متاحاً الآن محلياً كـ `pb/master` -- يمكنك دمجه (merge it) في أحد فروعك، أو يمكنك سحب (check out) فرع محلي في تلك النقطة إذا كنت ترغب في فحصه (inspect it). +سنستعرض ماهية الفروع (branches) وكيفية استخدامها بمزيد من التفصيل في <>. [[_fetching_and_pulling]] -==== Fetching and Pulling from Your Remotes +==== Fetching and Pulling from Your Remotes (الجلب والسحب من مستودعاتك البعيدة) -As you just saw, to get data from your remote projects, you can run:(((git commands, fetch))) +كما رأيت للتو، للحصول على بيانات من مشاريعك البعيدة، يمكنك تشغيل:(((git commands, fetch))) [source,console] ---- $ git fetch ---- -The command goes out to that remote project and pulls down all the data from that remote project that you don't have yet. -After you do this, you should have references to all the branches from that remote, which you can merge in or inspect at any time. +يذهب الأمر إلى ذلك المشروع البعيد ويسحب جميع البيانات من ذلك المشروع البعيد التي لم تكن لديك بعد. +بعد القيام بذلك، يجب أن يكون لديك مراجع (references) لجميع الفروع (branches) من ذلك المستودع البعيد، والتي يمكنك دمجها (merge) أو فحصها (inspect) في أي وقت. -If you clone a repository, the command automatically adds that remote repository under the name "`origin`". -So, `git fetch origin` fetches any new work that has been pushed to that server since you cloned (or last fetched from) it. -It's important to note that the `git fetch` command only downloads the data to your local repository -- it doesn't automatically merge it with any of your work or modify what you're currently working on. -You have to merge it manually into your work when you're ready. +إذا قمت باستنساخ (clone) مستودع، فإن الأمر يضيف هذا المستودع البعيد تلقائياً تحت اسم "`origin`". +لذا، يجلب `git fetch origin` أي عمل جديد تم دفعه (pushed) إلى ذلك الخادم منذ أن استنسخته (أو جلبته آخر مرة) منه. +من المهم ملاحظة أن أمر `git fetch` يقوم فقط بتنزيل (downloads) البيانات إلى مستودعك المحلي -- ولا يقوم بدمجها تلقائياً مع أي من أعمالك أو بتعديل ما تعمل عليه حالياً. +عليك دمجها (merge it) يدوياً في عملك عندما تكون جاهزاً. -If your current branch is set up to track a remote branch (see the next section and <> for more information), you can use the `git pull` command to automatically fetch and then merge that remote branch into your current branch.(((git commands, pull))) -This may be an easier or more comfortable workflow for you; and by default, the `git clone` command automatically sets up your local `master` branch to track the remote `master` branch (or whatever the default branch is called) on the server you cloned from. -Running `git pull` generally fetches data from the server you originally cloned from and automatically tries to merge it into the code you're currently working on. +إذا تم إعداد فرعك الحالي لتتبع (track) فرع بعيد (انظر القسم التالي و <> لمزيد من المعلومات)، فيمكنك استخدام أمر `git pull` لجلب (fetch) هذا الفرع البعيد ودمجه (merge) تلقائياً في فرعك الحالي.(((git commands, pull))) +قد يكون هذا سير عمل أسهل أو أكثر راحة بالنسبة لك؛ وبشكل افتراضي، يقوم أمر `git clone` تلقائياً بإعداد فرع `master` المحلي الخاص بك لتتبع فرع `master` البعيد (أو أياً كان اسم الفرع الافتراضي) على الخادم الذي قمت بالاستنساخ منه. +يؤدي تشغيل `git pull` بشكل عام إلى جلب البيانات من الخادم الذي استنسخت منه أصلاً ويحاول تلقائياً دمجها في الكود الذي تعمل عليه حالياً. [NOTE] ==== -From Git version 2.27 onward, `git pull` will give a warning if the `pull.rebase` variable is not set. -Git will keep warning you until you set the variable. +من إصدار Git 2.27 فصاعداً، سيعطي `git pull` تحذيراً إذا لم يتم تعيين المتغير `pull.rebase`. +سيستمر Git في تحذيرك حتى تقوم بتعيين المتغير. -If you want the default behavior of Git (fast-forward if possible, else create a merge commit): +إذا كنت تريد السلوك الافتراضي لـ Git (تقديم سريع - fast-forward إذا أمكن، وإلا إنشاء عملية تأكيد دمج - merge commit): `git config --global pull.rebase "false"` -If you want to rebase when pulling: +إذا كنت تريد إعادة التأسيس (rebase) عند السحب: `git config --global pull.rebase "true"` ==== [[_pushing_remotes]] -==== Pushing to Your Remotes +==== Pushing to Your Remotes (الدفع إلى مستودعاتك البعيدة) -When you have your project at a point that you want to share, you have to push it upstream. -The command for this is simple: `git push `.(((git commands, push))) -If you want to push your `master` branch to your `origin` server (again, cloning generally sets up both of those names for you automatically), then you can run this to push any commits you've done back up to the server: +عندما يكون مشروعك في مرحلة تريد مشاركته فيها، يجب عليك دفعه (push it) إلى المنبع (upstream). +الأمر الخاص بذلك بسيط: `git push `.(((git commands, push))) +إذا كنت ترغب في دفع فرع `master` الخاص بك إلى خادم `origin` الخاص بك (مرة أخرى، يقوم الاستنساخ عموماً بإعداد كلا هذين الاسمين لك تلقائياً)، فيمكنك تشغيل هذا لدفع أي عمليات تأكيد (commits) قمت بها مرة أخرى إلى الخادم: [source,console] ---- $ git push origin master ---- -This command works only if you cloned from a server to which you have write access and if nobody has pushed in the meantime. -If you and someone else clone at the same time and they push upstream and then you push upstream, your push will rightly be rejected. -You'll have to fetch their work first and incorporate it into yours before you'll be allowed to push. -See <> for more detailed information on how to push to remote servers. +لا يعمل هذا الأمر إلا إذا استنسخت من خادم لديك وصول للكتابة إليه (write access) وإذا لم يقم أحد بالدفع في هذه الأثناء. +إذا قمت أنت وشخص آخر بالاستنساخ في نفس الوقت ودفع هو إلى المنبع (upstream) ثم حاولت أنت الدفع إلى المنبع، فسيتم رفض دفعك بحق. +سيتعين عليك جلب (fetch) عمله أولاً ودمجه (incorporate it) في عملك قبل أن يُسمح لك بالدفع. +راجع <> للحصول على معلومات أكثر تفصيلاً حول كيفية الدفع (push) إلى الخوادم البعيدة. [[_inspecting_remote]] -==== Inspecting a Remote +==== Inspecting a Remote (فحص مستودع بعيد) -If you want to see more information about a particular remote, you can use the `git remote show ` command.(((git commands, remote))) -If you run this command with a particular shortname, such as `origin`, you get something like this: +إذا كنت ترغب في رؤية المزيد من المعلومات حول مستودع بعيد معين، يمكنك استخدام أمر `git remote show `.(((git commands, remote))) +إذا قمت بتشغيل هذا الأمر باسم قصير معين، مثل `origin`، ستحصل على شيء كالتالي: [source,console] ---- @@ -178,12 +178,12 @@ $ git remote show origin master pushes to master (up to date) ---- -It lists the URL for the remote repository as well as the tracking branch information. -The command helpfully tells you that if you're on the `master` branch and you run `git pull`, it will automatically merge the remote's `master` branch into the local one after it has been fetched. -It also lists all the remote references it has pulled down. +يسرد عنوان URL للمستودع البعيد بالإضافة إلى معلومات فرع التتبع (tracking branch). +يخبرك الأمر بشكل مفيد أنك إذا كنت في فرع `master` وقمت بتشغيل `git pull`، فإنه سيقوم تلقائياً بدمج فرع `master` البعيد في الفرع المحلي بعد جلبه. +كما يسرد جميع المراجع البعيدة (remote references) التي قام بسحبها. -That is a simple example you're likely to encounter. -When you're using Git more heavily, however, you may see much more information from `git remote show`: +هذا مثال بسيط من المحتمل أن تواجهه. +عندما تستخدم Git بكثافة أكبر، قد ترى المزيد من المعلومات من `git remote show`: [source,console] ---- @@ -209,13 +209,13 @@ $ git remote show origin master pushes to master (up to date) ---- -This command shows which branch is automatically pushed to when you run `git push` while on certain branches. -It also shows you which remote branches on the server you don't yet have, which remote branches you have that have been removed from the server, and multiple local branches that are able to merge automatically with their remote-tracking branch when you run `git pull`. +يوضح هذا الأمر الفرع الذي يتم دفعه تلقائياً عند تشغيل `git push` أثناء تواجدك في فروع معينة. +كما يوضح لك الفروع البعيدة الموجودة على الخادم والتي لا تملكها بعد، والفروع البعيدة التي لديك والتي تمت إزالتها من الخادم، والفروع المحلية المتعددة التي يمكن دمجها تلقائياً مع فرع التتبع البعيد (remote-tracking branch) الخاص بها عند تشغيل `git pull`. -==== Renaming and Removing Remotes +==== Renaming and Removing Remotes (إعادة تسمية وإزالة المستودعات البعيدة) -You can run `git remote rename` to change a remote's shortname.(((git commands, remote))) -For instance, if you want to rename `pb` to `paul`, you can do so with `git remote rename`: +يمكنك تشغيل `git remote rename` لتغيير الاسم القصير للمستودع البعيد.(((git commands, remote))) +على سبيل المثال، إذا كنت تريد إعادة تسمية `pb` إلى `paul`، فيمكنك القيام بذلك باستخدام `git remote rename`: [source,console] ---- @@ -225,10 +225,10 @@ origin paul ---- -It's worth mentioning that this changes all your remote-tracking branch names, too. -What used to be referenced at `pb/master` is now at `paul/master`. +تجدر الإشارة إلى أن هذا يغير جميع أسماء فروع التتبع البعيدة (remote-tracking branch names) الخاصة بك أيضاً. +ما كان يُشار إليه بـ `pb/master` أصبح الآن في `paul/master`. -If you want to remove a remote for some reason -- you've moved the server or are no longer using a particular mirror, or perhaps a contributor isn't contributing anymore -- you can either use `git remote remove` or `git remote rm`: +إذا كنت ترغب في إزالة مستودع بعيد لسبب ما -- لأنك قمت بنقل الخادم أو لم تعد تستخدم مرآة (mirror) معينة، أو ربما لم يعد أحد المساهمين يساهم بعد الآن -- يمكنك إما استخدام `git remote remove` أو `git remote rm`: [source,console] ---- @@ -237,4 +237,4 @@ $ git remote origin ---- -Once you delete the reference to a remote this way, all remote-tracking branches and configuration settings associated with that remote are also deleted. +بمجرد حذف مرجع إلى مستودع بعيد بهذه الطريقة، يتم أيضاً حذف جميع فروع التتبع البعيدة (remote-tracking branches) وإعدادات التكوين (configuration settings) المرتبطة بذلك المستودع البعيد. \ No newline at end of file diff --git a/book/02-git-basics/sections/tagging.asc b/book/02-git-basics/sections/tagging.asc index 34604c573..9390a49fe 100644 --- a/book/02-git-basics/sections/tagging.asc +++ b/book/02-git-basics/sections/tagging.asc @@ -1,15 +1,15 @@ [[_git_tagging]] -=== Tagging +=== Tagging (وضع العلامات) (((tags))) -Like most VCSs, Git has the ability to tag specific points in a repository's history as being important. -Typically, people use this functionality to mark release points (`v1.0`, `v2.0` and so on). -In this section, you'll learn how to list existing tags, how to create and delete tags, and what the different types of tags are. +مثل معظم أنظمة VCS (أنظمة التحكم في الإصدارات)، يمتلك Git القدرة على وضع علامة (tag) على نقاط معينة في سجل المستودع (repository's history) باعتبارها مهمة. +عادةً، يستخدم الأشخاص هذه الوظيفة لتمييز نقاط الإصدار (release points) (`v1.0`، `v2.0` وهكذا). +في هذا القسم، ستتعلم كيفية سرد العلامات (tags) الموجودة، وكيفية إنشاء العلامات وحذفها، وما هي الأنواع المختلفة من العلامات. -==== Listing Your Tags +==== Listing Your Tags (سرد علاماتك) -Listing the existing tags in Git is straightforward. -Just type `git tag` (with optional `-l` or `--list`):(((git commands, tag))) +إن سرد العلامات الموجودة في Git أمر بسيط. +فقط اكتب `git tag` (مع اختياري `-l` أو `--list`):(((git commands, tag))) [source,console] ---- @@ -18,11 +18,11 @@ v1.0 v2.0 ---- -This command lists the tags in alphabetical order; the order in which they are displayed has no real importance. +يسرد هذا الأمر العلامات بترتيب أبجدي (alphabetical order)؛ الترتيب الذي يتم عرضها به ليس له أهمية حقيقية. -You can also search for tags that match a particular pattern. -The Git source repo, for instance, contains more than 500 tags. -If you're interested only in looking at the 1.8.5 series, you can run this: +يمكنك أيضاً البحث عن العلامات التي تتطابق مع نمط (pattern) معين. +مستودع مصدر Git (Git source repo)، على سبيل المثال، يحتوي على أكثر من 500 علامة (tag). +إذا كنت مهتماً فقط بالنظر إلى سلسلة 1.8.5، يمكنك تشغيل هذا: [source,console] ---- @@ -40,29 +40,29 @@ v1.8.5.5 ---- [NOTE] -.Listing tag wildcards requires `-l` or `--list` option +.Listing tag wildcards requires `-l` or `--list` option (يتطلب سرد أحرف البدل للعلامات خيار `-l` أو `--list`) ==== -If you want just the entire list of tags, running the command `git tag` implicitly assumes you want a listing and provides one; the use of `-l` or `--list` in this case is optional. +إذا كنت تريد فقط القائمة الكاملة للعلامات، فإن تشغيل الأمر `git tag` يفترض ضمناً أنك تريد قائمة ويوفر واحدة؛ يعد استخدام `-l` أو `--list` في هذه الحالة أمراً اختيارياً. -If, however, you're supplying a wildcard pattern to match tag names, the use of `-l` or `--list` is mandatory. +ومع ذلك، إذا كنت تقدم نمط حرف بدل (wildcard pattern) لمطابقة أسماء العلامات، فإن استخدام `-l` أو `--list` إلزامي. ==== -==== Creating Tags +==== Creating Tags (إنشاء العلامات) -Git supports two types of tags: _lightweight_ and _annotated_. +يدعم Git نوعين من العلامات: _خفيفة الوزن (lightweight)_ و _توضيحية (annotated)_. -A lightweight tag is very much like a branch that doesn't change -- it's just a pointer to a specific commit. +العلامة خفيفة الوزن تشبه إلى حد كبير فرعاً (branch) لا يتغير -- إنها مجرد مؤشر (pointer) لعملية تأكيد (commit) معينة. -Annotated tags, however, are stored as full objects in the Git database. -They're checksummed; contain the tagger name, email, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG). -It's generally recommended that you create annotated tags so you can have all this information; but if you want a temporary tag or for some reason don't want to keep the other information, lightweight tags are available too. +ومع ذلك، يتم تخزين العلامات التوضيحية (Annotated tags) ككائنات كاملة (full objects) في قاعدة بيانات Git. +يتم اختبار مجموعها (checksummed)؛ وتحتوي على اسم واضع العلامة (tagger name)، وبريده الإلكتروني، والتاريخ؛ ولديها رسالة وضع علامة (tagging message)؛ ويمكن توقيعها (signed) والتحقق منها باستخدام GNU Privacy Guard (GPG). +يوصى عموماً بإنشاء علامات توضيحية (annotated tags) حتى تتمكن من الحصول على كل هذه المعلومات؛ ولكن إذا كنت تريد علامة مؤقتة أو لسبب ما لا تريد الاحتفاظ بالمعلومات الأخرى، فإن العلامات خفيفة الوزن (lightweight tags) متاحة أيضاً. [[_annotated_tags]] -==== Annotated Tags +==== Annotated Tags (العلامات التوضيحية) (((tags, annotated))) -Creating an annotated tag in Git is simple. -The easiest way is to specify `-a` when you run the `tag` command:(((git commands, tag))) +يعد إنشاء علامة توضيحية (annotated tag) في Git أمراً بسيطاً. +أسهل طريقة هي تحديد `-a` عند تشغيل أمر `tag`:(((git commands, tag))) [source,console] ---- @@ -73,10 +73,10 @@ v1.3 v1.4 ---- -The `-m` specifies a tagging message, which is stored with the tag. -If you don't specify a message for an annotated tag, Git launches your editor so you can type it in. +يحدد `-m` رسالة وضع علامة (tagging message)، والتي يتم تخزينها مع العلامة. +إذا لم تحدد رسالة لعلامة توضيحية، فسيقوم Git بتشغيل المحرر الخاص بك حتى تتمكن من كتابتها. -You can see the tag data along with the commit that was tagged by using the `git show` command: +يمكنك رؤية بيانات العلامة (tag data) جنباً إلى جنب مع عملية التأكيد (commit) التي تم وضع علامة عليها باستخدام أمر `git show`: [source,console] ---- @@ -94,14 +94,14 @@ Date: Mon Mar 17 21:52:11 2008 -0700 Change version number ---- -That shows the tagger information, the date the commit was tagged, and the annotation message before showing the commit information. +يوضح ذلك معلومات واضع العلامة (tagger information)، والتاريخ الذي تم فيه وضع علامة على عملية التأكيد، والرسالة التوضيحية (annotation message) قبل إظهار معلومات عملية التأكيد (commit information). -==== Lightweight Tags +==== Lightweight Tags (العلامات خفيفة الوزن) (((tags, lightweight))) -Another way to tag commits is with a lightweight tag. -This is basically the commit checksum stored in a file -- no other information is kept. -To create a lightweight tag, don't supply any of the `-a`, `-s`, or `-m` options, just provide a tag name: +طريقة أخرى لوضع علامة (tag) على عمليات التأكيد (commits) هي باستخدام علامة خفيفة الوزن (lightweight tag). +هذه هي في الأساس تجزئة عملية التأكيد (commit checksum) مخزنة في ملف -- لا يتم الاحتفاظ بأي معلومات أخرى. +لإنشاء علامة خفيفة الوزن (lightweight tag)، لا توفر أياً من الخيارات `-a` أو `-s` أو `-m`، فقط قدم اسم علامة (tag name): [source,console] ---- @@ -114,8 +114,8 @@ v1.4-lw v1.5 ---- -This time, if you run `git show` on the tag, you don't see the extra tag information.(((git commands, show))) -The command just shows the commit: +هذه المرة، إذا قمت بتشغيل `git show` على العلامة، فلن ترى معلومات العلامة الإضافية.(((git commands, show))) +يُظهر الأمر ببساطة عملية التأكيد (commit) فقط: [source,console] ---- @@ -127,10 +127,10 @@ Date: Mon Mar 17 21:52:11 2008 -0700 Change version number ---- -==== Tagging Later +==== Tagging Later (وضع العلامات لاحقاً) -You can also tag commits after you've moved past them. -Suppose your commit history looks like this: +يمكنك أيضاً وضع علامة (tag) على عمليات التأكيد (commits) بعد أن تتجاوزها. +لنفترض أن سجل التأكيد (commit history) الخاص بك يبدو كالتالي: [source,console] ---- @@ -147,16 +147,16 @@ a6b4c97498bd301d84096da251c98a07c7723e65 Create write support 8a5cbc430f1a9c3d00faaeffd07798508422908a Update readme ---- -Now, suppose you forgot to tag the project at v1.2, which was at the "`Update rakefile`" commit. -You can add it after the fact. -To tag that commit, you specify the commit checksum (or part of it) at the end of the command: +الآن، لنفترض أنك نسيت وضع علامة (tag) على المشروع عند `v1.2`، والتي كانت عند عملية التأكيد "`Update rakefile`". +يمكنك إضافتها بعد الحدث (after the fact). +لوضع علامة على عملية التأكيد (commit) تلك، يمكنك تحديد تجزئة التأكيد (commit checksum) (أو جزء منها) في نهاية الأمر: [source,console] ---- $ git tag -a v1.2 9fceb02 ---- -You can see that you've tagged the commit:(((git commands, tag))) +يمكنك أن ترى أنك قمت بوضع علامة (tagged) على عملية التأكيد:(((git commands, tag))) [source,console] ---- @@ -183,11 +183,11 @@ Date: Sun Apr 27 20:43:35 2008 -0700 ---- [[_sharing_tags]] -==== Sharing Tags +==== Sharing Tags (مشاركة العلامات) -By default, the `git push` command doesn't transfer tags to remote servers.(((git commands, push))) -You will have to explicitly push tags to a shared server after you have created them. -This process is just like sharing remote branches -- you can run `git push origin `. +افتراضياً، لا ينقل الأمر `git push` العلامات (tags) إلى الخوادم البعيدة (remote servers).(((git commands, push))) +سيتعين عليك دفع العلامات (push tags) صراحةً إلى خادم مشترك (shared server) بعد إنشائها. +هذه العملية تشبه تماماً مشاركة الفروع البعيدة (remote branches) -- يمكنك تشغيل `git push origin `. [source,console] ---- @@ -201,8 +201,8 @@ To git@github.com:schacon/simplegit.git * [new tag] v1.5 -> v1.5 ---- -If you have a lot of tags that you want to push up at once, you can also use the `--tags` option to the `git push` command. -This will transfer all of your tags to the remote server that are not already there. +إذا كان لديك الكثير من العلامات (tags) التي تريد دفعها (push up) دفعة واحدة، يمكنك أيضاً استخدام الخيار `--tags` مع أمر `git push`. +سيؤدي هذا إلى نقل جميع علاماتك غير الموجودة بالفعل إلى الخادم البعيد (remote server). [source,console] ---- @@ -215,19 +215,19 @@ To git@github.com:schacon/simplegit.git * [new tag] v1.4-lw -> v1.4-lw ---- -Now, when someone else clones or pulls from your repository, they will get all your tags as well. +الآن، عندما يقوم شخص آخر بالاستنساخ (clones) أو السحب (pulls) من مستودعك، سيحصل على جميع علاماتك (tags) أيضاً. [NOTE] -.`git push` pushes both types of tags +.`git push` pushes both types of tags (`git push` يدفع كلا نوعي العلامات) ==== -`git push --tags` will push both lightweight and annotated tags. -There is currently no option to push only lightweight tags, but if you use `git push --follow-tags` only annotated tags will be pushed to the remote. +سيقوم `git push --tags` بدفع كل من العلامات خفيفة الوزن (lightweight) والتوضيحية (annotated tags). +لا يوجد حالياً خيار لدفع العلامات خفيفة الوزن (lightweight tags) فقط، ولكن إذا استخدمت `git push --follow-tags` فسيتم دفع العلامات التوضيحية (annotated tags) فقط إلى المستودع البعيد (remote). ==== -==== Deleting Tags +==== Deleting Tags (حذف العلامات) -To delete a tag on your local repository, you can use `git tag -d `. -For example, we could remove our lightweight tag above as follows: +لحذف علامة (tag) في مستودعك المحلي (local repository)، يمكنك استخدام `git tag -d `. +على سبيل المثال، يمكننا إزالة العلامة خفيفة الوزن (lightweight tag) أعلاه كما يلي: [source,console] ---- @@ -235,10 +235,10 @@ $ git tag -d v1.4-lw Deleted tag 'v1.4-lw' (was e7d5add) ---- -Note that this does not remove the tag from any remote servers. -There are two common variations for deleting a tag from a remote server. +لاحظ أن هذا لا يزيل العلامة من أي خوادم بعيدة (remote servers). +هناك طريقتان شائعتان لحذف علامة من خادم بعيد. -The first variation is `git push :refs/tags/`: +التباين الأول هو `git push :refs/tags/`: [source,console] ---- @@ -247,18 +247,18 @@ To /git@github.com:schacon/simplegit.git - [deleted] v1.4-lw ---- -The way to interpret the above is to read it as the null value before the colon is being pushed to the remote tag name, effectively deleting it. +طريقة تفسير ما سبق هي قراءته على أن القيمة الفارغة (null value) قبل النقطتين (colon) يتم دفعها إلى اسم العلامة البعيدة (remote tag name)، مما يؤدي إلى حذفها فعلياً. -The second (and more intuitive) way to delete a remote tag is with: +الطريقة الثانية (والأكثر بديهية) لحذف علامة بعيدة (remote tag) هي باستخدام: [source,console] ---- $ git push origin --delete ---- -==== Checking out Tags +==== Checking out Tags (سحب العلامات) -If you want to view the versions of files a tag is pointing to, you can do a `git checkout` of that tag, although this puts your repository in "`detached HEAD`" state, which has some ill side effects: +إذا كنت ترغب في عرض إصدارات الملفات (versions of files) التي تشير إليها علامة (tag)، يمكنك إجراء `git checkout` لتلك العلامة، على الرغم من أن هذا يضع مستودعك (repository) في حالة "`detached HEAD`" (رأس منفصل)، والتي لها بعض الآثار الجانبية السيئة (ill side effects): [source,console] ---- @@ -287,8 +287,8 @@ Previous HEAD position was 99ada87... Merge pull request #89 from schacon/append HEAD is now at df3f601... Add atlas.json and cover image ---- -In "`detached HEAD`" state, if you make changes and then create a commit, the tag will stay the same, but your new commit won't belong to any branch and will be unreachable, except by the exact commit hash. -Thus, if you need to make changes -- say you're fixing a bug on an older version, for instance -- you will generally want to create a branch: +في حالة "`detached HEAD`" (رأس منفصل)، إذا قمت بإجراء تغييرات ثم أنشأت عملية تأكيد (commit)، فستبقى العلامة (tag) كما هي، لكن عملية التأكيد (commit) الجديدة الخاصة بك لن تنتمي إلى أي فرع (branch) ولن يمكن الوصول إليها (unreachable)، إلا بواسطة تجزئة التأكيد الدقيقة (exact commit hash). +وبالتالي، إذا احتجت إلى إجراء تغييرات -- لنقل أنك تصلح خطأً (bug) في إصدار أقدم (older version)، على سبيل المثال -- فستحتاج بشكل عام إلى إنشاء فرع (create a branch): [source,console] ---- @@ -296,4 +296,4 @@ $ git checkout -b version2 v2.0.0 Switched to a new branch 'version2' ---- -If you do this and make a commit, your `version2` branch will be slightly different than your `v2.0.0` tag since it will move forward with your new changes, so do be careful. +إذا قمت بذلك وأنشأت عملية تأكيد (commit)، فإن فرع `version2` الخاص بك سيكون مختلفاً قليلاً عن علامة `v2.0.0` الخاصة بك لأنه سيمضي قدماً (move forward) مع تغييراتك الجديدة، لذا كن حذراً. \ No newline at end of file diff --git a/book/02-git-basics/sections/undoing.asc b/book/02-git-basics/sections/undoing.asc index 0c815dde8..f44a489c2 100644 --- a/book/02-git-basics/sections/undoing.asc +++ b/book/02-git-basics/sections/undoing.asc @@ -1,26 +1,26 @@ [[_undoing]] -=== Undoing Things +=== Undoing Things (التراجع عن الأشياء) -At any stage, you may want to undo something. -Here, we'll review a few basic tools for undoing changes that you've made. -Be careful, because you can't always undo some of these undos. -This is one of the few areas in Git where you may lose some work if you do it wrong. +في أي مرحلة، قد ترغب في التراجع (undo) عن شيء ما. +هنا، سنراجع بعض الأدوات الأساسية للتراجع عن التغييرات التي أجريتها. +كن حذراً، لأنه لا يمكنك دائماً التراجع عن بعض عمليات التراجع هذه. +هذه واحدة من المجالات القليلة في Git حيث قد تفقد بعض العمل إذا قمت به بشكل خاطئ. -One of the common undos takes place when you commit too early and possibly forget to add some files, or you mess up your commit message. -If you want to redo that commit, make the additional changes you forgot, stage them, and commit again using the `--amend` option: +يحدث أحد عمليات التراجع (undos) الشائعة عندما تقوم بالتأكيد (commit) مبكراً جداً وربما تنسى إضافة بعض الملفات، أو تفسد رسالة التأكيد (commit message) الخاصة بك. +إذا كنت ترغب في إعادة إجراء (redo) عملية التأكيد تلك، فقم بإجراء التغييرات الإضافية التي نسيتها، وقم بتجهيزها (stage them)، ثم قم بالتأكيد مرة أخرى باستخدام الخيار `--amend`: [source,console] ---- $ git commit --amend ---- -This command takes your staging area and uses it for the commit. -If you've made no changes since your last commit (for instance, you run this command immediately after your previous commit), then your snapshot will look exactly the same, and all you'll change is your commit message. +يأخذ هذا الأمر منطقة التجهيز (staging area) الخاصة بك ويستخدمها لعملية التأكيد (commit). +إذا لم تقم بإجراء أي تغييرات منذ آخر عملية تأكيد (على سبيل المثال، قمت بتشغيل هذا الأمر فوراً بعد عملية التأكيد السابقة)، فستبدو لقطتك (snapshot) كما هي تماماً، وكل ما ستغيره هو رسالة التأكيد (commit message) الخاصة بك. -The same commit-message editor fires up, but it already contains the message of your previous commit. -You can edit the message the same as always, but it overwrites your previous commit. +يتم تشغيل نفس محرر رسالة التأكيد (commit-message editor)، ولكنه يحتوي بالفعل على رسالة عملية التأكيد السابقة. +يمكنك تحرير الرسالة كالمعتاد، ولكنها تستبدل (overwrites) عملية التأكيد السابقة. -As an example, if you commit and then realize you forgot to stage the changes in a file you wanted to add to this commit, you can do something like this: +كمثال، إذا قمت بالتأكيد ثم أدركت أنك نسيت تجهيز التغييرات (stage the changes) في ملف أردت إضافته إلى عملية التأكيد هذه، يمكنك القيام بشيء من هذا القبيل: [source,console] ---- @@ -29,31 +29,31 @@ $ git add forgotten_file $ git commit --amend ---- -You end up with a single commit -- the second commit replaces the results of the first. +ينتهي بك الأمر بعملية تأكيد واحدة (single commit) -- حيث تحل عملية التأكيد الثانية محل نتائج الأولى. [NOTE] ==== -It's important to understand that when you're amending your last commit, you're not so much fixing it as _replacing_ it entirely with a new, improved commit that pushes the old commit out of the way and puts the new commit in its place. -Effectively, it's as if the previous commit never happened, and it won't show up in your repository history. +من المهم أن تفهم أنه عندما تقوم بتعديل (amending) آخر عملية تأكيد لك، فإنك لا تقوم بإصلاحها بقدر ما تقوم _باستبدالها (replacing)_ بالكامل بعملية تأكيد جديدة ومحسنة تدفع عملية التأكيد القديمة بعيداً وتضع عملية التأكيد الجديدة في مكانها. +فعلياً، يبدو الأمر كما لو أن عملية التأكيد السابقة لم تحدث أبداً، ولن تظهر في سجل المستودع (repository history) الخاص بك. -The obvious value to amending commits is to make minor improvements to your last commit, without cluttering your repository history with commit messages of the form, "`Oops, forgot to add a file`" or "`Darn, fixing a typo in last commit`". +القيمة الواضحة لتعديل عمليات التأكيد (amending commits) هي إجراء تحسينات طفيفة على آخر عملية تأكيد لك، دون إحداث فوضى في سجل المستودع برسائل تأكيد من قبيل، "`عفواً، نسيت إضافة ملف`" أو "`اللعنة، أصلح خطأ مطبعي في التأكيد الأخير`". ==== [NOTE] ==== -Only amend commits that are still local and have not been pushed somewhere. -Amending previously pushed commits and force pushing the branch will cause problems for your collaborators. -For more on what happens when you do this and how to recover if you're on the receiving end read <<_rebase_peril>>. +قم فقط بتعديل (amend) عمليات التأكيد (commits) التي لا تزال محلية (local) ولم يتم دفعها (pushed) إلى مكان ما. +سيؤدي تعديل عمليات التأكيد المدفوعة مسبقاً (previously pushed commits) ودفع الفرع بالقوة (force pushing) إلى حدوث مشاكل للمتعاونين (collaborators) معك. +لمزيد من المعلومات حول ما يحدث عندما تفعل ذلك وكيفية التعافي (recover) إذا كنت في الطرف المتلقي، اقرأ <<_rebase_peril>>. ==== [[_unstaging]] -==== Unstaging a Staged File +==== Unstaging a Staged File (إلغاء تجهيز ملف مجهز) -The next two sections demonstrate how to work with your staging area and working directory changes. -The nice part is that the command you use to determine the state of those two areas also reminds you how to undo changes to them. -For example, let's say you've changed two files and want to commit them as two separate changes, but you accidentally type `git add *` and stage them both. -How can you unstage one of the two? -The `git status` command reminds you: +يوضح القسمان التاليان كيفية العمل مع تغييرات منطقة التجهيز (staging area) ودليل العمل (working directory) الخاصة بك. +الجزء الجميل هو أن الأمر الذي تستخدمه لتحديد حالة هاتين المنطقتين يذكرك أيضاً بكيفية التراجع (undo) عن التغييرات التي طرأت عليهما. +على سبيل المثال، لنفترض أنك قمت بتغيير ملفين وتريد تأكيدهما (commit them) كتغييرين منفصلين، لكنك كتبت بالخطأ `git add *` وقمت بتجهيزهما (stage) معاً. +كيف يمكنك إلغاء تجهيز (unstage) أحدهما؟ +يذكرك أمر `git status`: [source,console] ---- @@ -67,8 +67,8 @@ Changes to be committed: modified: CONTRIBUTING.md ---- -Right below the "`Changes to be committed`" text, it says use `git reset HEAD ...` to unstage. -So, let's use that advice to unstage the `CONTRIBUTING.md` file: +مباشرة أسفل نص "`Changes to be committed`" (تغييرات سيتم تأكيدها)، يخبرك باستخدام `git reset HEAD ...` لإلغاء التجهيز (unstage). +لذا، دعنا نستخدم تلك النصيحة لإلغاء تجهيز ملف `CONTRIBUTING.md`: [source,console] ---- @@ -89,24 +89,24 @@ Changes not staged for commit: modified: CONTRIBUTING.md ---- -The command is a bit strange, but it works. -The `CONTRIBUTING.md` file is modified but once again unstaged. +الأمر غريب بعض الشيء، لكنه يعمل. +تم تعديل ملف `CONTRIBUTING.md` ولكنه أصبح غير مجهز (unstaged) مرة أخرى. [NOTE] ===== -It's true that `git reset` can be a dangerous command, especially if you provide the `--hard` flag. -However, in the scenario described above, the file in your working directory is not touched, so it's relatively safe. +صحيح أن `git reset` يمكن أن يكون أمراً خطيراً (dangerous command)، خاصة إذا قمت بتوفير العلامة `--hard`. +ومع ذلك، في السيناريو الموضح أعلاه، لم يتم لمس الملف الموجود في دليل العمل الخاص بك، لذلك فهو آمن نسبياً. ===== -For now this magic invocation is all you need to know about the `git reset` command. -We'll go into much more detail about what `reset` does and how to master it to do really interesting things in <>. +في الوقت الحالي، هذا الاستدعاء السحري (magic invocation) هو كل ما تحتاج لمعرفته حول أمر `git reset`. +سنتعمق في تفاصيل أكثر حول ما يفعله `reset` وكيفية إتقانه للقيام بأشياء مثيرة للاهتمام حقاً في <>. -==== Unmodifying a Modified File +==== Unmodifying a Modified File (إلغاء تعديل ملف معدل) -What if you realize that you don't want to keep your changes to the `CONTRIBUTING.md` file? -How can you easily unmodify it -- revert it back to what it looked like when you last committed (or initially cloned, or however you got it into your working directory)? -Luckily, `git status` tells you how to do that, too. -In the last example output, the unstaged area looks like this: +ماذا لو أدركت أنك لا تريد الاحتفاظ بتغييراتك على ملف `CONTRIBUTING.md`؟ +كيف يمكنك بسهولة إلغاء تعديله (unmodify it) -- إعادته (revert it) إلى ما كان يبدو عليه عندما قمت بالتأكيد آخر مرة (أو الاستنساخ الأولي، أو كيفما حصلت عليه في دليل العمل الخاص بك)؟ +لحسن الحظ، يخبرك `git status` بكيفية القيام بذلك أيضاً. +في مخرجات المثال الأخير، تبدو المنطقة غير المجهزة (unstaged area) كالتالي: [source,console] ---- @@ -117,8 +117,8 @@ Changes not staged for commit: modified: CONTRIBUTING.md ---- -It tells you pretty explicitly how to discard the changes you've made. -Let's do what it says: +إنه يخبرك صراحة بكيفية تجاهل (discard) التغييرات التي أجريتها. +دعنا نفعل ما يقوله: [source,console] ---- @@ -132,37 +132,37 @@ Changes to be committed: ---- -You can see that the changes have been reverted. +يمكنك أن ترى أنه تم التراجع عن التغييرات (reverted). [IMPORTANT] ===== -It's important to understand that `git checkout \-- ` is a dangerous command. -Any local changes you made to that file are gone -- Git just replaced that file with the last staged or committed version. -Don't ever use this command unless you absolutely know that you don't want those unsaved local changes. +من المهم أن نفهم أن `git checkout \-- ` هو أمر خطير (dangerous command). +لقد ولت أي تغييرات محلية (local changes) أجريتها على ذلك الملف -- قام Git للتو باستبدال ذلك الملف بآخر إصدار مجهز أو مؤكد (last staged or committed version). +لا تستخدم هذا الأمر أبداً ما لم تكن متأكداً تماماً من أنك لا تريد تلك التغييرات المحلية غير المحفوظة. ===== -If you would like to keep the changes you've made to that file but still need to get it out of the way for now, we'll go over stashing and branching in <>; these are generally better ways to go. +إذا كنت ترغب في الاحتفاظ بالتغييرات التي أجريتها على ذلك الملف ولكن لا تزال بحاجة إلى إبعاده عن الطريق في الوقت الحالي، فسنستعرض التخزين (stashing) والتفرع (branching) في <>؛ هذه طرق أفضل بشكل عام. -Remember, anything that is _committed_ in Git can almost always be recovered. -Even commits that were on branches that were deleted or commits that were overwritten with an `--amend` commit can be recovered (see <> for data recovery). -However, anything you lose that was never committed is likely never to be seen again. +تذكر أن أي شيء يتم _تأكيده (committed)_ في Git يمكن استرداده (recovered) بشكل دائم تقريباً. +حتى عمليات التأكيد التي كانت على فروع (branches) تم حذفها أو عمليات التأكيد التي تم استبدالها (overwritten) بعملية تأكيد `--amend` يمكن استردادها (راجع <> لاستعادة البيانات). +ومع ذلك، فإن أي شيء تفقده ولم يتم تأكيده أبداً (never committed) فمن المحتمل ألا تراه مرة أخرى أبداً. [[undoing_git_restore]] -==== Undoing things with git restore +==== Undoing things with git restore (التراجع عن الأشياء باستخدام git restore) -Git version 2.23.0 introduced a new command: `git restore`. -It's basically an alternative to `git reset` which we just covered. -From Git version 2.23.0 onwards, Git will use `git restore` instead of `git reset` for many undo operations. +قدم إصدار Git 2.23.0 أمراً جديداً: `git restore` (استعادة). +إنه في الأساس بديل لـ `git reset` الذي قمنا بتغطيته للتو. +بدءاً من إصدار Git 2.23.0 فصاعداً، سيستخدم Git الأمر `git restore` بدلاً من `git reset` للعديد من عمليات التراجع (undo operations). -Let's retrace our steps, and undo things with `git restore` instead of `git reset`. +دعنا نعيد تتبع خطواتنا، ونتراجع عن الأشياء باستخدام `git restore` بدلاً من `git reset`. -===== Unstaging a Staged File with git restore +===== Unstaging a Staged File with git restore (إلغاء تجهيز ملف مجهز باستخدام git restore) -The next two sections demonstrate how to work with your staging area and working directory changes with `git restore`. -The nice part is that the command you use to determine the state of those two areas also reminds you how to undo changes to them. -For example, let's say you've changed two files and want to commit them as two separate changes, but you accidentally type `git add *` and stage them both. -How can you unstage one of the two? -The `git status` command reminds you: +يوضح القسمان التاليان كيفية العمل مع تغييرات منطقة التجهيز ودليل العمل باستخدام `git restore`. +الجزء الجميل هو أن الأمر الذي تستخدمه لتحديد حالة هاتين المنطقتين يذكرك أيضاً بكيفية التراجع (undo) عن التغييرات التي طرأت عليهما. +على سبيل المثال، لنفترض أنك قمت بتغيير ملفين وتريد تأكيدهما كتغييرين منفصلين، لكنك كتبت بالخطأ `git add *` وقمت بتجهيزهما معاً. +كيف يمكنك إلغاء تجهيز أحدهما؟ +يذكرك أمر `git status`: [source,console] ---- @@ -176,8 +176,8 @@ Changes to be committed: ---- -Right below the "`Changes to be committed`" text, it says use `git restore --staged ...` to unstage. -So, let's use that advice to unstage the `CONTRIBUTING.md` file: +مباشرة أسفل نص "`Changes to be committed`" (تغييرات سيتم تأكيدها)، يخبرك باستخدام `git restore --staged ...` لإلغاء التجهيز. +لذا، دعنا نستخدم تلك النصيحة لإلغاء تجهيز ملف `CONTRIBUTING.md`: [source,console] ---- @@ -195,14 +195,14 @@ Changes not staged for commit: ---- -The `CONTRIBUTING.md` file is modified but once again unstaged. +تم تعديل ملف `CONTRIBUTING.md` ولكنه أصبح غير مجهز (unstaged) مرة أخرى. -===== Unmodifying a Modified File with git restore +===== Unmodifying a Modified File with git restore (إلغاء تعديل ملف معدل باستخدام git restore) -What if you realize that you don't want to keep your changes to the `CONTRIBUTING.md` file? -How can you easily unmodify it -- revert it back to what it looked like when you last committed (or initially cloned, or however you got it into your working directory)? -Luckily, `git status` tells you how to do that, too. -In the last example output, the unstaged area looks like this: +ماذا لو أدركت أنك لا تريد الاحتفاظ بتغييراتك على ملف `CONTRIBUTING.md`؟ +كيف يمكنك بسهولة إلغاء تعديله -- إعادته إلى ما كان يبدو عليه عندما قمت بالتأكيد آخر مرة (أو الاستنساخ الأولي، أو كيفما حصلت عليه في دليل العمل الخاص بك)؟ +لحسن الحظ، يخبرك `git status` بكيفية القيام بذلك أيضاً. +في مخرجات المثال الأخير، تبدو المنطقة غير المجهزة كالتالي: [source,console] ---- @@ -213,8 +213,8 @@ Changes not staged for commit: ---- -It tells you pretty explicitly how to discard the changes you've made. -Let's do what it says: +إنه يخبرك صراحة بكيفية تجاهل (discard) التغييرات التي أجريتها. +دعنا نفعل ما يقوله: [source,console] ---- @@ -229,7 +229,7 @@ Changes to be committed: [IMPORTANT] ===== -It's important to understand that `git restore ` is a dangerous command. -Any local changes you made to that file are gone -- Git just replaced that file with the last staged or committed version. -Don't ever use this command unless you absolutely know that you don't want those unsaved local changes. -===== +من المهم أن نفهم أن `git restore ` هو أمر خطير (dangerous command). +لقد ولت أي تغييرات محلية أجريتها على ذلك الملف -- قام Git للتو باستبدال ذلك الملف بآخر إصدار مجهز أو مؤكد. +لا تستخدم هذا الأمر أبداً ما لم تكن متأكداً تماماً من أنك لا تريد تلك التغييرات المحلية غير المحفوظة. +===== \ No newline at end of file diff --git a/book/02-git-basics/sections/viewing-history.asc b/book/02-git-basics/sections/viewing-history.asc index 440c7f250..11711fff5 100644 --- a/book/02-git-basics/sections/viewing-history.asc +++ b/book/02-git-basics/sections/viewing-history.asc @@ -1,18 +1,18 @@ [[_viewing_history]] -=== Viewing the Commit History +=== Viewing the Commit History (عرض سجل التأكيدات) -After you have created several commits, or if you have cloned a repository with an existing commit history, you'll probably want to look back to see what has happened. -The most basic and powerful tool to do this is the `git log` command. +بعد أن تقوم بإنشاء العديد من عمليات التأكيد (commits)، أو إذا قمت باستنساخ مستودع (cloned a repository) يحتوي على سجل تأكيد (commit history) موجود مسبقاً، فمن المحتمل أنك سترغب في إلقاء نظرة إلى الوراء لمعرفة ما حدث. +الأداة الأساسية والأكثر قوة للقيام بذلك هي أمر `git log`.(((git commands, log))) -These examples use a very simple project called "`simplegit`". -To get the project, run: +تستخدم هذه الأمثلة مشروعاً بسيطاً جداً يسمى `simplegit`. +للحصول على المشروع، قم بتشغيل: [source,console] ---- $ git clone https://github.com/schacon/simplegit-progit ---- -When you run `git log` in this project, you should get output that looks something like this:(((git commands, log))) +عندما تقوم بتشغيل `git log` في هذا المشروع، يجب أن تحصل على مخرجات تبدو كالتالي: [source,console] ---- @@ -36,14 +36,14 @@ Date: Sat Mar 15 10:31:28 2008 -0700 Initial commit ---- -By default, with no arguments, `git log` lists the commits made in that repository in reverse chronological order; that is, the most recent commits show up first. -As you can see, this command lists each commit with its SHA-1 checksum, the author's name and email, the date written, and the commit message. +بشكل افتراضي، وبدون أي وسيطات (arguments)، يسرد `git log` عمليات التأكيد (commits) التي تم إجراؤها في ذلك المستودع بترتيب زمني عكسي (reverse chronological order)؛ أي أن أحدث عمليات التأكيد تظهر أولاً. +كما ترى، يسرد هذا الأمر كل عملية تأكيد مع اختبار المجموع SHA-1 (SHA-1 checksum) الخاص بها، واسم المؤلف والبريد الإلكتروني، وتاريخ كتابتها، ورسالة التأكيد (commit message). -A huge number and variety of options to the `git log` command are available to show you exactly what you're looking for. -Here, we'll show you some of the most popular. +يتوفر عدد هائل ومتنوع من الخيارات لأمر `git log` لتظهر لك بالضبط ما تبحث عنه. +هنا، سنعرض لك بعضاً من أكثرها شيوعاً. -One of the more helpful options is `-p` or `--patch`, which shows the difference (the _patch_ output) introduced in each commit. -You can also limit the number of log entries displayed, such as using `-2` to show only the last two entries. +أحد أكثر الخيارات فائدة هو `-p` أو `--patch`، والذي يوضح الاختلاف (مخرجات _التصحيح - patch_) الذي تم إدخاله في كل عملية تأكيد.(((git commands, diff)))(((log formatting))) +يمكنك أيضاً تحديد عدد إدخالات السجل المعروضة، مثل استخدام `-2` لإظهار آخر إدخالين فقط: [source,console] ---- @@ -89,10 +89,10 @@ index a0a60ae..47c6340 100644 -end ---- -This option displays the same information but with a diff directly following each entry. -This is very helpful for code review or to quickly browse what happened during a series of commits that a collaborator has added. -You can also use a series of summarizing options with `git log`. -For example, if you want to see some abbreviated stats for each commit, you can use the `--stat` option: +يعرض هذا الخيار نفس المعلومات ولكن مع اختلاف (diff) يتبع مباشرة كل إدخال. +هذا مفيد جداً لمراجعة الكود (code review) أو لتصفح ما حدث بسرعة خلال سلسلة من عمليات التأكيد (commits) التي أضافها أحد المتعاونين (collaborator). +يمكنك أيضاً استخدام سلسلة من الخيارات التلخيصية مع `git log`. +على سبيل المثال، إذا كنت تريد رؤية بعض الإحصائيات المختصرة (abbreviated stats) لكل عملية تأكيد، يمكنك استخدام الخيار `--stat`: [source,console] ---- @@ -127,14 +127,14 @@ Date: Sat Mar 15 10:31:28 2008 -0700 3 files changed, 54 insertions(+) ---- -As you can see, the `--stat` option prints below each commit entry a list of modified files, how many files were changed, and how many lines in those files were added and removed. -It also puts a summary of the information at the end. +كما ترى، يطبع الخيار `--stat` أسفل كل إدخال تأكيد (commit entry) قائمة بالملفات المعدلة، وكم عدد الملفات التي تم تغييرها، وكم عدد الأسطر التي تمت إضافتها وإزالتها في تلك الملفات. +كما يضع ملخصاً للمعلومات في النهاية. -Another really useful option is `--pretty`. -This option changes the log output to formats other than the default. -A few prebuilt option values are available for you to use. -The `oneline` value for this option prints each commit on a single line, which is useful if you're looking at a lot of commits. -In addition, the `short`, `full`, and `fuller` values show the output in roughly the same format but with less or more information, respectively: +خيار آخر مفيد حقاً هو `--pretty`. +يغير هذا الخيار مخرجات السجل (log output) إلى تنسيقات غير الافتراضية. +يتوفر لك عدد قليل من قيم الخيارات المعدة مسبقاً (prebuilt option values) لاستخدامها. +تطبع القيمة `oneline` لهذا الخيار كل عملية تأكيد (commit) في سطر واحد، وهو أمر مفيد إذا كنت تبحث في الكثير من عمليات التأكيد. +بالإضافة إلى ذلك، تظهر القيم `short` و `full` و `fuller` المخرجات بنفس التنسيق تقريباً ولكن بمعلومات أقل أو أكثر، على التوالي: [source,console] ---- @@ -144,8 +144,8 @@ ca82a6dff817ec66f44342007202690a93763949 Change version number a11bef06a3f659402fe7563abf99ad00de2209e6 Initial commit ---- -The most interesting option value is `format`, which allows you to specify your own log output format. -This is especially useful when you're generating output for machine parsing -- because you specify the format explicitly, you know it won't change with updates to Git:(((log formatting))) +قيمة الخيار الأكثر إثارة للاهتمام هي `format` (تنسيق)، والتي تتيح لك تحديد تنسيق مخرجات السجل (log output format) الخاص بك. +هذا مفيد بشكل خاص عندما تقوم بإنشاء مخرجات للتحليل الآلي (machine parsing) -- لأنك تحدد التنسيق صراحةً، فأنت تعلم أنه لن يتغير مع التحديثات على Git:(((log formatting))) [source,console] ---- @@ -155,37 +155,37 @@ ca82a6d - Scott Chacon, 6 years ago : Change version number a11bef0 - Scott Chacon, 6 years ago : Initial commit ---- -<> lists some of the more useful specifiers that `format` takes. +يسرد <> بعضاً من المحددات (specifiers) الأكثر فائدة التي يأخذها `format`. [[pretty_format]] -.Useful specifiers for `git log --pretty=format` +.Useful specifiers for `git log --pretty=format` (محددات مفيدة لـ `git log --pretty=format`) [cols="1,4",options="header"] |================================ -| Specifier | Description of Output -| `%H` | Commit hash -| `%h` | Abbreviated commit hash -| `%T` | Tree hash -| `%t` | Abbreviated tree hash -| `%P` | Parent hashes -| `%p` | Abbreviated parent hashes -| `%an` | Author name -| `%ae` | Author email -| `%ad` | Author date (format respects the `--date=option`) -| `%ar` | Author date, relative -| `%cn` | Committer name -| `%ce` | Committer email -| `%cd` | Committer date -| `%cr` | Committer date, relative -| `%s` | Subject +| Specifier (المحدد) | Description of Output (وصف المخرجات) +| `%H` | Commit hash (تجزئة التأكيد) +| `%h` | Abbreviated commit hash (تجزئة التأكيد المختصرة) +| `%T` | Tree hash (تجزئة الشجرة) +| `%t` | Abbreviated tree hash (تجزئة الشجرة المختصرة) +| `%P` | Parent hashes (تجزئات الأصل) +| `%p` | Abbreviated parent hashes (تجزئات الأصل المختصرة) +| `%an` | Author name (اسم المؤلف) +| `%ae` | Author email (البريد الإلكتروني للمؤلف) +| `%ad` | Author date (format respects the `--date=option`) (تاريخ المؤلف - التنسيق يحترم خيار التاريخ) +| `%ar` | Author date, relative (تاريخ المؤلف، نسبي) +| `%cn` | Committer name (اسم المُؤكِّد) +| `%ce` | Committer email (البريد الإلكتروني للمُؤكِّد) +| `%cd` | Committer date (تاريخ المُؤكِّد) +| `%cr` | Committer date, relative (تاريخ المُؤكِّد، نسبي) +| `%s` | Subject (الموضوع) |================================ -You may be wondering what the difference is between _author_ and _committer_. -The author is the person who originally wrote the work, whereas the committer is the person who last applied the work. -So, if you send in a patch to a project and one of the core members applies the patch, both of you get credit -- you as the author, and the core member as the committer. -We'll cover this distinction a bit more in <>. +قد تتساءل ما هو الفرق بين _المؤلف (author)_ و _المُؤكِّد (committer)_. +المؤلف هو الشخص الذي كتب العمل في الأصل، في حين أن المُؤكِّد هو الشخص الذي قام بتطبيق العمل في النهاية. +لذا، إذا أرسلت تصحيحاً (patch) إلى مشروع وقام أحد الأعضاء الأساسيين بتطبيق التصحيح، فكلاكما يحصل على الفضل -- أنت كمؤلف، والعضو الأساسي كمُؤكِّد. +سنغطي هذا التمييز أكثر قليلاً في <>. -The `oneline` and `format` option values are particularly useful with another `log` option called `--graph`. -This option adds a nice little ASCII graph showing your branch and merge history: +تعد قيم الخيار `oneline` و `format` مفيدة بشكل خاص مع خيار `log` آخر يسمى `--graph`. +يضيف هذا الخيار رسماً بيانياً صغيراً ولطيفاً بتنسيق ASCII يوضح الفرع (branch) الخاص بك وسجل الدمج (merge history): [source,console] ---- @@ -202,87 +202,87 @@ $ git log --pretty=format:"%h %s" --graph * 11d191e Merge branch 'defunkt' into local ---- -This type of output will become more interesting as we go through branching and merging in the next chapter. +سيصبح هذا النوع من المخرجات أكثر إثارة للاهتمام عندما نمر عبر التفرع (branching) والدمج (merging) في الفصل التالي. -Those are only some simple output-formatting options to `git log` -- there are many more. -<> lists the options we've covered so far, as well as some other common formatting options that may be useful, along with how they change the output of the `log` command. +هذه ليست سوى بعض خيارات تنسيق المخرجات (output-formatting options) البسيطة لأمر `git log` -- وهناك العديد غيرها. +يسرد <> الخيارات التي قمنا بتغطيتها حتى الآن، بالإضافة إلى بعض خيارات التنسيق الشائعة الأخرى التي قد تكون مفيدة، إلى جانب كيفية تغييرها لمخرجات أمر `log`. [[log_options]] -.Common options to `git log` +.Common options to `git log` (خيارات شائعة لـ `git log`) [cols="1,4",options="header"] |================================ -| Option | Description -| `-p` | Show the patch introduced with each commit. -| `--stat` | Show statistics for files modified in each commit. -| `--shortstat` | Display only the changed/insertions/deletions line from the `--stat` command. -| `--name-only` | Show the list of files modified after the commit information. -| `--name-status` | Show the list of files affected with added/modified/deleted information as well. -| `--abbrev-commit` | Show only the first few characters of the SHA-1 checksum instead of all 40. -| `--relative-date` | Display the date in a relative format (for example, "`2 weeks ago`") instead of using the full date format. -| `--graph` | Display an ASCII graph of the branch and merge history beside the log output. -| `--pretty` | Show commits in an alternate format. Option values include `oneline`, `short`, `full`, `fuller`, and `format` (where you specify your own format). -| `--oneline` | Shorthand for `--pretty=oneline --abbrev-commit` used together. +| Option (الخيار) | Description (الوصف) +| `-p` | Show the patch introduced with each commit. (إظهار التصحيح المُدخل مع كل عملية تأكيد). +| `--stat` | Show statistics for files modified in each commit. (إظهار إحصائيات للملفات المعدلة في كل عملية تأكيد). +| `--shortstat` | Display only the changed/insertions/deletions line from the `--stat` command. (عرض سطر التغييرات/الإدراجات/الحذف فقط من أمر --stat). +| `--name-only` | Show the list of files modified after the commit information. (إظهار قائمة الملفات المعدلة بعد معلومات التأكيد). +| `--name-status` | Show the list of files affected with added/modified/deleted information as well. (إظهار قائمة الملفات المتأثرة مع معلومات الإضافة/التعديل/الحذف أيضاً). +| `--abbrev-commit` | Show only the first few characters of the SHA-1 checksum instead of all 40. (إظهار الأحرف القليلة الأولى فقط من اختبار المجموع SHA-1 بدلاً من جميع الـ 40). +| `--relative-date` | Display the date in a relative format (for example, "`2 weeks ago`") instead of using the full date format. (عرض التاريخ بتنسيق نسبي - على سبيل المثال "قبل أسبوعين" - بدلاً من استخدام تنسيق التاريخ الكامل). +| `--graph` | Display an ASCII graph of the branch and merge history beside the log output. (عرض رسم بياني ASCII للفرع وسجل الدمج بجانب مخرجات السجل). +| `--pretty` | Show commits in an alternate format. Option values include `oneline`, `short`, `full`, `fuller`, and `format` (where you specify your own format). (إظهار عمليات التأكيد بتنسيق بديل. تتضمن قيم الخيارات oneline و short و full و fuller و format - حيث تحدد التنسيق الخاص بك). +| `--oneline` | Shorthand for `--pretty=oneline --abbrev-commit` used together. (اختصار لـ --pretty=oneline --abbrev-commit المستخدمة معاً). |================================ -==== Limiting Log Output +==== Limiting Log Output (الحد من مخرجات السجل) -In addition to output-formatting options, `git log` takes a number of useful limiting options; that is, options that let you show only a subset of commits. -You've seen one such option already -- the `-2` option, which displays only the last two commits. -In fact, you can do `-`, where `n` is any integer to show the last `n` commits. -In reality, you're unlikely to use that often, because Git by default pipes all output through a pager so you see only one page of log output at a time. +بالإضافة إلى خيارات تنسيق المخرجات، يأخذ `git log` عدداً من خيارات الحد (limiting options) المفيدة؛ أي الخيارات التي تتيح لك إظهار مجموعة فرعية (subset) فقط من عمليات التأكيد. +لقد رأيت أحد هذه الخيارات بالفعل -- الخيار `-2`، والذي يعرض آخر عمليتي تأكيد فقط. +في الواقع، يمكنك القيام بـ `-`، حيث `n` هو أي عدد صحيح لإظهار آخر `n` عملية تأكيد. +في الواقع، من غير المحتمل أن تستخدم ذلك كثيراً، لأن Git افتراضياً يمرر جميع المخرجات من خلال بيجر (pager) بحيث ترى صفحة واحدة فقط من مخرجات السجل في كل مرة. -However, the time-limiting options such as `--since` and `--until` are very useful. -For example, this command gets the list of commits made in the last two weeks: +ومع ذلك، فإن خيارات الحد الزمني (time-limiting options) مثل `--since` و `--until` مفيدة جداً. +على سبيل المثال، يحصل هذا الأمر على قائمة عمليات التأكيد التي تم إجراؤها في الأسبوعين الماضيين: [source,console] ---- $ git log --since=2.weeks ---- -This command works with lots of formats -- you can specify a specific date like `"2008-01-15"`, or a relative date such as `"2 years 1 day 3 minutes ago"`. +يعمل هذا الأمر مع العديد من التنسيقات -- يمكنك تحديد تاريخ معين مثل `"2008-01-15"`، أو تاريخ نسبي مثل `"2 years 1 day 3 minutes ago"`. -You can also filter the list to commits that match some search criteria. -The `--author` option allows you to filter on a specific author, and the `--grep` option lets you search for keywords in the commit messages. +يمكنك أيضاً تصفية (filter) القائمة لعمليات التأكيد التي تطابق بعض معايير البحث (search criteria). +يتيح لك الخيار `--author` التصفية بناءً على مؤلف معين، ويتيح لك الخيار `--grep` البحث عن كلمات رئيسية في رسائل التأكيد (commit messages). [NOTE] ==== -You can specify more than one instance of both the `--author` and `--grep` search criteria, which will limit the commit output to commits that match _any_ of the `--author` patterns and _any_ of the `--grep` patterns; however, adding the `--all-match` option further limits the output to just those commits that match _all_ `--grep` patterns. +يمكنك تحديد أكثر من مثيل واحد لكل من معايير البحث `--author` و `--grep`، مما سيحد من مخرجات التأكيد لتشمل عمليات التأكيد التي تتطابق مع _أي (any)_ من أنماط `--author` و _أي (any)_ من أنماط `--grep`؛ ومع ذلك، فإن إضافة الخيار `--all-match` يحد من المخرجات بشكل أكبر إلى فقط عمليات التأكيد التي تتطابق مع _جميع (all)_ أنماط `--grep`. ==== -Another really helpful filter is the `-S` option (colloquially referred to as Git's "`pickaxe`" option), which takes a string and shows only those commits that changed the number of occurrences of that string. -For instance, if you wanted to find the last commit that added or removed a reference to a specific function, you could call: +عامل تصفية (filter) آخر مفيد حقاً هو الخيار `-S` (يشار إليه بالعامية باسم خيار "`معول - pickaxe`" الخاص بـ Git)، والذي يأخذ سلسلة نصية (string) ويظهر فقط عمليات التأكيد التي غيرت عدد مرات ظهور تلك السلسلة. +على سبيل المثال، إذا كنت ترغب في العثور على آخر عملية تأكيد (last commit) قامت بإضافة أو إزالة مرجع (reference) لدالة (function) معينة، يمكنك استدعاء: [source,console] ---- $ git log -S function_name ---- -The last really useful option to pass to `git log` as a filter is a path. -If you specify a directory or file name, you can limit the log output to commits that introduced a change to those files. -This is always the last option and is generally preceded by double dashes (`--`) to separate the paths from the options: +الخيار الأخير المفيد حقاً لتمريره إلى `git log` كعامل تصفية هو المسار (path). +إذا حددت اسماً لدليل أو ملف، يمكنك قصر مخرجات السجل على عمليات التأكيد التي أدخلت تغييراً على تلك الملفات. +هذا دائماً هو الخيار الأخير ويسبقه عموماً شرطتان مزدوجتان (`--`) لفصل المسارات عن الخيارات: [source,console] ---- $ git log -- path/to/file ---- -In <> we'll list these and a few other common options for your reference. +في <> سنسرد هذه الخيارات وبعض الخيارات الشائعة الأخرى للرجوع إليها. [[limit_options]] -.Options to limit the output of `git log` +.Options to limit the output of `git log` (خيارات للحد من مخرجات `git log`) [cols="2,4",options="header"] |================================ -| Option | Description -| `-` | Show only the last n commits. -| `--since`, `--after` | Limit the commits to those made after the specified date. -| `--until`, `--before` | Limit the commits to those made before the specified date. -| `--author` | Only show commits in which the author entry matches the specified string. -| `--committer` | Only show commits in which the committer entry matches the specified string. -| `--grep` | Only show commits with a commit message containing the string. -| `-S` | Only show commits adding or removing code matching the string. +| Option (الخيار) | Description (الوصف) +| `-` | Show only the last n commits. (إظهار آخر n عملية تأكيد فقط). +| `--since`, `--after` | Limit the commits to those made after the specified date. (قصر عمليات التأكيد على تلك التي تم إجراؤها بعد التاريخ المحدد). +| `--until`, `--before` | Limit the commits to those made before the specified date. (قصر عمليات التأكيد على تلك التي تم إجراؤها قبل التاريخ المحدد). +| `--author` | Only show commits in which the author entry matches the specified string. (إظهار عمليات التأكيد فقط التي يتطابق فيها إدخال المؤلف مع السلسلة المحددة). +| `--committer` | Only show commits in which the committer entry matches the specified string. (إظهار عمليات التأكيد فقط التي يتطابق فيها إدخال المُؤكِّد مع السلسلة المحددة). +| `--grep` | Only show commits with a commit message containing the string. (إظهار عمليات التأكيد فقط التي تحتوي رسالة التأكيد الخاصة بها على السلسلة). +| `-S` | Only show commits adding or removing code matching the string. (إظهار عمليات التأكيد فقط التي تضيف أو تزيل كوداً يطابق السلسلة). |================================ -For example, if you want to see which commits modifying test files in the Git source code history were committed by Junio Hamano in the month of October 2008 and are not merge commits, you can run something like this:(((log filtering))) +على سبيل المثال، إذا كنت تريد رؤية عمليات التأكيد التي تعدل ملفات الاختبار (test files) في سجل الكود المصدري (source code history) لـ Git والتي تم تأكيدها بواسطة Junio Hamano في شهر أكتوبر 2008 وليست عمليات تأكيد دمج (merge commits)، يمكنك تشغيل شيء من هذا القبيل:(((log filtering))) [source,console] ---- @@ -296,11 +296,11 @@ d1a43f2 - reset --hard/read-tree --reset -u: remove unmerged new paths b0ad11e - pull: allow "git pull origin $something:$current_branch" into an unborn branch ---- -Of the nearly 40,000 commits in the Git source code history, this command shows the 6 that match those criteria. +من بين ما يقرب من 40,000 عملية تأكيد في سجل الكود المصدري لـ Git، يعرض هذا الأمر العمليات الستة (6) التي تتطابق مع هذه المعايير. [TIP] -.Preventing the display of merge commits +.Preventing the display of merge commits (منع عرض عمليات تأكيد الدمج) ==== -Depending on the workflow used in your repository, it's possible that a sizable percentage of the commits in your log history are just merge commits, which typically aren't very informative. -To prevent the display of merge commits cluttering up your log history, simply add the `log` option `--no-merges`. +بناءً على سير العمل (workflow) المستخدم في مستودعك، من الممكن أن تكون نسبة كبيرة من عمليات التأكيد في سجل السجل (log history) الخاص بك مجرد عمليات تأكيد دمج (merge commits)، والتي عادة لا تكون غنية بالمعلومات. +لمنع عرض عمليات تأكيد الدمج من إحداث فوضى في سجل السجل الخاص بك، ببساطة أضف الخيار `--no-merges` لأمر `log`. ==== diff --git a/book/03-git-branching/sections/basic-branching-and-merging.asc b/book/03-git-branching/sections/basic-branching-and-merging.asc index a894b6702..ea173279b 100644 --- a/book/03-git-branching/sections/basic-branching-and-merging.asc +++ b/book/03-git-branching/sections/basic-branching-and-merging.asc @@ -1,31 +1,31 @@ -=== Basic Branching and Merging +=== Basic Branching and Merging (التفرع والدمج الأساسيان) -Let's go through a simple example of branching and merging with a workflow that you might use in the real world. -You'll follow these steps: +دعنا نستعرض مثالاً بسيطاً للتفرع (branching) والدمج (merging) باستخدام سير عمل (workflow) قد تستخدمه في العالم الحقيقي. +ستتبع هذه الخطوات: -. Do some work on a website. -. Create a branch for a new user story you're working on. -. Do some work in that branch. +. قم بالعمل على موقع ويب. +. قم بإنشاء فرع (branch) لقصة مستخدم (user story) جديدة تعمل عليها. +. قم ببعض العمل في ذلك الفرع. -At this stage, you'll receive a call that another issue is critical and you need a hotfix. -You'll do the following: +في هذه المرحلة، ستتلقى مكالمة تفيد بأن مشكلة أخرى حرجة (critical) وأنك بحاجة إلى إصلاح عاجل (hotfix). +ستقوم بما يلي: -. Switch to your production branch. -. Create a branch to add the hotfix. -. After it's tested, merge the hotfix branch, and push to production. -. Switch back to your original user story and continue working. +. قم بالتبديل (Switch) إلى فرع الإنتاج (production branch) الخاص بك. +. قم بإنشاء فرع لإضافة الإصلاح العاجل (hotfix). +. بعد اختباره، قم بدمج (merge) فرع الإصلاح العاجل، وادفعه (push) إلى الإنتاج. +. قم بالتبديل مرة أخرى إلى قصة المستخدم الأصلية واستمر في العمل. [[_basic_branching]] -==== Basic Branching +==== Basic Branching (التفرع الأساسي) (((branches, basic workflow))) -First, let's say you're working on your project and have a couple of commits already on the `master` branch. +أولاً، لنفترض أنك تعمل على مشروعك ولديك بالفعل عمليتا تأكيد (commits) على فرع `master`. -.A simple commit history +.A simple commit history (سجل تأكيد بسيط) image::images/basic-branching-1.png[A simple commit history] -You've decided that you're going to work on issue #53 in whatever issue-tracking system your company uses. -To create a new branch and switch to it at the same time, you can run the `git checkout` command with the `-b` switch: +لقد قررت أنك ستعمل على المشكلة (issue) رقم 53 في أي نظام لتتبع المشكلات (issue-tracking system) تستخدمه شركتك. +لإنشاء فرع جديد والتبديل إليه في نفس الوقت، يمكنك تشغيل أمر `git checkout` مع مفتاح `-b`: [source,console] ---- @@ -33,7 +33,7 @@ $ git checkout -b iss53 Switched to a new branch "iss53" ---- -This is shorthand for: +هذا اختصار لـ: [source,console] ---- @@ -41,11 +41,11 @@ $ git branch iss53 $ git checkout iss53 ---- -.Creating a new branch pointer +.Creating a new branch pointer (إنشاء مؤشر فرع جديد) image::images/basic-branching-2.png[Creating a new branch pointer] -You work on your website and do some commits. -Doing so moves the `iss53` branch forward, because you have it checked out (that is, your `HEAD` is pointing to it): +أنت تعمل على موقع الويب الخاص بك وتقوم ببعض عمليات التأكيد (commits). +يؤدي القيام بذلك إلى تحريك فرع `iss53` للأمام، لأنك قمت بسحبه (checked out) (أي أن `HEAD` يشير إليه): [source,console] ---- @@ -53,17 +53,17 @@ $ vim index.html $ git commit -a -m 'Create new footer [issue 53]' ---- -.The `iss53` branch has moved forward with your work -image::images/basic-branching-3.png[The `iss53` branch has moved forward with your work] +.The `iss53` branch has moved forward (تحرك فرع `iss53` للأمام) +image::images/basic-branching-3.png[The `iss53` branch has moved forward] -Now you get the call that there is an issue with the website, and you need to fix it immediately. -With Git, you don't have to deploy your fix along with the `iss53` changes you've made, and you don't have to put a lot of effort into reverting those changes before you can work on applying your fix to what is in production. -All you have to do is switch back to your `master` branch. +الآن تتلقى مكالمة تفيد بوجود مشكلة (issue) في موقع الويب، وتحتاج إلى إصلاحها على الفور. +مع Git، لست مضطراً لنشر إصلاحك (deploy your fix) جنباً إلى جنب مع تغييرات `iss53` التي أجريتها، ولا يتعين عليك بذل الكثير من الجهد في التراجع (reverting) عن تلك التغييرات قبل أن تتمكن من العمل على تطبيق إصلاحك على ما هو موجود في الإنتاج (production). +كل ما عليك فعله هو التبديل مرة أخرى (switch back) إلى فرع `master` الخاص بك. -However, before you do that, note that if your working directory or staging area has uncommitted changes that conflict with the branch you're checking out, Git won't let you switch branches. -It's best to have a clean working state when you switch branches. -There are ways to get around this (namely, stashing and commit amending) that we'll cover later on, in <>. -For now, let's assume you've committed all your changes, so you can switch back to your `master` branch: +ومع ذلك، قبل القيام بذلك، لاحظ أنه إذا كان دليل العمل (working directory) أو منطقة التجهيز (staging area) الخاص بك يحتوي على تغييرات غير مؤكدة (uncommitted changes) تتعارض (conflict) مع الفرع الذي تقوم بسحبه، فلن يسمح لك Git بتبديل الفروع. +من الأفضل أن يكون لديك حالة عمل نظيفة (clean working state) عندما تقوم بتبديل الفروع. +هناك طرق للالتفاف حول هذا (وهي التخزين - stashing - وتعديل التأكيد - commit amending) التي سنغطيها لاحقاً، في <>. +في الوقت الحالي، لنفترض أنك قمت بتأكيد كل تغييراتك، بحيث يمكنك التبديل مرة أخرى إلى فرع `master` الخاص بك: [source,console] ---- @@ -71,12 +71,12 @@ $ git checkout master Switched to branch 'master' ---- -At this point, your project working directory is exactly the way it was before you started working on issue #53, and you can concentrate on your hotfix. -This is an important point to remember: when you switch branches, Git resets your working directory to look like it did the last time you committed on that branch. -It adds, removes, and modifies files automatically to make sure your working copy is what the branch looked like on your last commit to it. +في هذه المرحلة، أصبح دليل عمل مشروعك تماماً كما كان قبل أن تبدأ العمل في المشكلة رقم 53، ويمكنك التركيز على الإصلاح العاجل (hotfix) الخاص بك. +هذه نقطة مهمة يجب تذكرها: عندما تقوم بتبديل الفروع، يقوم Git بإعادة تعيين (resets) دليل العمل الخاص بك ليبدو كما كان في آخر مرة قمت فيها بالتأكيد (committed) على ذلك الفرع. +إنه يضيف الملفات ويزيلها ويعدلها تلقائياً للتأكد من أن نسخة العمل (working copy) الخاصة بك هي ما كان يبدو عليه الفرع في آخر عملية تأكيد (commit) قمت بها عليه. -Next, you have a hotfix to make. -Let's create a `hotfix` branch on which to work until it's completed: +بعد ذلك، لديك إصلاح عاجل (hotfix) لتقوم به. +دعنا ننشئ فرع `hotfix` للعمل عليه حتى يكتمل: [source,console] ---- @@ -88,11 +88,11 @@ $ git commit -a -m 'Fix broken email address' 1 file changed, 2 insertions(+) ---- -.Hotfix branch based on `master` +.Hotfix branch based on `master` (فرع إصلاح عاجل مبني على `master`) image::images/basic-branching-4.png[Hotfix branch based on `master`] -You can run your tests, make sure the hotfix is what you want, and finally merge the `hotfix` branch back into your `master` branch to deploy to production. -You do this with the `git merge` command:(((git commands, merge))) +يمكنك تشغيل اختباراتك (tests)، والتأكد من أن الإصلاح العاجل هو ما تريده، وأخيراً دمج (merge) فرع `hotfix` مرة أخرى في فرع `master` الخاص بك لنشره في الإنتاج. +تقوم بذلك باستخدام أمر `git merge`:(((git commands, merge))) [source,console] ---- @@ -104,18 +104,18 @@ Fast-forward 1 file changed, 2 insertions(+) ---- -You'll notice the phrase "`fast-forward`" in that merge. -Because the commit `C4` pointed to by the branch `hotfix` you merged in was directly ahead of the commit `C2` you're on, Git simply moves the pointer forward. -To phrase that another way, when you try to merge one commit with a commit that can be reached by following the first commit's history, Git simplifies things by moving the pointer forward because there is no divergent work to merge together -- this is called a "`fast-forward.`" +ستلاحظ عبارة "`fast-forward`" (تقديم سريع) في عملية الدمج (merge) هذه. +نظراً لأن عملية التأكيد `C4` التي يشير إليها فرع `hotfix` الذي قمت بدمجه كانت متقدمة مباشرة على عملية التأكيد `C2` التي تتواجد عليها، فإن Git يقوم ببساطة بتحريك المؤشر للأمام. +لصياغة ذلك بطريقة أخرى، عندما تحاول دمج عملية تأكيد مع عملية تأكيد يمكن الوصول إليها باتباع سجل (history) عملية التأكيد الأولى، يقوم Git بتبسيط الأمور عن طريق تحريك المؤشر للأمام نظراً لعدم وجود عمل منحرف (divergent work) لدمجه معاً -- وهذا ما يسمى "`fast-forward.`" (تقديم سريع). -Your change is now in the snapshot of the commit pointed to by the `master` branch, and you can deploy the fix. +أصبح تغييرك الآن في لقطة (snapshot) عملية التأكيد التي يشير إليها فرع `master`، ويمكنك نشر الإصلاح. -.`master` is fast-forwarded to `hotfix` +.`master` is fast-forwarded to `hotfix` (تم التقديم السريع لـ `master` إلى `hotfix`) image::images/basic-branching-5.png[`master` is fast-forwarded to `hotfix`] -After your super-important fix is deployed, you're ready to switch back to the work you were doing before you were interrupted. -However, first you'll delete the `hotfix` branch, because you no longer need it -- the `master` branch points at the same place. -You can delete it with the `-d` option to `git branch`: +بعد نشر الإصلاح الفائق الأهمية (super-important fix) الخاص بك، أنت جاهز للتبديل مرة أخرى (switch back) إلى العمل الذي كنت تقوم به قبل مقاطعتك. +ومع ذلك، ستقوم أولاً بحذف (delete) فرع `hotfix`، لأنك لم تعد بحاجة إليه -- يشير فرع `master` إلى نفس المكان. +يمكنك حذفه باستخدام الخيار `-d` لأمر `git branch`: [source,console] ---- @@ -123,7 +123,7 @@ $ git branch -d hotfix Deleted branch hotfix (3a0874c). ---- -Now you can switch back to your work-in-progress branch on issue #53 and continue working on it. +الآن يمكنك التبديل مرة أخرى (switch back) إلى فرع العمل الجاري (work-in-progress branch) الخاص بك بشأن المشكلة رقم 53 والاستمرار في العمل عليها. [source,console] ---- @@ -135,19 +135,19 @@ $ git commit -a -m 'Finish the new footer [issue 53]' 1 file changed, 1 insertion(+) ---- -.Work continues on `iss53` +.Work continues on `iss53` (يستمر العمل في `iss53`) image::images/basic-branching-6.png[Work continues on `iss53`] -It's worth noting here that the work you did in your `hotfix` branch is not contained in the files in your `iss53` branch. -If you need to pull it in, you can merge your `master` branch into your `iss53` branch by running `git merge master`, or you can wait to integrate those changes until you decide to pull the `iss53` branch back into `master` later. +تجدر الإشارة هنا إلى أن العمل الذي قمت به في فرع `hotfix` الخاص بك غير موجود في الملفات الموجودة في فرع `iss53` الخاص بك. +إذا كنت بحاجة إلى سحبه (pull it in)، فيمكنك دمج (merge) فرع `master` الخاص بك في فرع `iss53` الخاص بك عن طريق تشغيل `git merge master`، أو يمكنك الانتظار لدمج تلك التغييرات حتى تقرر سحب (pull) فرع `iss53` مرة أخرى إلى `master` لاحقاً. [[_basic_merging]] -==== Basic Merging +==== Basic Merging (الدمج الأساسي) (((branches, merging)))(((merging))) -Suppose you've decided that your issue #53 work is complete and ready to be merged into your `master` branch. -In order to do that, you'll merge your `iss53` branch into `master`, much like you merged your `hotfix` branch earlier. -All you have to do is check out the branch you wish to merge into and then run the `git merge` command: +لنفترض أنك قررت أن عملك في المشكلة رقم 53 مكتمل وجاهز للدمج (merge) في فرع `master` الخاص بك. +للقيام بذلك، ستقوم بدمج فرع `iss53` الخاص بك في `master`، تماماً مثلما دمجت فرع `hotfix` الخاص بك في وقت سابق. +كل ما عليك فعله هو سحب (check out) الفرع الذي ترغب في الدمج فيه ثم تشغيل أمر `git merge`: [source,console] ---- @@ -159,22 +159,22 @@ index.html | 1 + 1 file changed, 1 insertion(+) ---- -This looks a bit different than the `hotfix` merge you did earlier. -In this case, your development history has diverged from some older point. -Because the commit on the branch you're on isn't a direct ancestor of the branch you're merging in, Git has to do some work. -In this case, Git does a simple three-way merge, using the two snapshots pointed to by the branch tips and the common ancestor of the two. +يبدو هذا مختلفاً بعض الشيء عن دمج (merge) `hotfix` الذي قمت به في وقت سابق. +في هذه الحالة، انحرف (diverged) سجل التطوير الخاص بك عن نقطة أقدم. +نظراً لأن عملية التأكيد (commit) على الفرع الذي تتواجد عليه ليست سلفاً مباشراً (direct ancestor) للفرع الذي تدمجه (merging in)، يجب على Git القيام ببعض العمل. +في هذه الحالة، يقوم Git بعملية دمج ثلاثية (three-way merge) بسيطة، باستخدام اللقطتين (snapshots) اللتين تشير إليهما أطراف الفروع (branch tips) والسلف المشترك (common ancestor) للاثنين. -.Three snapshots used in a typical merge +.Three snapshots used in a typical merge (ثلاث لقطات مستخدمة في دمج نموذجي) image::images/basic-merging-1.png[Three snapshots used in a typical merge] -Instead of just moving the branch pointer forward, Git creates a new snapshot that results from this three-way merge and automatically creates a new commit that points to it. -This is referred to as a merge commit, and is special in that it has more than one parent. +بدلاً من مجرد تحريك مؤشر الفرع (branch pointer) للأمام، يقوم Git بإنشاء لقطة (snapshot) جديدة ناتجة عن هذا الدمج الثلاثي (three-way merge) وينشئ تلقائياً عملية تأكيد جديدة (new commit) تشير إليها. +يشار إلى هذا باسم عملية تأكيد دمج (merge commit)، وهي خاصة من حيث أن لها أكثر من أصل واحد (parent). -.A merge commit +.A merge commit (عملية تأكيد دمج) image::images/basic-merging-2.png[A merge commit] -Now that your work is merged in, you have no further need for the `iss53` branch. -You can close the issue in your issue-tracking system, and delete the branch: +الآن بعد دمج عملك (merged in)، لم تعد بحاجة إلى فرع `iss53`. +يمكنك إغلاق المشكلة في نظام تتبع المشكلات (issue-tracking system) الخاص بك، وحذف (delete) الفرع: [source,console] ---- @@ -182,12 +182,12 @@ $ git branch -d iss53 ---- [[_basic_merge_conflicts]] -==== Basic Merge Conflicts +==== Basic Merge Conflicts (تعارضات الدمج الأساسية) (((merging, conflicts))) -Occasionally, this process doesn't go smoothly. -If you changed the same part of the same file differently in the two branches you're merging, Git won't be able to merge them cleanly. -If your fix for issue #53 modified the same part of a file as the `hotfix` branch, you'll get a merge conflict that looks something like this: +في بعض الأحيان، لا تسير هذه العملية بسلاسة. +إذا قمت بتغيير نفس الجزء من نفس الملف بشكل مختلف في الفرعين اللذين تدمجهما (merging)، فلن يتمكن Git من دمجهما بشكل نظيف. +إذا قام إصلاحك للمشكلة رقم 53 بتعديل نفس الجزء من ملف مثل فرع `hotfix`، فستحصل على تعارض دمج (merge conflict) يبدو كالتالي: [source,console] ---- @@ -197,9 +197,9 @@ CONFLICT (content): Merge conflict in index.html Automatic merge failed; fix conflicts and then commit the result. ---- -Git hasn't automatically created a new merge commit. -It has paused the process while you resolve the conflict. -If you want to see which files are unmerged at any point after a merge conflict, you can run `git status`: +لم يقم Git تلقائياً بإنشاء عملية تأكيد دمج (merge commit) جديدة. +لقد أوقف (paused) العملية مؤقتاً أثناء قيامك بحل التعارض (resolve the conflict). +إذا كنت تريد معرفة الملفات غير المدمجة (unmerged) في أي نقطة بعد حدوث تعارض دمج، يمكنك تشغيل `git status`: [source,console] ---- @@ -216,9 +216,9 @@ Unmerged paths: no changes added to commit (use "git add" and/or "git commit -a") ---- -Anything that has merge conflicts and hasn't been resolved is listed as unmerged. -Git adds standard conflict-resolution markers to the files that have conflicts, so you can open them manually and resolve those conflicts. -Your file contains a section that looks something like this: +أي شيء يحتوي على تعارضات دمج (merge conflicts) ولم يتم حله (resolved) يتم سرده كغير مدمج (unmerged). +يضيف Git علامات دقة التعارض (conflict-resolution markers) القياسية إلى الملفات التي بها تعارضات، بحيث يمكنك فتحها يدوياً وحل تلك التعارضات. +يحتوي ملفك على قسم (section) يبدو كالتالي: [source,html] ---- @@ -231,9 +231,9 @@ Your file contains a section that looks something like this: >>>>>>> iss53:index.html ---- -This means the version in `HEAD` (your `master` branch, because that was what you had checked out when you ran your merge command) is the top part of that block (everything above the `=======`), while the version in your `iss53` branch looks like everything in the bottom part. -In order to resolve the conflict, you have to either choose one side or the other or merge the contents yourself. -For instance, you might resolve this conflict by replacing the entire block with this: +هذا يعني أن الإصدار في `HEAD` (فرع `master` الخاص بك، لأن هذا ما قمت بسحبه - checked out - عندما قمت بتشغيل أمر الدمج الخاص بك) هو الجزء العلوي من تلك الكتلة (كل شيء فوق `=======`)، بينما يبدو الإصدار في فرع `iss53` الخاص بك مثل كل شيء في الجزء السفلي. +لحل التعارض (resolve the conflict)، يجب عليك إما اختيار جانب أو آخر أو دمج (merge) المحتويات بنفسك. +على سبيل المثال، قد تحل هذا التعارض عن طريق استبدال الكتلة بأكملها بهذا: [source,html] ---- @@ -242,11 +242,11 @@ please contact us at email.support@github.com ---- -This resolution has a little of each section, and the `<<<<<<<`, `=======`, and `>>>>>>>` lines have been completely removed. -After you've resolved each of these sections in each conflicted file, run `git add` on each file to mark it as resolved. -Staging the file marks it as resolved in Git. +يحتوي هذا الحل على القليل من كل قسم، وتمت إزالة أسطر `<<<<<<<` و `=======` و `>>>>>>>` تماماً. +بعد أن تقوم بحل (resolved) كل من هذه الأقسام في كل ملف به تعارض، قم بتشغيل `git add` على كل ملف لوضع علامة عليه كتم حله (resolved). +يؤدي تجهيز (Staging) الملف إلى وضع علامة عليه بأنه تم حله في Git. -If you want to use a graphical tool to resolve these issues, you can run `git mergetool`, which fires up an appropriate visual merge tool and walks you through the conflicts:(((git commands, mergetool))) +إذا كنت تريد استخدام أداة رسومية (graphical tool) لحل هذه المشكلات، فيمكنك تشغيل `git mergetool`، والذي يقوم بتشغيل أداة دمج مرئية (visual merge tool) مناسبة ويرشدك عبر التعارضات:(((git commands, mergetool))) [source,console] ---- @@ -265,17 +265,17 @@ Normal merge conflict for 'index.html': Hit return to start merge resolution tool (opendiff): ---- -If you want to use a merge tool other than the default (Git chose `opendiff` in this case because the command was run on macOS), you can see all the supported tools listed at the top after "`one of the following tools.`" -Just type the name of the tool you'd rather use. +إذا كنت تريد استخدام أداة دمج (merge tool) غير الأداة الافتراضية (اختار Git `opendiff` في هذه الحالة لأنه تم تشغيل الأمر على نظام macOS)، فيمكنك رؤية جميع الأدوات المدعومة المدرجة في الأعلى بعد عبارة "`إحدى الأدوات التالية - one of the following tools.`" +فقط اكتب اسم الأداة التي تفضل استخدامها. [NOTE] ==== -If you need more advanced tools for resolving tricky merge conflicts, we cover more on merging in <>. +إذا كنت بحاجة إلى أدوات أكثر تقدماً لحل تعارضات الدمج (merge conflicts) الصعبة، فنحن نغطي المزيد عن الدمج في <>. ==== -After you exit the merge tool, Git asks you if the merge was successful. -If you tell the script that it was, it stages the file to mark it as resolved for you. -You can run `git status` again to verify that all conflicts have been resolved: +بعد خروجك من أداة الدمج (merge tool)، يسألك Git عما إذا كان الدمج ناجحاً. +إذا أخبرت البرنامج النصي (script) بأنه كذلك، فإنه يقوم بتجهيز (stages) الملف لوضع علامة عليه بأنه تم حله (resolved) لك. +يمكنك تشغيل `git status` مرة أخرى للتحقق من أنه تم حل جميع التعارضات: [source,console] ---- @@ -289,8 +289,8 @@ Changes to be committed: modified: index.html ---- -If you're happy with that, and you verify that everything that had conflicts has been staged, you can type `git commit` to finalize the merge commit. -The commit message by default looks something like this: +إذا كنت راضياً عن ذلك، وتحققت من أنه تم تجهيز (staged) كل شيء به تعارضات، يمكنك كتابة `git commit` لإنهاء عملية تأكيد الدمج (merge commit). +تبدو رسالة التأكيد (commit message) افتراضياً كالتالي: [source,console] ---- @@ -315,4 +315,4 @@ Conflicts: # ---- -If you think it would be helpful to others looking at this merge in the future, you can modify this commit message with details about how you resolved the merge and explain why you did the changes you made if these are not obvious. +إذا كنت تعتقد أنه سيكون من المفيد للآخرين الذين ينظرون إلى هذا الدمج في المستقبل، فيمكنك تعديل رسالة التأكيد (commit message) هذه مع تفاصيل حول كيفية حلك للدمج وشرح سبب إجرائك للتغييرات التي أجريتها إذا لم تكن واضحة. diff --git a/book/03-git-branching/sections/branch-management.asc b/book/03-git-branching/sections/branch-management.asc index ae81e89aa..d0646378f 100644 --- a/book/03-git-branching/sections/branch-management.asc +++ b/book/03-git-branching/sections/branch-management.asc @@ -1,11 +1,11 @@ [[_branch_management]] -=== Branch Management +=== Branch Management (إدارة الفروع) (((branches, managing))) -Now that you've created, merged, and deleted some branches, let's look at some branch-management tools that will come in handy when you begin using branches all the time. +الآن بعد أن قمت بإنشاء بعض الفروع ودمجها (merged) وحذفها، دعنا نلقي نظرة على بعض أدوات إدارة الفروع (branch-management tools) التي ستكون مفيدة عندما تبدأ في استخدام الفروع طوال الوقت. -The `git branch` command does more than just create and delete branches.(((git commands, branch))) -If you run it with no arguments, you get a simple listing of your current branches: +أمر `git branch` يفعل أكثر من مجرد إنشاء وحذف الفروع.(((git commands, branch))) +إذا قمت بتشغيله بدون أي وسيطات (arguments)، فستحصل على قائمة بسيطة لفروعك الحالية: [source,console] ---- @@ -15,9 +15,9 @@ $ git branch testing ---- -Notice the `*` character that prefixes the `master` branch: it indicates the branch that you currently have checked out (i.e., the branch that `HEAD` points to). -This means that if you commit at this point, the `master` branch will be moved forward with your new work. -To see the last commit on each branch, you can run `git branch -v`: +لاحظ حرف `*` الذي يسبق فرع `master`: إنه يشير إلى الفرع الذي قمت بسحبه (checked out) حالياً (أي الفرع الذي يشير إليه `HEAD`). +هذا يعني أنه إذا قمت بالتأكيد (commit) في هذه المرحلة، فسيتم تحريك فرع `master` للأمام مع عملك الجديد. +لرؤية آخر عملية تأكيد (last commit) على كل فرع، يمكنك تشغيل `git branch -v`: [source,console] ---- @@ -27,8 +27,8 @@ $ git branch -v testing 782fd34 Add scott to the author list in the readme ---- -The useful `--merged` and `--no-merged` options can filter this list to branches that you have or have not yet merged into the branch you're currently on. -To see which branches are already merged into the branch you're on, you can run `git branch --merged`: +الخيارات المفيدة `--merged` و `--no-merged` يمكنها تصفية (filter) هذه القائمة إلى الفروع التي قمت أو لم تقم بعد بدمجها (merged) في الفرع الذي تتواجد عليه حالياً. +لرؤية الفروع المدمجة بالفعل في الفرع الذي تتواجد عليه، يمكنك تشغيل `git branch --merged`: [source,console] ---- @@ -37,10 +37,10 @@ $ git branch --merged * master ---- -Because you already merged in `iss53` earlier, you see it in your list. -Branches on this list without the `*` in front of them are generally fine to delete with `git branch -d`; you've already incorporated their work into another branch, so you're not going to lose anything. +نظراً لأنك قمت بالفعل بدمج `iss53` في وقت سابق، فستراه في قائمتك. +الفروع الموجودة في هذه القائمة والتي لا يوجد أمامها `*` عادة ما يكون من الجيد حذفها باستخدام `git branch -d`؛ لقد قمت بالفعل بدمج عملها (incorporated their work) في فرع آخر، لذا لن تفقد أي شيء. -To see all the branches that contain work you haven't yet merged in, you can run `git branch --no-merged`: +لرؤية جميع الفروع التي تحتوي على عمل لم تقم بدمجه (merged in) بعد، يمكنك تشغيل `git branch --no-merged`: [source,console] ---- @@ -48,8 +48,8 @@ $ git branch --no-merged testing ---- -This shows your other branch. -Because it contains work that isn't merged in yet, trying to delete it with `git branch -d` will fail: +يوضح هذا فرعك الآخر. +نظراً لأنه يحتوي على عمل لم يتم دمجه بعد، فإن محاولة حذفه باستخدام `git branch -d` ستفشل: [source,console] ---- @@ -58,13 +58,13 @@ error: The branch 'testing' is not fully merged. If you are sure you want to delete it, run 'git branch -D testing'. ---- -If you really do want to delete the branch and lose that work, you can force it with `-D`, as the helpful message points out. +إذا كنت تريد حقاً حذف الفرع وفقدان ذلك العمل، يمكنك إجباره (force it) باستخدام `-D`، كما تشير الرسالة المفيدة. [TIP] ==== -The options described above, `--merged` and `--no-merged` will, if not given a commit or branch name as an argument, show you what is, respectively, merged or not merged into your _current_ branch. +الخيارات الموضحة أعلاه، `--merged` و `--no-merged`، إذا لم تُعطَ عملية تأكيد (commit) أو اسم فرع (branch name) كوسيطة (argument)، فستوضح لك ما هو مدمج أو غير مدمج، على التوالي، في فرعك _الحالي (current)_. -You can always provide an additional argument to ask about the merge state with respect to some other branch without checking that other branch out first, as in, what is not merged into the `master` branch? +يمكنك دائماً توفير وسيطة إضافية للسؤال عن حالة الدمج (merge state) فيما يتعلق ببعض الفروع الأخرى دون سحب (checking out) ذلك الفرع الآخر أولاً، كما في، ما هو غير المدمج في فرع `master`؟ [source,console] ---- $ git checkout testing @@ -74,34 +74,34 @@ $ git branch --no-merged master ---- ==== -==== Changing a branch name +==== Changing a branch name (تغيير اسم فرع) [CAUTION] ==== -Do not rename branches that are still in use by other collaborators. -Do not rename a branch like master/main/mainline without having read the section <<_changing_master>>. +لا تقم بإعادة تسمية (rename) الفروع التي لا تزال قيد الاستخدام من قبل المتعاونين الآخرين (other collaborators). +لا تقم بإعادة تسمية فرع مثل master/main/mainline دون قراءة القسم <<_changing_master>>. ==== -Suppose you have a branch that is called `bad-branch-name` and you want to change it to `corrected-branch-name`, while keeping all history. -You also want to change the branch name on the remote (GitHub, GitLab, other server). -How do you do this? +لنفترض أن لديك فرعاً يسمى `bad-branch-name` وتريد تغييره إلى `corrected-branch-name`، مع الاحتفاظ بجميع السجلات (history). +تريد أيضاً تغيير اسم الفرع على المستودع البعيد (remote) (GitHub أو GitLab أو أي خادم آخر). +كيف تفعل هذا؟ -Rename the branch locally with the `git branch --move` command: +أعد تسمية الفرع محلياً (locally) باستخدام أمر `git branch --move`: [source, console] ---- $ git branch --move bad-branch-name corrected-branch-name ---- -This replaces your `bad-branch-name` with `corrected-branch-name`, but this change is only local for now. -To let others see the corrected branch on the remote, push it: +يستبدل هذا `bad-branch-name` الخاص بك بـ `corrected-branch-name`، لكن هذا التغيير محلي فقط في الوقت الحالي. +للسماح للآخرين برؤية الفرع المصحح على المستودع البعيد، ادفعه (push it): [source,console] ---- $ git push --set-upstream origin corrected-branch-name ---- -Now we'll take a brief look at where we are now: +الآن سنلقي نظرة سريعة على أين نحن الآن: [source, console] ---- @@ -113,44 +113,44 @@ $ git branch --all remotes/origin/main ---- -Notice that you're on the branch `corrected-branch-name` and it's available on the remote. -However, the branch with the bad name is also still present there but you can delete it by executing the following command: +لاحظ أنك على الفرع `corrected-branch-name` وهو متاح على المستودع البعيد. +ومع ذلك، لا يزال الفرع ذو الاسم السيئ موجوداً هناك أيضاً، ولكن يمكنك حذفه (delete it) عن طريق تنفيذ الأمر التالي: [source,console] ---- $ git push origin --delete bad-branch-name ---- -Now the bad branch name is fully replaced with the corrected branch name. +الآن تم استبدال اسم الفرع السيئ بالكامل باسم الفرع المصحح. [[_changing_master]] -===== Changing the master branch name +===== Changing the master branch name (تغيير اسم فرع master) [WARNING] ==== -Changing the name of a branch like master/main/mainline/default will break the integrations, services, helper utilities and build/release scripts that your repository uses. -Before you do this, make sure you consult with your collaborators. -Also, make sure you do a thorough search through your repo and update any references to the old branch name in your code and scripts. +سيؤدي تغيير اسم فرع مثل master/main/mainline/default إلى كسر عمليات الدمج (integrations) والخدمات (services) والأدوات المساعدة (helper utilities) والبرامج النصية للبناء/الإصدار (build/release scripts) التي يستخدمها مستودعك. +قبل القيام بذلك، تأكد من التشاور مع المتعاونين (collaborators) معك. +تأكد أيضاً من إجراء بحث شامل في مستودعك وتحديث أي مراجع لاسم الفرع القديم في الكود (code) والبرامج النصية (scripts) الخاصة بك. ==== -Rename your local `master` branch into `main` with the following command: +أعد تسمية فرع `master` المحلي الخاص بك إلى `main` باستخدام الأمر التالي: [source,console] ---- $ git branch --move master main ---- -There's no local `master` branch anymore, because it's renamed to the `main` branch. +لم يعد هناك فرع `master` محلي، لأنه تم تغيير اسمه إلى فرع `main`. -To let others see the new `main` branch, you need to push it to the remote. -This makes the renamed branch available on the remote. +للسماح للآخرين برؤية فرع `main` الجديد، تحتاج إلى دفعه (push it) إلى المستودع البعيد (remote). +هذا يجعل الفرع المعاد تسميته (renamed branch) متاحاً على المستودع البعيد. [source,console] ---- $ git push --set-upstream origin main ---- -Now we end up with the following state: +الآن ننتهي بالحالة التالية: [source,console] ---- @@ -161,23 +161,23 @@ $ git branch --all remotes/origin/master ---- -Your local `master` branch is gone, as it's replaced with the `main` branch. -The `main` branch is present on the remote. -However, the old `master` branch is still present on the remote. -Other collaborators will continue to use the `master` branch as the base of their work, until you make some further changes. +لقد اختفى فرع `master` المحلي الخاص بك، حيث تم استبداله بفرع `main`. +فرع `main` موجود على المستودع البعيد (remote). +ومع ذلك، لا يزال فرع `master` القديم موجوداً على المستودع البعيد. +سيستمر المتعاونون (collaborators) الآخرون في استخدام فرع `master` كأساس لعملهم، حتى تقوم بإجراء بعض التغييرات الإضافية. -Now you have a few more tasks in front of you to complete the transition: +الآن أمامك بعض المهام الإضافية لإكمال الانتقال: -* Any projects that depend on this one will need to update their code and/or configuration. -* Update any test-runner configuration files. -* Adjust build and release scripts. -* Redirect settings on your repo host for things like the repo's default branch, merge rules, and other things that match branch names. -* Update references to the old branch in documentation. -* Close or merge any pull requests that target the old branch. +* أي مشاريع تعتمد على هذا المشروع ستحتاج إلى تحديث الكود الخاص بها و/أو التكوين (configuration). +* تحديث أي ملفات تكوين مشغل اختبار (test-runner configuration files). +* ضبط البرامج النصية للبناء والإصدار (build and release scripts). +* إعادة توجيه الإعدادات (Redirect settings) على مضيف مستودعك لأشياء مثل الفرع الافتراضي للمستودع (repo's default branch)، وقواعد الدمج (merge rules)، والأشياء الأخرى التي تتطابق مع أسماء الفروع. +* تحديث المراجع (references) للفرع القديم في الوثائق (documentation). +* إغلاق أو دمج أي طلبات سحب (pull requests) تستهدف الفرع القديم. -After you've done all these tasks, and are certain the `main` branch performs just as the `master` branch, you can delete the `master` branch: +بعد قيامك بكل هذه المهام، وتأكدك من أن فرع `main` يؤدي نفس أداء فرع `master` تماماً، يمكنك حذف (delete) فرع `master`: [source, console] ---- $ git push origin --delete master ----- +---- \ No newline at end of file diff --git a/book/03-git-branching/sections/nutshell.asc b/book/03-git-branching/sections/nutshell.asc index 2bffd5ddb..ad33b7fa2 100644 --- a/book/03-git-branching/sections/nutshell.asc +++ b/book/03-git-branching/sections/nutshell.asc @@ -1,15 +1,15 @@ [[_git_branches_overview]] -=== Branches in a Nutshell +=== Branches in a Nutshell (الفروع باختصار) -To really understand the way Git does branching, we need to take a step back and examine how Git stores its data. +للفهم الحقيقي للطريقة التي يقوم بها Git بالتفرع (branching)، نحتاج إلى أخذ خطوة للوراء وفحص كيفية تخزين Git لبياناته. -As you may remember from <>, Git doesn't store data as a series of changesets or differences, but instead as a series of _snapshots_. +كما تتذكر من <>، لا يخزن Git البيانات كسلسلة من مجموعات التغييرات (changesets) أو الاختلافات (differences)، بل كسلسلة من _اللقطات (snapshots)_. -When you make a commit, Git stores a commit object that contains a pointer to the snapshot of the content you staged. -This object also contains the author's name and email address, the message that you typed, and pointers to the commit or commits that directly came before this commit (its parent or parents): zero parents for the initial commit, one parent for a normal commit, and multiple parents for a commit that results from a merge of two or more branches. +عندما تقوم بعملية تأكيد (commit)، يقوم Git بتخزين كائن تأكيد (commit object) يحتوي على مؤشر (pointer) للقطة (snapshot) المحتوى الذي قمت بتجهيزه (staged). +يحتوي هذا الكائن أيضاً على اسم المؤلف وعنوان بريده الإلكتروني، والرسالة التي كتبتها، ومؤشرات (pointers) إلى عملية أو عمليات التأكيد التي جاءت مباشرة قبل عملية التأكيد هذه (الأصل أو الأصول - parent or parents): لا يوجد أصل (zero parents) لعملية التأكيد الأولية (initial commit)، أصل واحد (one parent) لعملية التأكيد العادية (normal commit)، وأصول متعددة (multiple parents) لعملية تأكيد ناتجة عن دمج (merge) فرعين أو أكثر. -To visualize this, let's assume that you have a directory containing three files, and you stage them all and commit. -Staging the files computes a checksum for each one (the SHA-1 hash we mentioned in <>), stores that version of the file in the Git repository (Git refers to them as _blobs_), and adds that checksum to the staging area: +لتصور ذلك، لنفترض أن لديك دليلاً يحتوي على ثلاثة ملفات، وتقوم بتجهيزها (stage) جميعاً وتأكيدها (commit). +تؤدي عملية تجهيز الملفات (Staging the files) إلى حساب اختبار المجموع (checksum) لكل منها (تجزئة SHA-1 التي ذكرناها في <>)، وتخزن هذا الإصدار من الملف في مستودع Git (يشير إليها Git باسم _blobs_)، وتضيف اختبار المجموع (checksum) هذا إلى منطقة التجهيز (staging area): [source,console] ---- @@ -17,65 +17,65 @@ $ git add README test.rb LICENSE $ git commit -m 'Initial commit' ---- -When you create the commit by running `git commit`, Git checksums each subdirectory (in this case, just the root project directory) and stores them as a tree object in the Git repository. -Git then creates a commit object that has the metadata and a pointer to the root project tree so it can re-create that snapshot when needed.(((git commands, commit))) +عندما تقوم بإنشاء عملية التأكيد (commit) عن طريق تشغيل `git commit`، يقوم Git بحساب اختبار المجموع (checksums) لكل دليل فرعي (في هذه الحالة، الدليل الجذري للمشروع فقط) ويخزنها ككائن شجرة (tree object) في مستودع Git. +ثم يقوم Git بإنشاء كائن تأكيد (commit object) يحتوي على البيانات الوصفية (metadata) ومؤشر (pointer) إلى شجرة المشروع الجذرية (root project tree) حتى يتمكن من إعادة إنشاء تلك اللقطة (snapshot) عند الحاجة.(((git commands, commit))) -Your Git repository now contains five objects: three _blobs_ (each representing the contents of one of the three files), one _tree_ that lists the contents of the directory and specifies which file names are stored as which blobs, and one _commit_ with the pointer to that root tree and all the commit metadata. +يحتوي مستودع Git الخاص بك الآن على خمسة كائنات: ثلاثة _blobs_ (يمثل كل منها محتويات أحد الملفات الثلاثة)، و_شجرة (tree)_ واحدة تسرد محتويات الدليل وتحدد أسماء الملفات المخزنة كـ blobs، و_عملية تأكيد (commit)_ واحدة مع المؤشر إلى تلك الشجرة الجذرية وجميع البيانات الوصفية للتأكيد (commit metadata). -.A commit and its tree +.A commit and its tree (عملية تأكيد وشجرتها) image::images/commit-and-tree.png[A commit and its tree] -If you make some changes and commit again, the next commit stores a pointer to the commit that came immediately before it. +إذا قمت بإجراء بعض التغييرات والتأكيد (commit) مرة أخرى، فإن عملية التأكيد التالية تخزن مؤشراً (pointer) إلى عملية التأكيد التي جاءت قبلها مباشرة. -.Commits and their parents +.Commits and their parents (عمليات التأكيد وأصولها) image::images/commits-and-parents.png[Commits and their parents] -A branch in Git is simply a lightweight movable pointer to one of these commits. -The default branch name in Git is `master`. -As you start making commits, you're given a `master` branch that points to the last commit you made. -Every time you commit, the `master` branch pointer moves forward automatically. +الفرع (branch) في Git هو ببساطة مؤشر متحرك (movable pointer) خفيف الوزن إلى إحدى عمليات التأكيد (commits) هذه. +اسم الفرع الافتراضي في Git هو `master`. +بمجرد أن تبدأ في إجراء عمليات التأكيد، يتم إعطاؤك فرع `master` يشير إلى آخر عملية تأكيد قمت بها. +في كل مرة تقوم فيها بالتأكيد (commit)، يتحرك مؤشر فرع `master` (master branch pointer) للأمام تلقائياً. [NOTE] ==== -The "`master`" branch in Git is not a special branch.(((master))) -It is exactly like any other branch. -The only reason nearly every repository has one is that the `git init` command creates it by default and most people don't bother to change it. +الفرع "`master`" في Git ليس فرعاً خاصاً.(((master))) +إنه يشبه تماماً أي فرع آخر. +السبب الوحيد لوجوده في كل مستودع تقريباً هو أن أمر `git init` ينشئه افتراضياً ولا يكلف معظم الناس أنفسهم عناء تغييره. ==== -.A branch and its commit history +.A branch and its commit history (فرع وسجل التأكيد الخاص به) image::images/branch-and-history.png[A branch and its commit history] [[_create_new_branch]] -==== Creating a New Branch +==== Creating a New Branch (إنشاء فرع جديد) (((branches, creating))) -What happens when you create a new branch? -Well, doing so creates a new pointer for you to move around. -Let's say you want to create a new branch called `testing`. -You do this with the `git branch` command:(((git commands, branch))) +ماذا يحدث عندما تقوم بإنشاء فرع جديد (new branch)؟ +حسناً، يؤدي القيام بذلك إلى إنشاء مؤشر جديد (new pointer) لك للتنقل. +لنفترض أنك تريد إنشاء فرع جديد يسمى `testing`. +تقوم بذلك باستخدام أمر `git branch`:(((git commands, branch))) [source,console] ---- $ git branch testing ---- -This creates a new pointer to the same commit you're currently on. +يؤدي هذا إلى إنشاء مؤشر جديد (new pointer) لنفس عملية التأكيد (commit) التي تتواجد عليها حالياً. -.Two branches pointing into the same series of commits +.Two branches pointing into the same series of commits (فرعان يشيران إلى نفس سلسلة عمليات التأكيد) image::images/two-branches.png[Two branches pointing into the same series of commits] -How does Git know what branch you're currently on? -It keeps a special pointer called `HEAD`. -Note that this is a lot different than the concept of `HEAD` in other VCSs you may be used to, such as Subversion or CVS. -In Git, this is a pointer to the local branch you're currently on. -In this case, you're still on `master`. -The `git branch` command only _created_ a new branch -- it didn't switch to that branch. +كيف يعرف Git الفرع الذي تتواجد عليه حالياً؟ +إنه يحتفظ بمؤشر خاص (special pointer) يسمى `HEAD`. +لاحظ أن هذا يختلف كثيراً عن مفهوم `HEAD` في أنظمة VCS (أنظمة التحكم في الإصدارات) الأخرى التي قد تكون معتاداً عليها، مثل Subversion أو CVS. +في Git، هذا مؤشر (pointer) إلى الفرع المحلي (local branch) الذي تتواجد عليه حالياً. +في هذه الحالة، لا تزال على `master`. +لم يقم أمر `git branch` إلا _بإنشاء_ فرع جديد -- ولم يقم بالتبديل (switch) إلى ذلك الفرع. -.HEAD pointing to a branch +.HEAD pointing to a branch (HEAD يشير إلى فرع) image::images/head-to-master.png[HEAD pointing to a branch] -You can easily see this by running a simple `git log` command that shows you where the branch pointers are pointing. -This option is called `--decorate`. +يمكنك رؤية ذلك بسهولة عن طريق تشغيل أمر `git log` بسيط يوضح لك إلى أين تشير مؤشرات الفروع (branch pointers). +يسمى هذا الخيار `--decorate`. [source,console] ---- @@ -85,27 +85,27 @@ f30ab (HEAD -> master, testing) Add feature #32 - ability to add new formats to 98ca9 Initial commit ---- -You can see the `master` and `testing` branches that are right there next to the `f30ab` commit. +يمكنك رؤية فرعي `master` و `testing` موجودين بجوار عملية التأكيد `f30ab` مباشرة. [[_switching_branches]] -==== Switching Branches +==== Switching Branches (تبديل الفروع) (((branches, switching))) -To switch to an existing branch, you run the `git checkout` command.(((git commands, checkout))) -Let's switch to the new `testing` branch: +للتبديل (switch) إلى فرع موجود، تقوم بتشغيل أمر `git checkout`.(((git commands, checkout))) +دعنا نبدل إلى فرع `testing` الجديد: [source,console] ---- $ git checkout testing ---- -This moves `HEAD` to point to the `testing` branch. +يؤدي هذا إلى تحريك `HEAD` للإشارة إلى فرع `testing`. -.HEAD points to the current branch +.HEAD points to the current branch (HEAD يشير إلى الفرع الحالي) image::images/head-to-testing.png[HEAD points to the current branch] -What is the significance of that? -Well, let's do another commit: +ما هي أهمية ذلك؟ +حسناً، دعنا نقم بعملية تأكيد (commit) أخرى: [source,console] ---- @@ -113,11 +113,11 @@ $ vim test.rb $ git commit -a -m 'Make a change' ---- -.The HEAD branch moves forward when a commit is made +.The HEAD branch moves forward when a commit is made (يتحرك فرع HEAD للأمام عند إجراء عملية تأكيد) image::images/advance-testing.png[The HEAD branch moves forward when a commit is made] -This is interesting, because now your `testing` branch has moved forward, but your `master` branch still points to the commit you were on when you ran `git checkout` to switch branches. -Let's switch back to the `master` branch: +هذا مثير للاهتمام، لأن فرع `testing` الخاص بك قد تحرك للأمام الآن، لكن فرع `master` الخاص بك لا يزال يشير إلى عملية التأكيد (commit) التي كنت عليها عندما قمت بتشغيل `git checkout` لتبديل الفروع (switch branches). +دعنا نبدل مرة أخرى إلى فرع `master`: [source,console] ---- @@ -125,34 +125,34 @@ $ git checkout master ---- [NOTE] -.`git log` doesn't show _all_ the branches _all_ the time +.`git log` doesn't show _all_ the branches _all_ the time (`git log` لا يظهر _جميع_ الفروع _طوال_ الوقت) ==== -If you were to run `git log` right now, you might wonder where the "testing" branch you just created went, as it would not appear in the output. +إذا كنت ستقوم بتشغيل `git log` الآن، فقد تتساءل أين ذهب فرع "testing" الذي أنشأته للتو، لأنه لن يظهر في المخرجات. -The branch hasn't disappeared; Git just doesn't know that you're interested in that branch and it is trying to show you what it thinks you're interested in. -In other words, by default, `git log` will only show commit history below the branch you've checked out. +لم يختف الفرع؛ لا يعلم Git فقط أنك مهتم بذلك الفرع ويحاول أن يعرض لك ما يعتقد أنك مهتم به. +بعبارة أخرى، بشكل افتراضي، سيُظهر `git log` سجل التأكيد (commit history) الموجود أسفل الفرع الذي قمت بسحبه (checked out) فقط. -To show commit history for the desired branch you have to explicitly specify it: `git log testing`. -To show all of the branches, add `--all` to your `git log` command. +لإظهار سجل التأكيد للفرع المطلوب، يجب عليك تحديده صراحة: `git log testing`. +لإظهار جميع الفروع، أضف `--all` إلى أمر `git log` الخاص بك. ==== -.HEAD moves when you checkout +.HEAD moves when you checkout (يتحرك HEAD عند السحب) image::images/checkout-master.png[HEAD moves when you checkout] -That command did two things. -It moved the HEAD pointer back to point to the `master` branch, and it reverted the files in your working directory back to the snapshot that `master` points to. -This also means the changes you make from this point forward will diverge from an older version of the project. -It essentially rewinds the work you've done in your `testing` branch so you can go in a different direction. +قام هذا الأمر بشيئين. +لقد أعاد مؤشر `HEAD` (HEAD pointer) للإشارة إلى فرع `master`، وأعاد الملفات (reverted the files) في دليل العمل الخاص بك (working directory) إلى اللقطة (snapshot) التي يشير إليها `master`. +وهذا يعني أيضاً أن التغييرات التي تجريها من هذه النقطة فصاعداً سوف تنحرف (diverge) عن إصدار أقدم من المشروع. +إنه في الأساس يعيد (rewinds) العمل الذي قمت به في فرع `testing` الخاص بك حتى تتمكن من الذهاب في اتجاه مختلف. [NOTE] -.Switching branches changes files in your working directory +.Switching branches changes files in your working directory (تبديل الفروع يغير الملفات في دليل العمل الخاص بك) ==== -It's important to note that when you switch branches in Git, files in your working directory will change. -If you switch to an older branch, your working directory will be reverted to look like it did the last time you committed on that branch. -If Git cannot do it cleanly, it will not let you switch at all. +من المهم ملاحظة أنه عند تبديل الفروع (switch branches) في Git، ستتغير الملفات الموجودة في دليل العمل الخاص بك (working directory). +إذا قمت بالتبديل إلى فرع أقدم (older branch)، فسيتم إرجاع (reverted) دليل العمل الخاص بك ليبدو كما كان في آخر مرة قمت فيها بالتأكيد (committed) على ذلك الفرع. +إذا لم يتمكن Git من القيام بذلك بشكل نظيف، فلن يسمح لك بالتبديل على الإطلاق. ==== -Let's make a few changes and commit again: +دعنا نقم ببعض التغييرات والتأكيد (commit) مرة أخرى: [source,console] ---- @@ -160,17 +160,17 @@ $ vim test.rb $ git commit -a -m 'Make other changes' ---- -Now your project history has diverged (see <>). -You created and switched to a branch, did some work on it, and then switched back to your main branch and did other work. -Both of those changes are isolated in separate branches: you can switch back and forth between the branches and merge them together when you're ready. -And you did all that with simple `branch`, `checkout`, and `commit` commands. +لقد انحرف (diverged) سجل مشروعك الآن (انظر <>). +لقد قمت بإنشاء فرع (branch) والتبديل إليه، وقمت ببعض العمل عليه، ثم عدت مرة أخرى إلى فرعك الرئيسي (main branch) وقمت بعمل آخر. +يتم عزل كلا هذين التغييرين في فروع منفصلة (separate branches): يمكنك التبديل (switch) ذهاباً وإياباً بين الفروع ودمجها (merge them) معاً عندما تكون جاهزاً. +وقد قمت بكل ذلك بأوامر `branch` و `checkout` و `commit` بسيطة. [[divergent_history]] -.Divergent history +.Divergent history (سجل منحرف) image::images/advance-master.png[Divergent history] -You can also see this easily with the `git log` command. -If you run `git log --oneline --decorate --graph --all` it will print out the history of your commits, showing where your branch pointers are and how your history has diverged. +يمكنك أيضاً رؤية هذا بسهولة باستخدام أمر `git log`. +إذا قمت بتشغيل `git log --oneline --decorate --graph --all` فسيقوم بطباعة سجل عمليات التأكيد (commits) الخاصة بك، موضحاً مكان تواجد مؤشرات الفروع (branch pointers) الخاصة بك وكيف انحرف (diverged) سجلك. [source,console] ---- @@ -183,28 +183,28 @@ $ git log --oneline --decorate --graph --all * 98ca9 Initial commit of my project ---- -Because a branch in Git is actually a simple file that contains the 40 character SHA-1 checksum of the commit it points to, branches are cheap to create and destroy. -Creating a new branch is as quick and simple as writing 41 bytes to a file (40 characters and a newline). +نظراً لأن الفرع (branch) في Git هو في الواقع ملف بسيط يحتوي على تجزئة SHA-1 (SHA-1 checksum) المكونة من 40 حرفاً لعملية التأكيد (commit) التي يشير إليها، فإن الفروع رخيصة الإنشاء والتدمير (cheap to create and destroy). +إنشاء فرع جديد سريع وبسيط مثل كتابة 41 بايت في ملف (40 حرفاً وسطراً جديداً). -This is in sharp contrast to the way most older VCS tools branch, which involves copying all of the project's files into a second directory. -This can take several seconds or even minutes, depending on the size of the project, whereas in Git the process is always instantaneous. -Also, because we're recording the parents when we commit, finding a proper merge base for merging is automatically done for us and is generally very easy to do. -These features help encourage developers to create and use branches often. +يتناقض هذا بشكل حاد مع طريقة تفرع (branch) معظم أدوات VCS القديمة، والتي تتضمن نسخ جميع ملفات المشروع في دليل ثانٍ. +يمكن أن يستغرق هذا عدة ثوانٍ أو حتى دقائق، اعتماداً على حجم المشروع، في حين أن العملية في Git تكون دائماً فورية (instantaneous). +أيضاً، نظراً لأننا نسجل الأصول (parents) عند التأكيد (commit)، فإن العثور على قاعدة دمج مناسبة (proper merge base) للدمج (merging) يتم تلقائياً بالنسبة لنا وعادة ما يكون من السهل جداً القيام به. +تساعد هذه الميزات في تشجيع المطورين على إنشاء الفروع واستخدامها بشكل متكرر. -Let's see why you should do so. +دعنا نرى لماذا يجب عليك القيام بذلك. [NOTE] -.Creating a new branch and switching to it at the same time +.Creating a new branch and switching to it at the same time (إنشاء فرع جديد والتبديل إليه في نفس الوقت) ==== -It's typical to create a new branch and want to switch to that new branch at the same time -- this can be done in one operation with `git checkout -b `. +من المعتاد إنشاء فرع جديد (new branch) والرغبة في التبديل (switch) إلى ذلك الفرع الجديد في نفس الوقت -- يمكن القيام بذلك في عملية واحدة (one operation) باستخدام `git checkout -b `. ==== [NOTE] ==== -From Git version 2.23 onwards you can use `git switch` instead of `git checkout` to: +بدءاً من إصدار Git 2.23 فصاعداً يمكنك استخدام `git switch` بدلاً من `git checkout` من أجل: -- Switch to an existing branch: `git switch testing-branch`. -- Create a new branch and switch to it: `git switch -c new-branch`. - The `-c` flag stands for create, you can also use the full flag: `--create`. -- Return to your previously checked out branch: `git switch -`. -==== +- التبديل إلى فرع موجود: `git switch testing-branch`. +- إنشاء فرع جديد والتبديل إليه: `git switch -c new-branch`. + ترمز العلامة `-c` إلى create (إنشاء)، ويمكنك أيضاً استخدام العلامة الكاملة: `--create`. +- العودة إلى فرعك الذي تم سحبه مسبقاً (previously checked out branch): `git switch -`. +==== \ No newline at end of file diff --git a/book/03-git-branching/sections/rebasing.asc b/book/03-git-branching/sections/rebasing.asc index c66535246..a79fdcd28 100644 --- a/book/03-git-branching/sections/rebasing.asc +++ b/book/03-git-branching/sections/rebasing.asc @@ -1,29 +1,29 @@ [[_rebasing]] -=== Rebasing +=== Rebasing (إعادة التأسيس) (((rebasing))) -In Git, there are two main ways to integrate changes from one branch into another: the `merge` and the `rebase`. -In this section you'll learn what rebasing is, how to do it, why it's a pretty amazing tool, and in what cases you won't want to use it. +في Git، هناك طريقتان رئيسيتان لدمج التغييرات من فرع إلى آخر: `merge` (الدمج) و `rebase` (إعادة التأسيس). +في هذا القسم، ستتعلم ما هي إعادة التأسيس (rebasing)، وكيفية القيام بها، ولماذا هي أداة رائعة، وفي أي الحالات لن ترغب في استخدامها. -==== The Basic Rebase +==== The Basic Rebase (إعادة التأسيس الأساسية) -If you go back to an earlier example from <<_basic_merging>>, you can see that you diverged your work and made commits on two different branches. +إذا عدت إلى مثال سابق من <<_basic_merging>>، يمكنك أن ترى أنك قد انحرفت بعملك وأجريت عمليات تأكيد (commits) على فرعين مختلفين. -.Simple divergent history +.Simple divergent history (سجل منحرف بسيط) image::images/basic-rebase-1.png[Simple divergent history] -The easiest way to integrate the branches, as we've already covered, is the `merge` command. -It performs a three-way merge between the two latest branch snapshots (`C3` and `C4`) and the most recent common ancestor of the two (`C2`), creating a new snapshot (and commit). +أسهل طريقة لدمج (integrate) الفروع، كما غطينا بالفعل، هي أمر `merge`. +يقوم بإجراء دمج ثلاثي الاتجاهات (three-way merge) بين آخر لقطتين (snapshots) للفرعين (`C3` و `C4`) وأحدث سلف مشترك (common ancestor) للاثنين (`C2`)، مما يخلق لقطة جديدة (وعملية تأكيد). [[rebasing-merging-example]] -.Merging to integrate diverged work history +.Merging to integrate diverged work history (الدمج لتكامل سجل العمل المنحرف) image::images/basic-rebase-2.png[Merging to integrate diverged work history] -However, there is another way: you can take the patch of the change that was introduced in `C4` and reapply it on top of `C3`. -In Git, this is called _rebasing_. -With the `rebase` command, you can take all the changes that were committed on one branch and replay them on a different branch.(((git commands, rebase))) +ومع ذلك، هناك طريقة أخرى: يمكنك أخذ التصحيح (patch) للتغيير الذي تم إدخاله في `C4` وإعادة تطبيقه (reapply it) فوق `C3`. +في Git، يُطلق على هذا اسم _إعادة التأسيس (rebasing)_. +باستخدام أمر `rebase`، يمكنك أخذ جميع التغييرات التي تم تأكيدها (committed) على فرع واحد وإعادة تشغيلها (replay them) على فرع مختلف.(((git commands, rebase))) -For this example, you would check out the `experiment` branch, and then rebase it onto the `master` branch as follows: +في هذا المثال، ستقوم بسحب (check out) فرع `experiment`، ثم تعيد تأسيسه (rebase it) على فرع `master` كالتالي: [source,console] ---- @@ -33,12 +33,12 @@ First, rewinding head to replay your work on top of it... Applying: added staged command ---- -This operation works by going to the common ancestor of the two branches (the one you're on and the one you're rebasing onto), getting the diff introduced by each commit of the branch you're on, saving those diffs to temporary files, resetting the current branch to the same commit as the branch you are rebasing onto, and finally applying each change in turn. +تعمل هذه العملية من خلال الانتقال إلى السلف المشترك (common ancestor) للفرعين (الذي تتواجد عليه والذي تقوم بإعادة التأسيس عليه)، والحصول على الاختلاف (diff) الذي تم إدخاله بواسطة كل عملية تأكيد للفرع الذي تتواجد عليه، وحفظ تلك الاختلافات (diffs) في ملفات مؤقتة (temporary files)، وإعادة تعيين (resetting) الفرع الحالي لنفس عملية التأكيد الخاصة بالفرع الذي تقوم بإعادة التأسيس عليه، وأخيراً تطبيق كل تغيير (applying each change) بدوره. -.Rebasing the change introduced in `C4` onto `C3` +.Rebasing the change introduced in `C4` onto `C3` (إعادة تأسيس التغيير المدخل في `C4` فوق `C3`) image::images/basic-rebase-3.png[Rebasing the change introduced in `C4` onto `C3`] -At this point, you can go back to the `master` branch and do a fast-forward merge. +في هذه المرحلة، يمكنك العودة إلى فرع `master` وإجراء عملية دمج تقديم سريع (fast-forward merge). [source,console] ---- @@ -46,47 +46,47 @@ $ git checkout master $ git merge experiment ---- -.Fast-forwarding the `master` branch +.Fast-forwarding the `master` branch (التقديم السريع لفرع `master`) image::images/basic-rebase-4.png[Fast-forwarding the `master` branch] -Now, the snapshot pointed to by `C4'` is exactly the same as the one that was pointed to by `C5` in <>. -There is no difference in the end product of the integration, but rebasing makes for a cleaner history. -If you examine the log of a rebased branch, it looks like a linear history: it appears that all the work happened in series, even when it originally happened in parallel. +الآن، اللقطة (snapshot) التي يشير إليها `C4'` مطابقة تماماً لتلك التي كان يشير إليها `C5` في مثال الدمج (merge example). +لا يوجد فرق في المنتج النهائي (end product) للدمج، لكن إعادة التأسيس (rebasing) توفر سجلاً أنظف (cleaner history). +إذا فحصت سجل (log) فرع تمت إعادة تأسيسه (rebased branch)، فسيبدو كسجل خطي (linear history): يبدو أن كل العمل حدث بالتسلسل (in series)، حتى وإن كان قد حدث في الأصل بالتوازي (in parallel). -Often, you'll do this to make sure your commits apply cleanly on a remote branch -- perhaps in a project to which you're trying to contribute but that you don't maintain. -In this case, you'd do your work in a branch and then rebase your work onto `origin/master` when you were ready to submit your patches to the main project. -That way, the maintainer doesn't have to do any integration work -- just a fast-forward or a clean apply. +غالباً، ستفعل ذلك للتأكد من أن عمليات التأكيد (commits) الخاصة بك تُطبق بشكل نظيف (apply cleanly) على فرع بعيد (remote branch) -- ربما في مشروع تحاول المساهمة فيه ولكنك لا تديره. +في هذه الحالة، ستقوم بعملك في فرع ثم تقوم بإعادة تأسيس (rebase) عملك على `origin/master` عندما تكون مستعداً لتقديم تصحيحاتك (patches) إلى المشروع الرئيسي. +بهذه الطريقة، لن يضطر المشرف (maintainer) للقيام بأي عمل دمج (integration work) -- مجرد تقديم سريع (fast-forward) أو تطبيق نظيف (clean apply). -Note that the snapshot pointed to by the final commit you end up with, whether it's the last of the rebased commits for a rebase or the final merge commit after a merge, is the same snapshot -- it's only the history that is different. -Rebasing replays changes from one line of work onto another in the order they were introduced, whereas merging takes the endpoints and merges them together. +لاحظ أن اللقطة (snapshot) التي تشير إليها عملية التأكيد النهائية (final commit) التي تنتهي بها، سواء كانت الأخيرة من عمليات التأكيد المعاد تأسيسها لعملية إعادة تأسيس (rebase) أو عملية تأكيد الدمج النهائية (final merge commit) بعد عملية الدمج (merge)، هي نفس اللقطة -- فقط السجل (history) هو الذي يختلف. +تقوم إعادة التأسيس (Rebasing) بإعادة تشغيل (replays) التغييرات من خط عمل إلى آخر بالترتيب الذي تم إدخالها به، بينما يأخذ الدمج (merging) نقاط النهاية (endpoints) ويدمجها معاً. -==== More Interesting Rebases +==== More Interesting Rebases (عمليات إعادة تأسيس أكثر إثارة للاهتمام) -You can also have your rebase replay on something other than the rebase target branch. -Take a history like <>, for example. -You branched a topic branch (`server`) to add some server-side functionality to your project, and made a commit. -Then, you branched off that to make the client-side changes (`client`) and committed a few times. -Finally, you went back to your `server` branch and did a few more commits. +يمكنك أيضاً أن تجعل إعادة التأسيس (rebase) الخاصة بك تعيد التشغيل (replay) على شيء آخر غير فرع إعادة التأسيس. +خذ سجلاً مثل <>، على سبيل المثال. +لقد قمت بتفرع فرع موضوع (topic branch) (`server`) لإضافة بعض وظائف جانب الخادم (server-side functionality) إلى مشروعك، وقمت بعملية تأكيد (commit). +بعد ذلك، تفرعت (branched off) من ذلك لإجراء تغييرات جانب العميل (client-side changes) (`client`) وقمت بالتأكيد عدة مرات. +أخيراً، عدت إلى فرع `server` الخاص بك وقمت ببعض عمليات التأكيد الإضافية. [[rbdiag_e]] -.A history with a topic branch off another topic branch +.A history with a topic branch off another topic branch (سجل بفرع موضوع متفرع من فرع موضوع آخر) image::images/interesting-rebase-1.png[A history with a topic branch off another topic branch] -Suppose you decide that you want to merge your client-side changes into your mainline for a release, but you want to hold off on the server-side changes until it's tested further. -You can take the changes on `client` that aren't on `server` (`C8` and `C9`) and replay them on your `master` branch by using the `--onto` option of `git rebase`: +لنفترض أنك قررت أنك تريد دمج (merge) تغييرات جانب العميل في خطك الرئيسي (mainline) لإصدار (release)، لكنك تريد تأجيل تغييرات جانب الخادم حتى يتم اختبارها بشكل أكبر. +يمكنك أخذ التغييرات في `client` غير الموجودة في `server` (`C8` و `C9`) وإعادة تشغيلها (replay them) على فرع `master` الخاص بك باستخدام الخيار `--onto` من `git rebase`: [source,console] ---- $ git rebase --onto master server client ---- -This basically says, "`Take the `client` branch, figure out the patches since it diverged from the `server` branch, and replay these patches in the `client` branch as if it was based directly off the `master` branch instead.`" -It's a bit complex, but the result is pretty cool. +هذا يعني بشكل أساسي، "`خذ فرع `client`، واكتشف التصحيحات (patches) منذ انحرافه (diverged) عن فرع `server`، وأعد تشغيل (replay) هذه التصحيحات في فرع `client` كما لو كانت مبنية مباشرة على فرع `master` بدلاً من ذلك.`" +الأمر معقد بعض الشيء، لكن النتيجة رائعة جداً. -.Rebasing a topic branch off another topic branch +.Rebasing a topic branch off another topic branch (إعادة تأسيس فرع موضوع متفرع من فرع موضوع آخر) image::images/interesting-rebase-2.png[Rebasing a topic branch off another topic branch] -Now you can fast-forward your `master` branch (see <>): +الآن يمكنك تقديم فرع `master` الخاص بك تقديماً سريعاً (fast-forward) (انظر <>): [source,console] ---- @@ -95,24 +95,24 @@ $ git merge client ---- [[rbdiag_g]] -.Fast-forwarding your `master` branch to include the `client` branch changes +.Fast-forwarding your `master` branch to include the `client` branch changes (التقديم السريع لفرع `master` لتضمين تغييرات فرع `client`) image::images/interesting-rebase-3.png[Fast-forwarding your `master` branch to include the `client` branch changes] -Let's say you decide to pull in your `server` branch as well. -You can rebase the `server` branch onto the `master` branch without having to check it out first by running `git rebase ` -- which checks out the topic branch (in this case, `server`) for you and replays it onto the base branch (`master`): +لنفترض أنك قررت سحب (pull in) فرع `server` الخاص بك أيضاً. +يمكنك إعادة تأسيس (rebase) فرع `server` على فرع `master` دون الحاجة إلى سحبه (check it out) أولاً عن طريق تشغيل `git rebase ` -- والذي يسحب فرع الموضوع (في هذه الحالة، `server`) لك ويعيد تشغيله (replays it) على الفرع الأساسي (base branch) (`master`): [source,console] ---- $ git rebase master server ---- -This replays your `server` work on top of your `master` work, as shown in <>. +يعيد هذا تشغيل (replays) عمل `server` الخاص بك فوق عمل `master` الخاص بك، كما هو موضح في <>. [[rbdiag_h]] -.Rebasing your `server` branch on top of your `master` branch +.Rebasing your `server` branch on top of your `master` branch (إعادة تأسيس فرع `server` فوق فرع `master`) image::images/interesting-rebase-4.png[Rebasing your `server` branch on top of your `master` branch] -Then, you can fast-forward the base branch (`master`): +بعد ذلك، يمكنك التقديم السريع (fast-forward) للفرع الأساسي (base branch) (`master`): [source,console] ---- @@ -120,7 +120,7 @@ $ git checkout master $ git merge server ---- -You can remove the `client` and `server` branches because all the work is integrated and you don't need them anymore, leaving your history for this entire process looking like <>: +يمكنك إزالة فرعي `client` و `server` لأن كل العمل تم دمجه ولم تعد بحاجة إليهما، مما يترك السجل (history) لهذه العملية بأكملها يبدو كما في <>: [source,console] ---- @@ -129,112 +129,112 @@ $ git branch -d server ---- [[rbdiag_i]] -.Final commit history +.Final commit history (سجل التأكيد النهائي) image::images/interesting-rebase-5.png[Final commit history] [[_rebase_peril]] -==== The Perils of Rebasing +==== The Perils of Rebasing (مخاطر إعادة التأسيس) (((rebasing, perils of))) -Ahh, but the bliss of rebasing isn't without its drawbacks, which can be summed up in a single line: +آه، لكن نعيم إعادة التأسيس (rebasing) ليس خالياً من عيوبه، والتي يمكن تلخيصها في سطر واحد: -*Do not rebase commits that exist outside your repository and that people may have based work on.* +*لا تقم بإعادة تأسيس عمليات التأكيد (commits) الموجودة خارج مستودعك والتي قد يكون الناس قد بنوا عملاً عليها.* -If you follow that guideline, you'll be fine. -If you don't, people will hate you, and you'll be scorned by friends and family. +إذا اتبعت هذا الدليل الإرشادي، فستكون بخير. +إذا لم تفعل، فسيكرهك الناس، وستتعرض للازدراء من الأصدقاء والعائلة. -When you rebase stuff, you're abandoning existing commits and creating new ones that are similar but different. -If you push commits somewhere and others pull them down and base work on them, and then you rewrite those commits with `git rebase` and push them up again, your collaborators will have to re-merge their work and things will get messy when you try to pull their work back into yours. +عندما تقوم بإعادة تأسيس الأشياء (rebase stuff)، فأنت تتخلى عن عمليات التأكيد الحالية وتنشئ عمليات جديدة مماثلة ولكن مختلفة. +إذا دفعت (push) عمليات التأكيد إلى مكان ما وقام الآخرون بسحبها وبنوا عملاً عليها، ثم أعدت كتابة تلك عمليات التأكيد باستخدام `git rebase` ودفعتها مرة أخرى، فسيضطر المتعاونون (collaborators) إلى إعادة دمج (re-merge) عملهم وستصبح الأمور فوضوية عندما تحاول سحب عملهم مرة أخرى إلى عملك. -Let's look at an example of how rebasing work that you've made public can cause problems. -Suppose you clone from a central server and then do some work off that. -Your commit history looks like this: +دعنا نلقي نظرة على مثال حول كيف يمكن أن يسبب إعادة تأسيس العمل الذي جعلته عاماً مشاكل. +لنفترض أنك قمت بالاستنساخ (clone) من خادم مركزي ثم قمت ببعض العمل بناءً عليه. +يبدو سجل التأكيد (commit history) الخاص بك كالتالي: -.Clone a repository, and base some work on it +.Clone a repository, and base some work on it (استنساخ مستودع وبناء عمل عليه) image::images/perils-of-rebasing-1.png["Clone a repository, and base some work on it"] -Now, someone else does more work that includes a merge, and pushes that work to the central server. -You fetch it and merge the new remote branch into your work, making your history look something like this: +الآن، يقوم شخص آخر بمزيد من العمل يتضمن دمجاً (merge)، ويدفع ذلك العمل إلى الخادم المركزي. +تقوم بجلبه (fetch) ودمج الفرع البعيد الجديد في عملك، مما يجعل سجلك يبدو كالتالي: -.Fetch more commits, and merge them into your work +.Fetch more commits, and merge them into your work (جلب مزيد من عمليات التأكيد ودمجها في عملك) image::images/perils-of-rebasing-2.png["Fetch more commits, and merge them into your work"] -Next, the person who pushed the merged work decides to go back and rebase their work instead; they do a `git push --force` to overwrite the history on the server. -You then fetch from that server, bringing down the new commits. +بعد ذلك، يقرر الشخص الذي دفع العمل المدمج العودة وإعادة تأسيس عمله بدلاً من ذلك؛ فيقوم بـ `git push --force` لإعادة كتابة السجل (history) على الخادم. +ثم تقوم بالجلب (fetch) من ذلك الخادم، واسترداد عمليات التأكيد الجديدة. [[_pre_merge_rebase_work]] -.Someone pushes rebased commits, abandoning commits you've based your work on +.Someone pushes rebased commits, abandoning commits you've based your work on (شخص يدفع عمليات تأكيد معاد تأسيسها، متخلياً عن عمليات التأكيد التي بنيت عملك عليها) image::images/perils-of-rebasing-3.png["Someone pushes rebased commits, abandoning commits you've based your work on"] -Now you're both in a pickle. -If you do a `git pull`, you'll create a merge commit which includes both lines of history, and your repository will look like this: +أصبح الوضع الآن بالغ الصعوبة. +إذا أجريت `git pull`، فستنشئ عملية تأكيد دمج (merge commit) تتضمن خطي السجل (history) كليهما، وسيبدو مستودعك كالتالي: [[_merge_rebase_work]] -.You merge in the same work again into a new merge commit +.You merge in the same work again into a new merge commit (تقوم بدمج نفس العمل مرة أخرى في عملية تأكيد دمج جديدة) image::images/perils-of-rebasing-4.png[You merge in the same work again into a new merge commit] -If you run a `git log` when your history looks like this, you'll see two commits that have the same author, date, and message, which will be confusing. -Furthermore, if you push this history back up to the server, you'll reintroduce all those rebased commits to the central server, which can further confuse people. -It's pretty safe to assume that the other developer doesn't want `C4` and `C6` to be in the history; that's why they rebased in the first place. +إذا أجريت `git log` عندما يبدو سجلك كهذا، سترى عمليتي تأكيد لهما نفس المؤلف (author) والتاريخ (date) والرسالة (message)، مما سيكون مربكاً. +علاوة على ذلك، إذا دفعت هذا السجل مرة أخرى إلى الخادم، فستعيد إدخال جميع تلك عمليات التأكيد المعاد تأسيسها إلى الخادم المركزي، مما قد يزيد من ارتباك الناس. +من الآمن جداً افتراض أن المطور الآخر لا يريد أن يكون `C4` و `C6` في السجل؛ هذا هو السبب في أنهم أجروا إعادة التأسيس في المقام الأول. [[_rebase_rebase]] -==== Rebase When You Rebase +==== Rebase When You Rebase (إعادة التأسيس عند إعادة التأسيس) -If you *do* find yourself in a situation like this, Git has some further magic that might help you out. -If someone on your team force pushes changes that overwrite work that you've based work on, your challenge is to figure out what is yours and what they've rewritten. +إذا وجدت نفسك *فعلاً* في موقف كهذا، فإن Git لديه بعض السحر الإضافي الذي قد يساعدك. +إذا قام شخص ما في فريقك بدفع قسري (force push) لتغييرات تستبدل العمل الذي بنيت عملك عليه، فإن تحديك هو معرفة ما هو لك وما الذي أعادوا كتابته. -It turns out that in addition to the commit SHA-1 checksum, Git also calculates a checksum that is based just on the patch introduced with the commit. -This is called a "`patch-id`". +اتضح أنه بالإضافة إلى مجموع التحقق (checksum) SHA-1 لعملية التأكيد، يحسب Git أيضاً مجموع تحقق يعتمد فقط على التصحيح (patch) المقدم مع عملية التأكيد. +يُسمى هذا بـ "`معرّف التصحيح (patch-id)`". -If you pull down work that was rewritten and rebase it on top of the new commits from your partner, Git can often successfully figure out what is uniquely yours and apply them back on top of the new branch. +إذا قمت بسحب عمل أعيدت كتابته وإعادة تأسيسه فوق عمليات التأكيد الجديدة من شريكك، فإن Git يستطيع في كثير من الأحيان تحديد ما هو فريد من نوعه لك وتطبيقه مرة أخرى فوق الفرع الجديد. -For instance, in the previous scenario, if instead of doing a merge when we're at <<_pre_merge_rebase_work>> we run `git rebase teamone/master`, Git will: +على سبيل المثال، في السيناريو السابق، إذا بدلاً من إجراء دمج عندما نكون في <<_pre_merge_rebase_work>> قمنا بتشغيل `git rebase teamone/master`، فسيقوم Git بما يلي: -* Determine what work is unique to our branch (`C2`, `C3`, `C4`, `C6`, `C7`) -* Determine which are not merge commits (`C2`, `C3`, `C4`) -* Determine which have not been rewritten into the target branch (just `C2` and `C3`, since `C4` is the same patch as `C4'`) -* Apply those commits to the top of `teamone/master` +* تحديد ما هو فريد لفرعنا (`C2` و `C3` و `C4` و `C6` و `C7`) +* تحديد أيها ليست عمليات تأكيد دمج (merge commits) (`C2` و `C3` و `C4`) +* تحديد أيها لم تتم إعادة كتابتها في الفرع المستهدف (فقط `C2` و `C3`، لأن `C4` هو نفس التصحيح مثل `C4'`) +* تطبيق تلك عمليات التأكيد فوق `teamone/master` -So instead of the result we see in <<_merge_rebase_work>>, we would end up with something more like <<_rebase_rebase_work>>. +لذا بدلاً من النتيجة التي نراها في <<_merge_rebase_work>>، سننتهي بشيء أشبه بـ <<_rebase_rebase_work>>. [[_rebase_rebase_work]] -.Rebase on top of force-pushed rebase work +.Rebase on top of force-pushed rebase work (إعادة التأسيس فوق عمل إعادة التأسيس المدفوع قسراً) image::images/perils-of-rebasing-5.png[Rebase on top of force-pushed rebase work] -This only works if `C4` and `C4'` that your partner made are almost exactly the same patch. -Otherwise the rebase won't be able to tell that it's a duplicate and will add another `C4`-like patch (which will probably fail to apply cleanly, since the changes would already be at least somewhat there). +هذا يعمل فقط إذا كان `C4` و `C4'` اللذان أنشأهما شريكك متطابقَين تقريباً كنفس التصحيح. +وإلا، فلن تستطيع إعادة التأسيس معرفة أنه نسخة مكررة وستضيف تصحيحاً آخر مشابهاً لـ `C4` (والذي ستفشل على الأرجح في التطبيق بشكل نظيف، لأن التغييرات ستكون موجودة جزئياً على الأقل بالفعل). -You can also simplify this by running a `git pull --rebase` instead of a normal `git pull`. -Or you could do it manually with a `git fetch` followed by a `git rebase teamone/master` in this case. +يمكنك أيضاً تبسيط ذلك عن طريق تشغيل `git pull --rebase` بدلاً من `git pull` العادي. +أو يمكنك القيام بذلك يدوياً باستخدام `git fetch` متبوعاً بـ `git rebase teamone/master` في هذه الحالة. -If you are using `git pull` and want to make `--rebase` the default, you can set the `pull.rebase` config value with something like `git config --global pull.rebase true`. +إذا كنت تستخدم `git pull` وتريد جعل `--rebase` الخيار الافتراضي، فيمكنك تعيين قيمة التهيئة (config value) `pull.rebase` بشيء مثل `git config --global pull.rebase true`. -If you only ever rebase commits that have never left your own computer, you'll be just fine. -If you rebase commits that have been pushed, but that no one else has based commits from, you'll also be fine. -If you rebase commits that have already been pushed publicly, and people may have based work on those commits, then you may be in for some frustrating trouble, and the scorn of your teammates. +إذا كنت تقوم بإعادة تأسيس عمليات تأكيد لم تغادر جهاز الكمبيوتر الخاص بك قط، فستكون بخير تماماً. +إذا أعدت تأسيس عمليات تأكيد تم دفعها، ولكن لم يبنِ أحد عمليات تأكيد منها، فستكون أيضاً بخير. +إذا أعدت تأسيس عمليات تأكيد تم دفعها بشكل عام، وقد يكون الناس قد بنوا عملاً على تلك عمليات التأكيد، فقد تواجه مشاكل محبطة وازدراء زملائك في الفريق. -If you or a partner does find it necessary at some point, make sure everyone knows to run `git pull --rebase` to try to make the pain after it happens a little bit simpler. +إذا وجد أنت أو شريك أن ذلك ضروري في مرحلة ما، فتأكد من أن الجميع يعلم بتشغيل `git pull --rebase` لمحاولة جعل الألم بعد حدوثه أقل صعوبة. -==== Rebase vs. Merge +==== Rebase vs. Merge (إعادة التأسيس مقابل الدمج) (((rebasing, vs. merging)))(((merging, vs. rebasing))) -Now that you've seen rebasing and merging in action, you may be wondering which one is better. -Before we can answer this, let's step back a bit and talk about what history means. - -One point of view on this is that your repository's commit history is a *record of what actually happened.* -It's a historical document, valuable in its own right, and shouldn't be tampered with. -From this angle, changing the commit history is almost blasphemous; you're _lying_ about what actually transpired. -So what if there was a messy series of merge commits? -That's how it happened, and the repository should preserve that for posterity. - -The opposing point of view is that the commit history is the *story of how your project was made.* -You wouldn't publish the first draft of a book, so why show your messy work? -When you're working on a project, you may need a record of all your missteps and dead-end paths, but when it's time to show your work to the world, you may want to tell a more coherent story of how to get from A to B. -People in this camp use tools like `rebase` and `filter-branch` to rewrite their commits before they're merged into the mainline branch. -They use tools like `rebase` and `filter-branch`, to tell the story in the way that's best for future readers. - -Now, to the question of whether merging or rebasing is better: hopefully you'll see that it's not that simple. -Git is a powerful tool, and allows you to do many things to and with your history, but every team and every project is different. -Now that you know how both of these things work, it's up to you to decide which one is best for your particular situation. - -You can get the best of both worlds: rebase local changes before pushing to clean up your work, but never rebase anything that you've pushed somewhere. +الآن بعد أن رأيت إعادة التأسيس (rebasing) والدمج (merging) في العمل، قد تتساءل أيهما أفضل. +قبل أن نتمكن من الإجابة على هذا، دعنا نتراجع قليلاً ونتحدث عن ما يعنيه السجل (history). + +وجهة نظر واحدة في هذا هي أن سجل التأكيد (commit history) لمستودعك هو *سجل لما حدث فعلاً.* +إنه وثيقة تاريخية، قيّمة في حد ذاتها، ولا يجب العبث بها. +من هذه الزاوية، يعد تغيير سجل التأكيد تقريباً تجديفاً؛ فأنت _تكذب_ بشأن ما جرى فعلاً. +إذن ماذا لو كانت هناك سلسلة فوضوية من عمليات تأكيد الدمج (merge commits)? +هكذا جرى الأمر، ويجب أن يحتفظ المستودع بذلك للأجيال القادمة. + +وجهة النظر المعاكسة هي أن سجل التأكيد هو *قصة كيفية إنشاء مشروعك.* +لن تنشر المسودة الأولى من كتاب، فلماذا تُظهر عملك الفوضوي؟ +عندما تعمل على مشروع، قد تحتاج إلى سجل لجميع خطواتك الخاطئة ومساراتك المسدودة، ولكن عندما يحين الوقت لعرض عملك على العالم، قد ترغب في سرد قصة أكثر تماسكاً حول كيفية الانتقال من A إلى B. +يستخدم الأشخاص في هذا المعسكر أدوات مثل `rebase` و `filter-branch` لإعادة كتابة عمليات التأكيد الخاصة بهم قبل دمجها في الفرع الرئيسي (mainline branch). +يستخدمون أدوات مثل `rebase` و `filter-branch` لسرد القصة بالطريقة الأفضل للقراء المستقبليين. + +الآن، فيما يتعلق بسؤال ما إذا كان الدمج أم إعادة التأسيس أفضل: نأمل أن ترى أن الأمر ليس بهذه البساطة. +Git هي أداة قوية، وتسمح لك بفعل أشياء كثيرة في سجلك وعليه، لكن كل فريق وكل مشروع مختلف. +الآن بعد أن عرفت كيف يعمل كلاهما، الأمر متروك لك لتقرر أيهما الأفضل لوضعك الخاص. + +يمكنك الحصول على أفضل ما في العالمين: أعد تأسيس التغييرات المحلية قبل الدفع لتنظيف عملك، لكن لا تعد تأسيس أي شيء دفعته بالفعل إلى مكان ما. diff --git a/book/03-git-branching/sections/remote-branches.asc b/book/03-git-branching/sections/remote-branches.asc index adbb8735d..2bf89cf41 100644 --- a/book/03-git-branching/sections/remote-branches.asc +++ b/book/03-git-branching/sections/remote-branches.asc @@ -1,71 +1,71 @@ [[_remote_branches]] -=== Remote Branches +=== Remote Branches (الفروع البعيدة) (((branches, remote)))(((references, remote))) -Remote references are references (pointers) in your remote repositories, including branches, tags, and so on. -You can get a full list of remote references explicitly with `git ls-remote `, or `git remote show ` for remote branches as well as more information. -Nevertheless, a more common way is to take advantage of remote-tracking branches. +المراجع البعيدة (Remote references) هي مراجع (مؤشرات - pointers) في مستودعاتك البعيدة (remote repositories)، بما في ذلك الفروع (branches) والعلامات (tags) وما إلى ذلك. +يمكنك الحصول على قائمة كاملة بالمراجع البعيدة صراحةً باستخدام `git ls-remote `، أو `git remote show ` للفروع البعيدة بالإضافة إلى مزيد من المعلومات. +ومع ذلك، فإن الطريقة الأكثر شيوعاً هي الاستفادة من فروع التتبع البعيدة (remote-tracking branches). -Remote-tracking branches are references to the state of remote branches. -They're local references that you can't move; Git moves them for you whenever you do any network communication, to make sure they accurately represent the state of the remote repository. -Think of them as bookmarks, to remind you where the branches in your remote repositories were the last time you connected to them. +فروع التتبع البعيدة (Remote-tracking branches) هي مراجع (references) لحالة الفروع البعيدة. +إنها مراجع محلية لا يمكنك تحريكها؛ يقوم Git بتحريكها نيابة عنك كلما قمت بأي اتصال بالشبكة (network communication)، للتأكد من أنها تمثل حالة المستودع البعيد (remote repository) بدقة. +فكر فيها كعلامات مرجعية (bookmarks)، لتذكيرك بمكان الفروع في مستودعاتك البعيدة في آخر مرة اتصلت بها. -Remote-tracking branch names take the form `/`. -For instance, if you wanted to see what the `master` branch on your `origin` remote looked like as of the last time you communicated with it, you would check the `origin/master` branch. -If you were working on an issue with a partner and they pushed up an `iss53` branch, you might have your own local `iss53` branch, but the branch on the server would be represented by the remote-tracking branch `origin/iss53`. +تأخذ أسماء فروع التتبع البعيدة (Remote-tracking branch names) التنسيق `/`. +على سبيل المثال، إذا كنت ترغب في رؤية كيف كان يبدو فرع `master` على المستودع البعيد `origin` الخاص بك اعتباراً من آخر مرة تواصلت فيها معه، فستتحقق من فرع `origin/master`. +إذا كنت تعمل على مشكلة (issue) مع شريك وقام بدفع (pushed up) فرع `iss53`، فقد يكون لديك فرع `iss53` محلي خاص بك، ولكن الفرع الموجود على الخادم سيتم تمثيله بواسطة فرع التتبع البعيد `origin/iss53`. -This may be a bit confusing, so let's look at an example. -Let's say you have a Git server on your network at `git.ourcompany.com`. -If you clone from this, Git's `clone` command automatically names it `origin` for you, pulls down all its data, creates a pointer to where its `master` branch is, and names it `origin/master` locally. -Git also gives you your own local `master` branch starting at the same place as origin's `master` branch, so you have something to work from. +قد يكون هذا مربكاً بعض الشيء، لذا دعنا نلقي نظرة على مثال. +لنفترض أن لديك خادم Git على شبكتك في `git.ourcompany.com`. +إذا قمت بالاستنساخ (clone) من هذا الخادم، فإن أمر `clone` الخاص بـ Git يسميه تلقائياً `origin` نيابة عنك، ويسحب (pulls down) جميع بياناته، وينشئ مؤشراً (pointer) إلى مكان فرع `master` الخاص به، ويسميه `origin/master` محلياً. +يمنحك Git أيضاً فرع `master` محلي خاص بك يبدأ من نفس المكان الذي يبدأ منه فرع `master` الخاص بـ origin، بحيث يكون لديك شيء للعمل منه.(((git commands, clone))) [NOTE] -."`origin`" is not special +."`origin`" is not special ("`origin`" ليس خاصاً) ==== -Just like the branch name "`master`" does not have any special meaning in Git, neither does "`origin`". -While "`master`" is the default name for a starting branch when you run `git init` which is the only reason it's widely used, "`origin`" is the default name for a remote when you run `git clone`. -If you run `git clone -o booyah` instead, then you will have `booyah/master` as your default remote branch.(((origin))) +تماماً كما أن اسم الفرع "`master`" ليس له أي معنى خاص في Git، فإن الأمر نفسه ينطبق على "`origin`". +بينما "`master`" هو الاسم الافتراضي لفرع البداية عند تشغيل `git init` وهو السبب الوحيد لاستخدامه على نطاق واسع، فإن "`origin`" هو الاسم الافتراضي لمستودع بعيد عند تشغيل `git clone`. +إذا قمت بتشغيل `git clone -o booyah` بدلاً من ذلك، فستحصل على `booyah/master` كفرع بعيد افتراضي لك. ==== -.Server and local repositories after cloning +.Server and local repositories after cloning (الخادم والمستودعات المحلية بعد الاستنساخ) image::images/remote-branches-1.png[Server and local repositories after cloning] -If you do some work on your local `master` branch, and, in the meantime, someone else pushes to `git.ourcompany.com` and updates its `master` branch, then your histories move forward differently. -Also, as long as you stay out of contact with your `origin` server, your `origin/master` pointer doesn't move. +إذا قمت ببعض العمل على فرع `master` المحلي الخاص بك، وفي غضون ذلك، قام شخص آخر بالدفع (pushes) إلى `git.ourcompany.com` وتحديث فرع `master` الخاص به، فإن سجلاتك (histories) تمضي قدماً بشكل مختلف. +أيضاً، طالما أنك بعيد عن الاتصال بخادم `origin` الخاص بك، فإن مؤشر `origin/master` الخاص بك لا يتحرك. -.Local and remote work can diverge +.Local and remote work can diverge (يمكن أن ينحرف العمل المحلي والبعيد) image::images/remote-branches-2.png[Local and remote work can diverge] -To synchronize your work with a given remote, you run a `git fetch ` command (in our case, `git fetch origin`). -This command looks up which server "`origin`" is (in this case, it's `git.ourcompany.com`), fetches any data from it that you don't yet have, and updates your local database, moving your `origin/master` pointer to its new, more up-to-date position. +لمزامنة عملك (synchronize your work) مع مستودع بعيد (remote) معين، تقوم بتشغيل أمر `git fetch ` (في حالتنا، `git fetch origin`). +يبحث هذا الأمر عن الخادم الذي يمثله "`origin`" (في هذه الحالة، هو `git.ourcompany.com`)، ويجلب (fetches) أي بيانات منه لم تكن لديك بعد، ويحدث قاعدة بياناتك المحلية (local database)، محركاً مؤشر `origin/master` الخاص بك إلى موضعه الجديد والأكثر حداثة. -.`git fetch` updates your remote-tracking branches +.`git fetch` updates your remote references (`git fetch` يحدّث مراجعك البعيدة) image::images/remote-branches-3.png[`git fetch` updates your remote-tracking branches] -To demonstrate having multiple remote servers and what remote branches for those remote projects look like, let's assume you have another internal Git server that is used only for development by one of your sprint teams. -This server is at `git.team1.ourcompany.com`. -You can add it as a new remote reference to the project you're currently working on by running the `git remote add` command as we covered in <>. -Name this remote `teamone`, which will be your shortname for that whole URL. +لتوضيح وجود خوادم بعيدة متعددة (multiple remote servers) وكيف تبدو الفروع البعيدة (remote branches) لها، لنفترض أن لديك خادم Git داخلياً آخر يستخدم فقط للتطوير من قبل أحد فرق الركض (sprint teams) الخاصة بك. +هذا الخادم موجود في `git.team1.ourcompany.com`. +يمكنك إضافته كمرجع بعيد جديد للمشروع الذي تعمل عليه حالياً عن طريق تشغيل أمر `git remote add` كما غطينا في <>. +قم بتسمية هذا المستودع البعيد `teamone`، والذي سيكون اسمك القصير (shortname) لذلك الرابط (URL) بأكمله. -.Adding another server as a remote +.Adding another server as a remote (إضافة خادم آخر كمستودع بعيد) image::images/remote-branches-4.png[Adding another server as a remote] -Now, you can run `git fetch teamone` to fetch everything the remote `teamone` server has that you don't have yet. -Because that server has a subset of the data your `origin` server has right now, Git fetches no data but sets a remote-tracking branch called `teamone/master` to point to the commit that `teamone` has as its `master` branch. +الآن، يمكنك تشغيل `git fetch teamone` لجلب (fetch) كل ما لدى الخادم البعيد `teamone` وليس لديك بعد. +نظراً لأن هذا الخادم لديه مجموعة فرعية (subset) من البيانات التي يمتلكها خادم `origin` الخاص بك الآن، فإن Git لا يجلب أي بيانات بل يعين فرع تتبع بعيد (remote-tracking branch) يسمى `teamone/master` للإشارة إلى عملية التأكيد (commit) التي يمتلكها `teamone` كفرع `master` الخاص به. -.Remote-tracking branch for `teamone/master` +.Remote-tracking branch for `teamone/master` (فرع تتبع بعيد لـ `teamone/master`) image::images/remote-branches-5.png[Remote-tracking branch for `teamone/master`] [[_pushing_branches]] -==== Pushing +==== Pushing (الدفع) (((pushing))) -When you want to share a branch with the world, you need to push it up to a remote to which you have write access. -Your local branches aren't automatically synchronized to the remotes you write to -- you have to explicitly push the branches you want to share. -That way, you can use private branches for work you don't want to share, and push up only the topic branches you want to collaborate on. +عندما تريد مشاركة فرع مع العالم، تحتاج إلى دفعه (push it up) إلى مستودع بعيد (remote) لديك وصول للكتابة إليه (write access). +لا تتم مزامنة فروعك المحلية تلقائياً مع المستودعات البعيدة التي تكتب إليها -- بل يجب عليك دفع الفروع التي تريد مشاركتها بشكل صريح (explicitly push). +وبهذه الطريقة، يمكنك استخدام الفروع الخاصة (private branches) للعمل الذي لا تريد مشاركته، ودفع فروع الموضوعات (topic branches) التي تريد التعاون فيها فقط. -If you have a branch named `serverfix` that you want to work on with others, you can push it up the same way you pushed your first branch. -Run `git push `:(((git commands, push))) +إذا كان لديك فرع يسمى `serverfix` وتريد العمل عليه مع الآخرين، يمكنك دفعه (push it up) بنفس الطريقة التي دفعت بها فرعك الأول. +قم بتشغيل `git push `:(((git commands, push))) [source,console] ---- @@ -79,26 +79,26 @@ To https://github.com/schacon/simplegit * [new branch] serverfix -> serverfix ---- -This is a bit of a shortcut. -Git automatically expands the `serverfix` branchname out to `refs/heads/serverfix:refs/heads/serverfix`, which means, "`Take my `serverfix` local branch and push it to update the remote's `serverfix` branch.`" -We'll go over the `refs/heads/` part in detail in <>, but you can generally leave it off. -You can also do `git push origin serverfix:serverfix`, which does the same thing -- it says, "`Take my serverfix and make it the remote's serverfix.`" -You can use this format to push a local branch into a remote branch that is named differently. -If you didn't want it to be called `serverfix` on the remote, you could instead run `git push origin serverfix:awesomebranch` to push your local `serverfix` branch to the `awesomebranch` branch on the remote project. +هذا نوع من الاختصار (shortcut). +يقوم Git تلقائياً بتوسيع اسم فرع `serverfix` إلى `refs/heads/serverfix:refs/heads/serverfix`، مما يعني، "`خذ فرع `serverfix` المحلي الخاص بي وادفعه لتحديث فرع `serverfix` الخاص بالمستودع البعيد.`" +سوف نستعرض جزء `refs/heads/` بالتفصيل في <>، ولكن بشكل عام يمكنك حذفه. +يمكنك أيضاً القيام بـ `git push origin serverfix:serverfix`، والذي يقوم بنفس الشيء -- إنه يقول، "`خذ serverfix الخاص بي واجعله serverfix الخاص بالمستودع البعيد.`" +يمكنك استخدام هذا التنسيق لدفع (push) فرع محلي إلى فرع بعيد يحمل اسماً مختلفاً. +إذا لم تكن تريد أن يُطلق عليه `serverfix` على المستودع البعيد، فيمكنك بدلاً من ذلك تشغيل `git push origin serverfix:awesomebranch` لدفع فرع `serverfix` المحلي الخاص بك إلى فرع `awesomebranch` في المشروع البعيد. [NOTE] -.Don't type your password every time +.Don't type your password every time (لا تكتب كلمة مرورك في كل مرة) ==== -If you're using an HTTPS URL to push over, the Git server will ask you for your username and password for authentication. -By default it will prompt you on the terminal for this information so the server can tell if you're allowed to push. +إذا كنت تستخدم رابط (URL) HTTPS للدفع (push) عبره، سيطلب منك خادم Git اسم المستخدم وكلمة المرور الخاصة بك للمصادقة (authentication). +بشكل افتراضي سيطالبك على الجهاز الطرفي (terminal) بهذه المعلومات حتى يتمكن الخادم من معرفة ما إذا كان مسموحاً لك بالدفع. -If you don't want to type it every single time you push, you can set up a "`credential cache`". -The simplest is just to keep it in memory for a few minutes, which you can easily set up by running `git config --global credential.helper cache`. +إذا كنت لا تريد كتابتها في كل مرة تدفع فيها، يمكنك إعداد "`ذاكرة تخزين مؤقت لبيانات الاعتماد (credential cache)`". +أبسط طريقة هي الاحتفاظ بها في الذاكرة لبضع دقائق، والتي يمكنك إعدادها بسهولة عن طريق تشغيل `git config --global credential.helper cache`. -For more information on the various credential caching options available, see <>. +لمزيد من المعلومات حول خيارات التخزين المؤقت لبيانات الاعتماد المتوفرة المتنوعة، راجع <>. ==== -The next time one of your collaborators fetches from the server, they will get a reference to where the server's version of `serverfix` is under the remote branch `origin/serverfix`: +في المرة القادمة التي يقوم فيها أحد المتعاونين (collaborators) معك بالجلب (fetches) من الخادم، سيحصل على مرجع (reference) إلى مكان إصدار الخادم من `serverfix` تحت الفرع البعيد `origin/serverfix`: [source,console] ---- @@ -111,11 +111,11 @@ From https://github.com/schacon/simplegit * [new branch] serverfix -> origin/serverfix ---- -It's important to note that when you do a fetch that brings down new remote-tracking branches, you don't automatically have local, editable copies of them. -In other words, in this case, you don't have a new `serverfix` branch -- you have only an `origin/serverfix` pointer that you can't modify. +من المهم ملاحظة أنه عندما تقوم بجلب (fetch) يُحضر فروع تتبع بعيدة (remote-tracking branches) جديدة، فإنه لا يكون لديك تلقائياً نسخ محلية قابلة للتحرير منها. +بعبارة أخرى، في هذه الحالة، ليس لديك فرع `serverfix` جديد -- لديك فقط مؤشر `origin/serverfix` الذي لا يمكنك تعديله. -To merge this work into your current working branch, you can run `git merge origin/serverfix`. -If you want your own `serverfix` branch that you can work on, you can base it off your remote-tracking branch: +لدمج (merge) هذا العمل في فرع عملك الحالي (current working branch)، يمكنك تشغيل `git merge origin/serverfix`. +إذا كنت تريد فرع `serverfix` خاصاً بك يمكنك العمل عليه، فيمكنك بناءه على فرع التتبع البعيد (remote-tracking branch) الخاص بك: [source,console] ---- @@ -124,20 +124,20 @@ Branch serverfix set up to track remote branch serverfix from origin. Switched to a new branch 'serverfix' ---- -This gives you a local branch that you can work on that starts where `origin/serverfix` is. +يمنحك هذا فرعاً محلياً يمكنك العمل عليه والذي يبدأ من حيث يوجد `origin/serverfix`. [[_tracking_branches]] -==== Tracking Branches +==== Tracking Branches (فروع التتبع) (((branches, tracking)))(((branches, upstream))) -Checking out a local branch from a remote-tracking branch automatically creates what is called a "`tracking branch`" (and the branch it tracks is called an "`upstream branch`"). -Tracking branches are local branches that have a direct relationship to a remote branch. -If you're on a tracking branch and type `git pull`, Git automatically knows which server to fetch from and which branch to merge in. +يؤدي سحب (Checking out) فرع محلي من فرع تتبع بعيد تلقائياً إلى إنشاء ما يسمى بـ "`فرع التتبع (tracking branch)`" (ويسمى الفرع الذي يتتبعه بـ "`فرع المنبع (upstream branch)`"). +فروع التتبع هي فروع محلية لها علاقة مباشرة (direct relationship) بفرع بعيد (remote branch). +إذا كنت متواجداً في فرع تتبع وكتبت `git pull`، فسيعرف Git تلقائياً أي خادم يجب الجلب (fetch) منه وأي فرع يجب دمجه (merge in). -When you clone a repository, it generally automatically creates a `master` branch that tracks `origin/master`. -However, you can set up other tracking branches if you wish -- ones that track branches on other remotes, or don't track the `master` branch. -The simple case is the example you just saw, running `git checkout -b /`. -This is a common enough operation that Git provides the `--track` shorthand: +عندما تقوم باستنساخ (clone) مستودع، فإنه يقوم بشكل عام تلقائياً بإنشاء فرع `master` يتتبع `origin/master`. +ومع ذلك، يمكنك إعداد فروع تتبع أخرى إذا كنت ترغب في ذلك -- فروع تتتبع الفروع على المستودعات البعيدة الأخرى (other remotes)، أو لا تتتبع فرع `master`. +الحالة البسيطة هي المثال الذي رأيته للتو، تشغيل `git checkout -b /`. +هذه عملية شائعة بما فيه الكفاية بحيث يوفر Git اختصار `--track`: [source,console] ---- @@ -146,8 +146,8 @@ Branch serverfix set up to track remote branch serverfix from origin. Switched to a new branch 'serverfix' ---- -In fact, this is so common that there's even a shortcut for that shortcut. -If the branch name you're trying to checkout (a) doesn't exist and (b) exactly matches a name on only one remote, Git will create a tracking branch for you: +في الواقع، هذا أمر شائع جداً لدرجة أن هناك اختصاراً لذلك الاختصار. +إذا كان اسم الفرع الذي تحاول سحبه (checkout) (أ) غير موجود و (ب) يتطابق تماماً مع اسم موجود في مستودع بعيد واحد فقط، فسينشئ Git فرع تتبع لك: [source,console] ---- @@ -156,7 +156,7 @@ Branch serverfix set up to track remote branch serverfix from origin. Switched to a new branch 'serverfix' ---- -To set up a local branch with a different name than the remote branch, you can easily use the first version with a different local branch name: +لإعداد فرع محلي باسم مختلف عن الفرع البعيد (remote branch)، يمكنك بسهولة استخدام الإصدار الأول باسم فرع محلي مختلف: [source,console] ---- @@ -165,9 +165,9 @@ Branch sf set up to track remote branch serverfix from origin. Switched to a new branch 'sf' ---- -Now, your local branch `sf` will automatically pull from `origin/serverfix`. +الآن، سيقوم فرع `sf` المحلي الخاص بك تلقائياً بالسحب (pull) من `origin/serverfix`. -If you already have a local branch and want to set it to a remote branch you just pulled down, or want to change the upstream branch you're tracking, you can use the `-u` or `--set-upstream-to` option to `git branch` to explicitly set it at any time. +إذا كان لديك بالفعل فرع محلي وتريد تعيينه لفرع بعيد قمت للتو بسحبه لأسفل (pulled down)، أو تريد تغيير فرع المنبع (upstream branch) الذي تتتبعه، يمكنك استخدام الخيار `-u` أو `--set-upstream-to` إلى `git branch` لتعيينه بشكل صريح في أي وقت. [source,console] ---- @@ -176,14 +176,14 @@ Branch serverfix set up to track remote branch serverfix from origin. ---- [NOTE] -.Upstream shorthand +.Upstream shorthand (اختصار المنبع) ==== -When you have a tracking branch set up, you can reference its upstream branch with the `@{upstream}` or `@{u}` shorthand. -So if you're on the `master` branch and it's tracking `origin/master`, you can say something like `git merge @{u}` instead of `git merge origin/master` if you wish.(((@{u})))(((@{upstream}))) +عندما تقوم بإعداد فرع تتبع (tracking branch)، يمكنك الإشارة إلى فرع المنبع (upstream branch) الخاص به باستخدام اختصار `@{upstream}` أو `@{u}`. +لذا، إذا كنت على فرع `master` وكان يتتبع `origin/master`، فيمكنك أن تقول شيئاً مثل `git merge @{u}` بدلاً من `git merge origin/master` إذا كنت ترغب في ذلك.(((@{u})))(((@{upstream}))) ==== -If you want to see what tracking branches you have set up, you can use the `-vv` option to `git branch`. -This will list out your local branches with more information including what each branch is tracking and if your local branch is ahead, behind or both. +إذا كنت ترغب في رؤية فروع التتبع (tracking branches) التي قمت بإعدادها، يمكنك استخدام الخيار `-vv` إلى `git branch`. +سيقوم هذا بسرد الفروع المحلية الخاصة بك مع مزيد من المعلومات بما في ذلك ما يتتبعه كل فرع وما إذا كان فرعك المحلي متقدماً (ahead) أو متأخراً (behind) أو كليهما. [source,console] ---- @@ -194,36 +194,36 @@ $ git branch -vv testing 5ea463a Try something new ---- -So here we can see that our `iss53` branch is tracking `origin/iss53` and is "`ahead`" by two, meaning that we have two commits locally that are not pushed to the server. -We can also see that our `master` branch is tracking `origin/master` and is up to date. -Next we can see that our `serverfix` branch is tracking the `server-fix-good` branch on our `teamone` server and is ahead by three and behind by one, meaning that there is one commit on the server we haven't merged in yet and three commits locally that we haven't pushed. -Finally we can see that our `testing` branch is not tracking any remote branch. +لذلك يمكننا أن نرى هنا أن فرع `iss53` الخاص بنا يتتبع `origin/iss53` وأنه "`متقدم (ahead)`" باثنتين، مما يعني أن لدينا عمليتي تأكيد (commits) محلياً لم يتم دفعهما (pushed) إلى الخادم. +يمكننا أن نرى أيضاً أن فرع `master` الخاص بنا يتتبع `origin/master` وأنه مُحدث (up to date). +بعد ذلك، يمكننا أن نرى أن فرع `serverfix` الخاص بنا يتتبع فرع `server-fix-good` على خادم `teamone` الخاص بنا وهو متقدم (ahead) بثلاث ومتأخر (behind) بواحدة، مما يعني أن هناك عملية تأكيد (commit) واحدة على الخادم لم نقم بدمجها بعد وثلاث عمليات تأكيد محلياً لم نقم بدفعها. +أخيراً يمكننا أن نرى أن فرع `testing` الخاص بنا لا يتتبع أي فرع بعيد. -It's important to note that these numbers are only since the last time you fetched from each server. -This command does not reach out to the servers, it's telling you about what it has cached from these servers locally. -If you want totally up to date ahead and behind numbers, you'll need to fetch from all your remotes right before running this. -You could do that like this: +من المهم ملاحظة أن هذه الأرقام هي فقط منذ آخر مرة قمت فيها بالجلب (fetched) من كل خادم. +لا يتواصل هذا الأمر مع الخوادم (servers)، إنه يخبرك فقط بما تم تخزينه مؤقتاً (cached) من هذه الخوادم محلياً. +إذا كنت تريد أرقاماً حديثة تماماً للمتقدم (ahead) والمتأخر (behind)، فستحتاج إلى الجلب (fetch) من جميع مستودعاتك البعيدة قبل تشغيل هذا مباشرة. +يمكنك القيام بذلك على النحو التالي: [source,console] ---- $ git fetch --all; git branch -vv ---- -==== Pulling +==== Pulling (السحب) (((pulling))) -While the `git fetch` command will fetch all the changes on the server that you don't have yet, it will not modify your working directory at all. -It will simply get the data for you and let you merge it yourself. -However, there is a command called `git pull` which is essentially a `git fetch` immediately followed by a `git merge` in most cases. -If you have a tracking branch set up as demonstrated in the last section, either by explicitly setting it or by having it created for you by the `clone` or `checkout` commands, `git pull` will look up what server and branch your current branch is tracking, fetch from that server and then try to merge in that remote branch. +في حين أن أمر `git fetch` سيجلب (fetch) جميع التغييرات الموجودة على الخادم التي لا تملكها بعد، إلا أنه لن يعدل دليل العمل (working directory) الخاص بك على الإطلاق. +سيحصل ببساطة على البيانات من أجلك ويتيح لك دمجها (merge it) بنفسك. +ومع ذلك، هناك أمر يسمى `git pull` وهو في الأساس عبارة عن `git fetch` متبوعاً مباشرة بـ `git merge` في معظم الحالات. +إذا كان لديك فرع تتبع (tracking branch) تم إعداده كما هو موضح في القسم الأخير، إما عن طريق تعيينه صراحةً أو عن طريق إنشائه لك بواسطة أوامر `clone` أو `checkout`، فسيبحث `git pull` عن الخادم والفرع الذي يتتبعه فرعك الحالي، ويجلب من ذلك الخادم ثم يحاول دمج (merge in) ذلك الفرع البعيد (remote branch). [[_delete_branches]] -==== Deleting Remote Branches +==== Deleting Remote Branches (حذف الفروع البعيدة) (((branches, deleting remote))) -Suppose you're done with a remote branch -- say you and your collaborators are finished with a feature and have merged it into your remote's `master` branch (or whatever branch your stable codeline is in). -You can delete a remote branch using the `--delete` option to `git push`. -If you want to delete your `serverfix` branch from the server, you run the following: +لنفترض أنك انتهيت من فرع بعيد (remote branch) -- لنفترض أنك أنت والمتعاونون (collaborators) معك قد انتهيتم من ميزة (feature) ودمجتموها في فرع `master` الخاص بالمستودع البعيد (أو أي فرع يوجد فيه سطر الكود المستقر الخاص بك). +يمكنك حذف (delete) فرع بعيد باستخدام الخيار `--delete` لأمر `git push`. +إذا كنت تريد حذف فرع `serverfix` الخاص بك من الخادم، فقم بتشغيل ما يلي: [source,console] ---- @@ -232,5 +232,5 @@ To https://github.com/schacon/simplegit - [deleted] serverfix ---- -Basically all this does is to remove the pointer from the server. -The Git server will generally keep the data there for a while until a garbage collection runs, so if it was accidentally deleted, it's often easy to recover. +في الأساس، كل ما يفعله هذا هو إزالة المؤشر (pointer) من الخادم. +سيحتفظ خادم Git عموماً بالبيانات هناك لفترة من الوقت حتى يتم تشغيل جمع البيانات المهملة (garbage collection)، لذلك إذا تم حذفه عن طريق الخطأ، فغالباً ما يكون من السهل استعادته (recover). diff --git a/book/03-git-branching/sections/workflows.asc b/book/03-git-branching/sections/workflows.asc index 9e6f3922a..47fa8f575 100644 --- a/book/03-git-branching/sections/workflows.asc +++ b/book/03-git-branching/sections/workflows.asc @@ -1,63 +1,63 @@ -=== Branching Workflows +=== Branching Workflows (مسارات عمل التفرع) -Now that you have the basics of branching and merging down, what can or should you do with them? -In this section, we'll cover some common workflows that this lightweight branching makes possible, so you can decide if you would like to incorporate them into your own development cycle. +الآن بعد أن أصبحت أساسيات التفرع (branching) والدمج (merging) واضحة لديك، ماذا يمكنك أو يجب عليك فعله بها؟ +في هذا القسم، سنغطي بعض مسارات العمل (workflows) الشائعة التي يتيحها هذا التفرع الخفيف (lightweight branching)، حتى تتمكن من تحديد ما إذا كنت ترغب في دمجها (incorporate them) في دورة التطوير (development cycle) الخاصة بك. -==== Long-Running Branches +==== Long-Running Branches (الفروع طويلة الأمد) (((branches, long-running))) -Because Git uses a simple three-way merge, merging from one branch into another multiple times over a long period is generally easy to do. -This means you can have several branches that are always open and that you use for different stages of your development cycle; you can merge regularly from some of them into others. +نظراً لأن Git يستخدم دمجاً ثلاثياً بسيطاً (simple three-way merge)، فإن الدمج من فرع إلى آخر عدة مرات على مدى فترة طويلة يكون عادةً سهلاً. +هذا يعني أنه يمكن أن يكون لديك عدة فروع مفتوحة دائماً وتستخدمها لمراحل مختلفة من دورة التطوير الخاصة بك؛ يمكنك الدمج بانتظام من بعضها إلى البعض الآخر. -Many Git developers have a workflow that embraces this approach, such as having only code that is entirely stable in their `master` branch -- possibly only code that has been or will be released. -They have another parallel branch named `develop` or `next` that they work from or use to test stability -- it isn't necessarily always stable, but whenever it gets to a stable state, it can be merged into `master`. -It's used to pull in topic branches (short-lived branches, like your earlier `iss53` branch) when they're ready, to make sure they pass all the tests and don't introduce bugs. +العديد من مطوري Git لديهم سير عمل يتبنى هذا النهج، مثل وجود كود (code) مستقر تماماً فقط في فرع `master` الخاص بهم -- وربما فقط الكود الذي تم أو سيتم إصداره (released). +لديهم فرع موازٍ آخر يسمى `develop` أو `next` يعملون منه أو يستخدمونه لاختبار الاستقرار (test stability) -- ليس بالضرورة أن يكون مستقراً دائماً، ولكن كلما وصل إلى حالة مستقرة (stable state)، يمكن دمجه (merged) في `master`. +يُستخدم لسحب (pull in) فروع الموضوعات (topic branches) (فروع قصيرة الأمد، مثل فرع `iss53` السابق) عندما تكون جاهزة، للتأكد من اجتيازها جميع الاختبارات (tests) وعدم إدخالها لأي أخطاء (bugs). -In reality, we're talking about pointers moving up the line of commits you're making. -The stable branches are farther down the line in your commit history, and the bleeding-edge branches are farther up the history. +في الواقع، نحن نتحدث عن مؤشرات (pointers) تتحرك على طول خط عمليات التأكيد (commits) التي تجريها. +تكون الفروع المستقرة أبعد في السجل الزمني لعمليات التأكيد، وتكون فروع أحدث التقنيات (bleeding-edge branches) أقرب في السجل. -.A linear view of progressive-stability branching +.A linear view of progressive-stability branching (عرض خطي لتفرع الاستقرار التدريجي) image::images/lr-branches-1.png[A linear view of progressive-stability branching] -It's generally easier to think about them as work silos, where sets of commits graduate to a more stable silo when they're fully tested. +من الأسهل عموماً التفكير فيها كصوامع عمل (work silos)، حيث تتخرج (graduate) مجموعات من عمليات التأكيد إلى صومعة أكثر استقراراً عندما يتم اختبارها بالكامل. [[lrbranch_b]] -.A "`silo`" view of progressive-stability branching +.A "`silo`" view of progressive-stability branching (عرض "`صومعة`" لتفرع الاستقرار التدريجي) image::images/lr-branches-2.png[A “silo” view of progressive-stability branching] -You can keep doing this for several levels of stability. -Some larger projects also have a `proposed` or `pu` (proposed updates) branch that has integrated branches that may not be ready to go into the `next` or `master` branch. -The idea is that your branches are at various levels of stability; when they reach a more stable level, they're merged into the branch above them. -Again, having multiple long-running branches isn't necessary, but it's often helpful, especially when you're dealing with very large or complex projects. +يمكنك الاستمرار في القيام بذلك لعدة مستويات من الاستقرار. +تحتوي بعض المشاريع الأكبر أيضاً على فرع `proposed` (مقترح) أو `pu` (تحديثات مقترحة - proposed updates) يحتوي على فروع مدمجة (integrated branches) قد لا تكون جاهزة للانتقال إلى فرع `next` أو `master`. +الفكرة هي أن فروعك تكون على مستويات مختلفة من الاستقرار؛ عندما تصل إلى مستوى أكثر استقراراً، يتم دمجها (merged) في الفرع الذي فوقها. +مرة أخرى، وجود فروع متعددة طويلة الأمد ليس ضرورياً، ولكنه غالباً ما يكون مفيداً، خاصة عندما تتعامل مع مشاريع كبيرة جداً أو معقدة. [[_topic_branch]] -==== Topic Branches +==== Topic Branches (فروع الموضوعات) (((branches, topic))) -Topic branches, however, are useful in projects of any size. -A topic branch is a short-lived branch that you create and use for a single particular feature or related work. -This is something you've likely never done with a VCS before because it's generally too expensive to create and merge branches. -But in Git it's common to create, work on, merge, and delete branches several times a day. +ومع ذلك، فإن فروع الموضوعات (Topic branches) مفيدة في المشاريع من أي حجم. +فرع الموضوع هو فرع قصير الأمد (short-lived branch) تقوم بإنشائه واستخدامه لميزة معينة (particular feature) أو عمل ذي صلة. +هذا شيء من المحتمل أنك لم تفعله مطلقاً باستخدام نظام VCS (نظام تحكم في الإصدارات) من قبل لأنه عادةً ما يكون مكلفاً جداً إنشاء الفروع ودمجها. +ولكن في Git، من الشائع إنشاء الفروع والعمل عليها ودمجها (merge) وحذفها عدة مرات في اليوم. -You saw this in the last section with the `iss53` and `hotfix` branches you created. -You did a few commits on them and deleted them directly after merging them into your main branch. -This technique allows you to context-switch quickly and completely -- because your work is separated into silos where all the changes in that branch have to do with that topic, it's easier to see what has happened during code review and such. -You can keep the changes there for minutes, days, or months, and merge them in when they're ready, regardless of the order in which they were created or worked on. +لقد رأيت هذا في القسم الأخير مع فروع `iss53` و `hotfix` التي قمت بإنشائها. +قمت ببعض عمليات التأكيد (commits) عليها وحذفتها مباشرة بعد دمجها في فرعك الرئيسي (main branch). +تتيح لك هذه التقنية تبديل السياق (context-switch) بسرعة وبشكل كامل -- نظراً لأن عملك مقسم إلى صوامع (silos) حيث تتعلق جميع التغييرات في ذلك الفرع بذلك الموضوع، فمن الأسهل معرفة ما حدث أثناء مراجعة الكود (code review) وما شابه ذلك. +يمكنك الاحتفاظ بالتغييرات هناك لدقائق أو أيام أو شهور، ودمجها (merge them in) عندما تكون جاهزة، بغض النظر عن الترتيب الذي تم إنشاؤها أو العمل عليها به. -Consider an example of doing some work (on `master`), branching off for an issue (`iss91`), working on it for a bit, branching off the second branch to try another way of handling the same thing (`iss91v2`), going back to your `master` branch and working there for a while, and then branching off there to do some work that you're not sure is a good idea (`dumbidea` branch). -Your commit history will look something like this: +فكر في مثال للقيام ببعض العمل (على `master`)، والتفرع لمشكلة (`iss91`)، والعمل عليها لفترة، والتفرع من الفرع الثاني لتجربة طريقة أخرى للتعامل مع نفس الشيء (`iss91v2`)، والعودة إلى فرع `master` الخاص بك والعمل هناك لفترة من الوقت، ثم التفرع من هناك للقيام ببعض العمل الذي لست متأكداً مما إذا كان فكرة جيدة (فرع `dumbidea`). +سيبدو سجل التأكيد (commit history) الخاص بك كالتالي: -.Multiple topic branches +.Multiple topic branches (فروع موضوعات متعددة) image::images/topic-branches-1.png[Multiple topic branches] -Now, let's say you decide you like the second solution to your issue best (`iss91v2`); and you showed the `dumbidea` branch to your coworkers, and it turns out to be genius. -You can throw away the original `iss91` branch (losing commits `C5` and `C6`) and merge in the other two. -Your history then looks like this: +الآن، لنفترض أنك قررت أن الحل الثاني لمشكلتك هو الأفضل (`iss91v2`)؛ وقمت بعرض فرع `dumbidea` على زملائك في العمل، وتبين أنه عبقري. +يمكنك التخلص من فرع `iss91` الأصلي (فقدان عمليتي التأكيد `C5` و `C6`) ودمج (merge in) الاثنين الآخرين. +سيبدو سجلك (history) حينئذٍ كالتالي: -.History after merging `dumbidea` and `iss91v2` +.History after merging `dumbidea` and `iss91v2` (السجل بعد دمج `dumbidea` و `iss91v2`) image::images/topic-branches-2.png[History after merging `dumbidea` and `iss91v2`] -We will go into more detail about the various possible workflows for your Git project in <>, so before you decide which branching scheme your next project will use, be sure to read that chapter. +سنتعمق أكثر في تفاصيل مسارات العمل (workflows) المختلفة المحتملة لمشروع Git الخاص بك في <>، لذا قبل أن تقرر أي مخطط تفرع (branching scheme) سيستخدمه مشروعك التالي، تأكد من قراءة ذلك الفصل. -It's important to remember when you're doing all this that these branches are completely local. -When you're branching and merging, everything is being done only in your Git repository -- there is no communication with the server. +من المهم أن تتذكر عندما تقوم بكل هذا أن هذه الفروع محلية تماماً (completely local). +عندما تقوم بالتفرع والدمج، يتم كل شيء فقط في مستودع Git (Git repository) الخاص بك -- لا يوجد أي اتصال بالخادم (server). \ No newline at end of file diff --git a/book/04-git-server/sections/generating-ssh-key.asc b/book/04-git-server/sections/generating-ssh-key.asc index d1a61daf4..bc4c67e7b 100644 --- a/book/04-git-server/sections/generating-ssh-key.asc +++ b/book/04-git-server/sections/generating-ssh-key.asc @@ -1,13 +1,13 @@ [[_generate_ssh_key]] -=== Generating Your SSH Public Key +=== Generating Your SSH Public Key (إنشاء مفتاحك العام لـ SSH) (((SSH keys))) -Many Git servers authenticate using SSH public keys. -In order to provide a public key, each user in your system must generate one if they don't already have one. -This process is similar across all operating systems. -First, you should check to make sure you don't already have a key. -By default, a user's SSH keys are stored in that user's `~/.ssh` directory. -You can easily check to see if you have a key already by going to that directory and listing the contents: +تتم مصادقة (authenticate) العديد من خوادم Git باستخدام المفاتيح العامة لـ SSH (SSH public keys). +من أجل توفير مفتاح عام (public key)، يجب على كل مستخدم في نظامك إنشاء واحد إذا لم يكن لديه واحد بالفعل. +هذه العملية متشابهة عبر جميع أنظمة التشغيل (operating systems). +أولاً، يجب عليك التحقق للتأكد من أنه ليس لديك مفتاح (key) بالفعل. +بشكل افتراضي، يتم تخزين مفاتيح SSH (SSH keys) الخاصة بالمستخدم في دليل `~/.ssh` الخاص بذلك المستخدم. +يمكنك بسهولة التحقق لمعرفة ما إذا كان لديك مفتاح بالفعل عن طريق الانتقال إلى ذلك الدليل وسرد (listing) محتوياته: [source,console] ---- @@ -17,9 +17,9 @@ authorized_keys2 id_dsa known_hosts config id_dsa.pub ---- -You're looking for a pair of files named something like `id_dsa` or `id_rsa` and a matching file with a `.pub` extension. -The `.pub` file is your public key, and the other file is the corresponding private key. -If you don't have these files (or you don't even have a `.ssh` directory), you can create them by running a program called `ssh-keygen`, which is provided with the SSH package on Linux/macOS systems and comes with Git for Windows: +أنت تبحث عن زوج (pair) من الملفات تسمى شيئاً مثل `id_dsa` أو `id_rsa` وملف مطابق بامتداد `.pub`. +الملف `.pub` هو مفتاحك العام (public key)، والملف الآخر هو المفتاح الخاص (private key) المقابل. +إذا لم تكن لديك هذه الملفات (أو ليس لديك حتى دليل `.ssh`)، يمكنك إنشاؤها عن طريق تشغيل برنامج يسمى `ssh-keygen`، والذي يتم توفيره مع حزمة SSH على أنظمة Linux/macOS ويأتي مع Git لنظام Windows (Git for Windows): [source,console] ---- @@ -35,13 +35,13 @@ The key fingerprint is: d0:82:24:8e:d7:f1:bb:9b:33:53:96:93:49:da:9b:e3 schacon@mylaptop.local ---- -First it confirms where you want to save the key (`.ssh/id_rsa`), and then it asks twice for a passphrase, which you can leave empty if you don't want to type a password when you use the key. -However, if you do use a password, make sure to add the `-o` option; it saves the private key in a format that is more resistant to brute-force password cracking than is the default format. -You can also use the `ssh-agent` tool to prevent having to enter the password each time. +أولاً يؤكد المكان الذي تريد حفظ المفتاح فيه (`.ssh/id_rsa`)، ثم يطلب مرتين إدخال عبارة مرور (passphrase)، والتي يمكنك تركها فارغة إذا كنت لا تريد كتابة كلمة مرور (password) عند استخدام المفتاح. +ومع ذلك، إذا كنت تستخدم كلمة مرور (password)، فتأكد من إضافة الخيار `-o`؛ فهو يحفظ المفتاح الخاص (private key) بتنسيق أكثر مقاومة لاختراق كلمات المرور بالقوة الغاشمة (brute-force password cracking) من التنسيق الافتراضي. +يمكنك أيضاً استخدام أداة `ssh-agent` لتجنب الاضطرار إلى إدخال كلمة المرور (password) في كل مرة. -Now, each user that does this has to send their public key to you or whoever is administrating the Git server (assuming you're using an SSH server setup that requires public keys). -All they have to do is copy the contents of the `.pub` file and email it. -The public keys look something like this: +الآن، يجب على كل مستخدم يفعل ذلك إرسال مفتاحه العام (public key) إليك أو إلى الشخص الذي يدير خادم Git (بافتراض أنك تستخدم إعداد خادم SSH (SSH server setup) يتطلب مفاتيح عامة). +كل ما عليهم فعله هو نسخ محتويات الملف `.pub` وإرسالها بالبريد الإلكتروني. +تبدو المفاتيح العامة (public keys) كالتالي: [source,console] ---- @@ -54,4 +54,4 @@ mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx NrRFi9wrf+M7Q== schacon@mylaptop.local ---- -For a more in-depth tutorial on creating an SSH key on multiple operating systems, see the GitHub guide on SSH keys at https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent[^]. +للحصول على برنامج تعليمي (tutorial) أكثر تعمقاً حول إنشاء مفتاح SSH (SSH key) على أنظمة تشغيل (operating systems) متعددة، راجع دليل GitHub حول مفاتيح SSH على https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent[^]. diff --git a/book/04-git-server/sections/git-daemon.asc b/book/04-git-server/sections/git-daemon.asc index 1fe172375..6e8f6d7a4 100644 --- a/book/04-git-server/sections/git-daemon.asc +++ b/book/04-git-server/sections/git-daemon.asc @@ -1,28 +1,28 @@ -=== Git Daemon +=== Git Daemon (الخادم الخفي لـ Git) (((serving repositories, git protocol))) -Next we'll set up a daemon serving repositories using the "`Git`" protocol. -This is a common choice for fast, unauthenticated access to your Git data. -Remember that since this is not an authenticated service, anything you serve over this protocol is public within its network. +بعد ذلك سنقوم بإعداد خادم خفي (daemon) يقدم المستودعات (serving repositories) باستخدام بروتوكول "`Git`". +هذا خيار شائع للوصول السريع وغير المصادق عليه (fast, unauthenticated access) إلى بيانات Git الخاصة بك. +تذكر أنه نظراً لأن هذه ليست خدمة مصادق عليها (authenticated service)، فإن أي شيء تقدمه (serve) عبر هذا البروتوكول يكون عاماً (public) داخل شبكته. -If you're running this on a server outside your firewall, it should be used only for projects that are publicly visible to the world. -If the server you're running it on is inside your firewall, you might use it for projects that a large number of people or computers (continuous integration or build servers) have read-only access to, when you don't want to have to add an SSH key for each. +إذا كنت تقوم بتشغيل هذا على خادم خارج جدار الحماية (firewall) الخاص بك، فيجب استخدامه فقط للمشاريع المرئية علناً (publicly visible) للعالم. +إذا كان الخادم الذي تقوم بتشغيله عليه يقع داخل جدار الحماية (firewall) الخاص بك، فيمكنك استخدامه للمشاريع التي يتمتع فيها عدد كبير من الأشخاص أو أجهزة الكمبيوتر (خوادم التكامل المستمر (continuous integration) أو البناء (build servers)) بوصول للقراءة فقط (read-only access)، عندما لا ترغب في الاضطرار إلى إضافة مفتاح SSH (SSH key) لكل منها. -In any case, the Git protocol is relatively easy to set up. -Basically, you need to run this command in a daemonized manner:(((git commands, daemon))) +على أي حال، من السهل نسبياً إعداد (set up) بروتوكول Git. +في الأساس، تحتاج إلى تشغيل هذا الأمر بطريقة الخفي (daemonized manner):(((git commands, daemon))) [source,console] ---- $ git daemon --reuseaddr --base-path=/srv/git/ /srv/git/ ---- -The `--reuseaddr` option allows the server to restart without waiting for old connections to time out, while the `--base-path` option allows people to clone projects without specifying the entire path, and the path at the end tells the Git daemon where to look for repositories to export. -If you're running a firewall, you'll also need to punch a hole in it at port 9418 on the box you're setting this up on. +يسمح الخيار `--reuseaddr` للخادم بإعادة التشغيل (restart) دون انتظار انتهاء مهلة الاتصالات القديمة (old connections to time out)، بينما يسمح الخيار `--base-path` للأشخاص باستنساخ (clone) المشاريع دون تحديد المسار بأكمله (entire path)، والمسار الموجود في النهاية يخبر الخادم الخفي لـ Git (Git daemon) بمكان البحث عن المستودعات (repositories) لتصديرها (export). +إذا كنت تقوم بتشغيل جدار حماية (firewall)، فستحتاج أيضاً إلى إحداث ثقب (punch a hole) فيه عند المنفذ (port) 9418 على الجهاز الذي تقوم بإعداد هذا عليه. -You can daemonize this process a number of ways, depending on the operating system you're running. +يمكنك جعل هذه العملية خفية (daemonize this process) بعدة طرق، اعتماداً على نظام التشغيل (operating system) الذي تقوم بتشغيله. -Since `systemd` is the most common init system among modern Linux distributions, you can use it for that purpose. -Simply place a file in `/etc/systemd/system/git-daemon.service` with these contents: +نظراً لأن `systemd` هو نظام التهيئة (init system) الأكثر شيوعاً بين توزيعات Linux (Linux distributions) الحديثة، فيمكنك استخدامه لهذا الغرض. +ببساطة ضع ملفاً في `/etc/systemd/system/git-daemon.service` بهذه المحتويات: [source,console] ---- @@ -46,16 +46,16 @@ Group=git WantedBy=multi-user.target ---- -You might have noticed that Git daemon is started here with `git` as both group and user. -Modify it to fit your needs and make sure the provided user exists on the system. -Also, check that the Git binary is indeed located at `/usr/bin/git` and change the path if necessary. +ربما لاحظت أنه يتم بدء تشغيل الخادم الخفي لـ Git (Git daemon) هنا باستخدام `git` كمجموعة (group) ومستخدم (user) على حد سواء. +قم بتعديله ليناسب احتياجاتك وتأكد من وجود المستخدم (user) المقدم على النظام. +تحقق أيضاً من أن الملف الثنائي لـ Git (Git binary) موجود بالفعل في `/usr/bin/git` وقم بتغيير المسار (path) إذا لزم الأمر. -Finally, you'll run `systemctl enable git-daemon` to automatically start the service on boot, and can start and stop the service with, respectively, `systemctl start git-daemon` and `systemctl stop git-daemon`. +أخيراً، ستقوم بتشغيل `systemctl enable git-daemon` لبدء تشغيل الخدمة (service) تلقائياً عند التمهيد (boot)، ويمكنك بدء الخدمة وإيقافها (start and stop the service) باستخدام `systemctl start git-daemon` و `systemctl stop git-daemon` على التوالي. -On other systems, you may want to use `xinetd`, a script in your `sysvinit` system, or something else -- as long as you get that command daemonized and watched somehow. +على الأنظمة الأخرى، قد ترغب في استخدام `xinetd`، وهو برنامج نصي (script) في نظام `sysvinit` الخاص بك، أو شيء آخر -- طالما أنك تحصل على هذا الأمر كخفي (daemonized) ومراقب (watched) بطريقة ما. -Next, you have to tell Git which repositories to allow unauthenticated Git server-based access to. -You can do this in each repository by creating a file named `git-daemon-export-ok`. +بعد ذلك، يجب عليك إخبار Git بالمستودعات (repositories) التي يجب السماح فيها بالوصول غير المصادق عليه (unauthenticated) المستند إلى خادم Git (Git server-based access). +يمكنك القيام بذلك في كل مستودع عن طريق إنشاء ملف يسمى `git-daemon-export-ok`. [source,console] ---- @@ -63,4 +63,4 @@ $ cd /path/to/project.git $ touch git-daemon-export-ok ---- -The presence of that file tells Git that it's OK to serve this project without authentication. +يخبر وجود ذلك الملف Git أنه لا بأس بتقديم (serve) هذا المشروع دون مصادقة (authentication). diff --git a/book/04-git-server/sections/git-on-a-server.asc b/book/04-git-server/sections/git-on-a-server.asc index 61847a993..e5dbf8bf5 100644 --- a/book/04-git-server/sections/git-on-a-server.asc +++ b/book/04-git-server/sections/git-on-a-server.asc @@ -1,18 +1,18 @@ [[_getting_git_on_a_server]] -=== Getting Git on a Server +=== Getting Git on a Server (الحصول على Git على خادم) -Now we'll cover setting up a Git service running these protocols on your own server. +الآن سنغطي إعداد خدمة Git (Git service) لتشغيل هذه البروتوكولات (protocols) على الخادم (server) الخاص بك. [NOTE] ==== -Here we'll be demonstrating the commands and steps needed to do basic, simplified installations on a Linux-based server, though it's also possible to run these services on macOS or Windows servers. -Actually setting up a production server within your infrastructure will certainly entail differences in security measures or operating system tools, but hopefully this will give you the general idea of what's involved. +سنوضح هنا الأوامر (commands) والخطوات (steps) اللازمة للقيام بعمليات تثبيت أساسية ومبسطة (basic, simplified installations) على خادم يعتمد على Linux (Linux-based server)، على الرغم من أنه من الممكن أيضاً تشغيل هذه الخدمات على خوادم macOS أو Windows. +بالتأكيد سيترتب على الإعداد الفعلي لخادم إنتاج (production server) داخل بنيتك التحتية (infrastructure) اختلافات في التدابير الأمنية (security measures) أو أدوات نظام التشغيل (operating system tools)، ولكن نأمل أن يمنحك هذا فكرة عامة عما يتضمنه الأمر. ==== -In order to initially set up any Git server, you have to export an existing repository into a new bare repository -- a repository that doesn't contain a working directory. -This is generally straightforward to do. -In order to clone your repository to create a new bare repository, you run the clone command with the `--bare` option.(((git commands, clone, bare))) -By convention, bare repository directory names end with the suffix `.git`, like so: +من أجل إعداد (set up) أي خادم Git (Git server) في البداية، يجب عليك تصدير (export) مستودع موجود (existing repository) إلى مستودع مجرد (bare repository) جديد -- مستودع لا يحتوي على دليل عمل (working directory). +عادةً ما يكون القيام بذلك أمراً بسيطاً. +من أجل استنساخ (clone) مستودعك (repository) لإنشاء مستودع مجرد جديد، تقوم بتشغيل أمر الاستنساخ (clone command) مع الخيار `--bare`.(((git commands, clone, bare))) +حسب الاصطلاح (By convention)، تنتهي أسماء أدلة المستودعات المجردة (bare repository directory names) باللاحقة `.git`، هكذا: [source,console] ---- @@ -21,41 +21,41 @@ Cloning into bare repository 'my_project.git'... done. ---- -You should now have a copy of the Git directory data in your `my_project.git` directory. +يجب أن يكون لديك الآن نسخة من بيانات دليل Git (Git directory data) في دليلك `my_project.git`. -This is roughly equivalent to something like: +هذا يعادل تقريباً شيئاً مثل: [source,console] ---- $ cp -Rf my_project/.git my_project.git ---- -There are a couple of minor differences in the configuration file but, for your purpose, this is close to the same thing. -It takes the Git repository by itself, without a working directory, and creates a directory specifically for it alone. +هناك بعض الاختلافات الطفيفة (minor differences) في ملف التكوين (configuration file) ولكن، بالنسبة للغرض الذي تريده، هذا قريب من نفس الشيء. +إنه يأخذ مستودع Git (Git repository) بمفرده، بدون دليل عمل (working directory)، وينشئ دليلاً (directory) مخصصاً له وحده. [[_bare_repo]] -==== Putting the Bare Repository on a Server +==== Putting the Bare Repository on a Server (وضع المستودع المجرد على خادم) -Now that you have a bare copy of your repository, all you need to do is put it on a server and set up your protocols. -Let's say you've set up a server called `git.example.com` to which you have SSH access, and you want to store all your Git repositories under the `/srv/git` directory. -Assuming that `/srv/git` exists on that server, you can set up your new repository by copying your bare repository over: +الآن بعد أن أصبح لديك نسخة مجردة (bare copy) من مستودعك، كل ما عليك فعله هو وضعها على خادم (server) وإعداد بروتوكولاتك (protocols). +لنفترض أنك أعددت خادماً يسمى `git.example.com` لديك وصول عبر SSH (SSH access) إليه، وتريد تخزين جميع مستودعات Git (Git repositories) الخاصة بك ضمن الدليل (directory) `/srv/git`. +بافتراض أن `/srv/git` موجود على ذلك الخادم، يمكنك إعداد مستودعك الجديد عن طريق نسخ (copying) مستودعك المجرد إليه: [source,console] ---- $ scp -r my_project.git user@git.example.com:/srv/git ---- -At this point, other users who have SSH-based read access to the `/srv/git` directory on that server can clone your repository by running: +في هذه المرحلة، يمكن للمستخدمين الآخرين الذين لديهم وصول قراءة (read access) مستند إلى SSH (SSH-based) إلى الدليل `/srv/git` على ذلك الخادم استنساخ (clone) مستودعك عن طريق تشغيل: [source,console] ---- $ git clone user@git.example.com:/srv/git/my_project.git ---- -If a user SSHs into a server and has write access to the `/srv/git/my_project.git` directory, they will also automatically have push access. +إذا قام مستخدم بتسجيل الدخول عبر SSH إلى الخادم وكان لديه وصول كتابة (write access) إلى الدليل `/srv/git/my_project.git`، فسيكون لديه أيضاً تلقائياً وصول للدفع (push access). -Git will automatically add group write permissions to a repository properly if you run the `git init` command with the `--shared` option. -Note that by running this command, you will not destroy any commits, refs, etc. in the process.(((git commands, init, bare))) +سيقوم Git تلقائياً بإضافة أذونات كتابة المجموعة (group write permissions) إلى مستودع بشكل صحيح إذا قمت بتشغيل الأمر `git init` مع الخيار `--shared`. +لاحظ أنه بتشغيل هذا الأمر، لن تقوم بتدمير أي عمليات تأكيد (commits)، أو مراجع (refs)، إلخ في العملية.(((git commands, init, bare))) [source,console] ---- @@ -64,38 +64,38 @@ $ cd /srv/git/my_project.git $ git init --bare --shared ---- -You see how easy it is to take a Git repository, create a bare version, and place it on a server to which you and your collaborators have SSH access. -Now you're ready to collaborate on the same project. +ترى كم هو سهل أخذ مستودع Git، وإنشاء نسخة مجردة (bare version)، ووضعها على خادم (server) تمتلك أنت والمتعاونون معك إمكانية الوصول إليه عبر SSH (SSH access). +الآن أنت مستعد للتعاون (collaborate) في نفس المشروع. -It's important to note that this is literally all you need to do to run a useful Git server to which several people have access -- just add SSH-able accounts on a server, and stick a bare repository somewhere that all those users have read and write access to. -You're ready to go -- nothing else needed. +من المهم ملاحظة أن هذا هو حرفياً كل ما تحتاج للقيام به لتشغيل خادم Git (Git server) مفيد يتمتع به العديد من الأشخاص بإمكانية الوصول (access) -- ما عليك سوى إضافة حسابات قادرة على SSH (SSH-able accounts) على خادم، ووضع مستودع مجرد (bare repository) في مكان يمتلك فيه جميع هؤلاء المستخدمين وصولاً للقراءة والكتابة (read and write access). +أنت مستعد للبدء -- لا حاجة لشيء آخر. -In the next few sections, you'll see how to expand to more sophisticated setups. -This discussion will include not having to create user accounts for each user, adding public read access to repositories, setting up web UIs and more. -However, keep in mind that to collaborate with a couple of people on a private project, all you _need_ is an SSH server and a bare repository. +في الأقسام القليلة التالية، سترى كيفية التوسع إلى إعدادات (setups) أكثر تطوراً. +ستشمل هذه المناقشة عدم الاضطرار إلى إنشاء حسابات مستخدمين (user accounts) لكل مستخدم، وإضافة وصول قراءة عام (public read access) للمستودعات، وإعداد واجهات مستخدم الويب (web UIs) والمزيد. +ومع ذلك، ضع في اعتبارك أنه للتعاون مع شخصين في مشروع خاص، كل ما _تحتاجه_ هو خادم SSH (SSH server) ومستودع مجرد (bare repository). -==== Small Setups +==== Small Setups (إعدادات صغيرة) -If you're a small outfit or are just trying out Git in your organization and have only a few developers, things can be simple for you. -One of the most complicated aspects of setting up a Git server is user management. -If you want some repositories to be read-only for certain users and read/write for others, access and permissions can be a bit more difficult to arrange. +إذا كنت مؤسسة صغيرة أو كنت تحاول استخدام Git في مؤسستك ولديك عدد قليل فقط من المطورين (developers)، فيمكن أن تكون الأمور بسيطة بالنسبة لك. +أحد أكثر الجوانب تعقيداً في إعداد خادم Git (Git server) هو إدارة المستخدمين (user management). +إذا كنت تريد أن تكون بعض المستودعات (repositories) للقراءة فقط (read-only) لبعض المستخدمين وللقراءة/الكتابة (read/write) للآخرين، فقد يكون من الأصعب قليلاً ترتيب الوصول (access) والأذونات (permissions). -===== SSH Access +===== SSH Access (وصول SSH) (((serving repositories, SSH))) -If you have a server to which all your developers already have SSH access, it's generally easiest to set up your first repository there, because you have to do almost no work (as we covered in the last section). -If you want more complex access control type permissions on your repositories, you can handle them with the normal filesystem permissions of your server's operating system. +إذا كان لديك خادم يمتلك جميع مطوريك بالفعل إمكانية الوصول إليه عبر SSH (SSH access)، فمن الأسهل عموماً إعداد مستودعك الأول هناك، لأنه لا يتعين عليك القيام بأي عمل تقريباً (كما غطينا في القسم الأخير). +إذا كنت تريد أذونات (permissions) من نوع التحكم في الوصول (access control) أكثر تعقيداً في مستودعاتك، فيمكنك التعامل معها باستخدام أذونات نظام الملفات (filesystem permissions) العادية لنظام تشغيل (operating system) الخادم الخاص بك. -If you want to place your repositories on a server that doesn't have accounts for everyone on your team for whom you want to grant write access, then you must set up SSH access for them. -We assume that if you have a server with which to do this, you already have an SSH server installed, and that's how you're accessing the server. +إذا كنت تريد وضع مستودعاتك (repositories) على خادم لا يحتوي على حسابات (accounts) لكل شخص في فريقك ترغب في منحه إمكانية وصول للكتابة (write access)، فيجب عليك إعداد وصول SSH لهم. +نفترض أنه إذا كان لديك خادم لتقوم بذلك، فلديك بالفعل خادم SSH (SSH server) مثبتاً، وهذه هي الطريقة التي تصل بها إلى الخادم. -There are a few ways you can give access to everyone on your team. -The first is to set up accounts for everybody, which is straightforward but can be cumbersome. -You may not want to run `adduser` (or the possible alternative `useradd`) and have to set temporary passwords for every new user. +هناك عدة طرق يمكنك من خلالها منح حق الوصول (give access) لكل شخص في فريقك. +الأولى هي إعداد حسابات (accounts) للجميع، وهي طريقة مباشرة ولكن يمكن أن تكون مرهقة. +قد لا ترغب في تشغيل `adduser` (أو البديل المحتمل `useradd`) والاضطرار إلى تعيين كلمات مرور مؤقتة (temporary passwords) لكل مستخدم جديد. -A second method is to create a single 'git' user account on the machine, ask every user who is to have write access to send you an SSH public key, and add that key to the `~/.ssh/authorized_keys` file of that new 'git' account. -At that point, everyone will be able to access that machine via the 'git' account. -This doesn't affect the commit data in any way -- the SSH user you connect as doesn't affect the commits you've recorded. +طريقة ثانية هي إنشاء حساب مستخدم `git` (git user account) واحد على الجهاز، والطلب من كل مستخدم من المقرر أن يكون لديه وصول للكتابة (write access) إرسال مفتاح عام لـ SSH (SSH public key) إليك، وإضافة هذا المفتاح إلى ملف `~/.ssh/authorized_keys` الخاص بحساب `git` الجديد ذلك. +عند هذه النقطة، سيتمكن الجميع من الوصول إلى ذلك الجهاز عبر حساب `git`. +هذا لا يؤثر على بيانات التأكيد (commit data) بأي شكل من الأشكال -- مستخدم SSH الذي تتصل كـ (connect as) لا يؤثر على عمليات التأكيد (commits) التي قمت بتسجيلها. -Another way to do it is to have your SSH server authenticate from an LDAP server or some other centralized authentication source that you may already have set up. -As long as each user can get shell access on the machine, any SSH authentication mechanism you can think of should work. +طريقة أخرى للقيام بذلك هي جعل خادم SSH (SSH server) الخاص بك يصادق (authenticate) من خادم LDAP (LDAP server) أو بعض مصادر المصادقة المركزية (centralized authentication source) الأخرى التي ربما قمت بإعدادها بالفعل. +طالما أن كل مستخدم يمكنه الحصول على وصول إلى القشرة (shell access) على الجهاز، فإن أي آلية مصادقة SSH (SSH authentication mechanism) يمكنك التفكير فيها يجب أن تعمل. diff --git a/book/04-git-server/sections/gitlab.asc b/book/04-git-server/sections/gitlab.asc index 97de78937..6ffe1d608 100644 --- a/book/04-git-server/sections/gitlab.asc +++ b/book/04-git-server/sections/gitlab.asc @@ -1,130 +1,130 @@ -=== GitLab +=== GitLab (جيت لاب) (((serving repositories, GitLab)))(((GitLab))) -GitWeb is pretty simplistic though. -If you're looking for a modern, fully featured Git server, there are several open source solutions out there that you can install instead. -As GitLab is one of the popular ones, we'll cover installing and using it as an example. -This is harder than the GitWeb option and will require more maintenance, but it is a fully featured option. +GitWeb هو بسيط جداً على الرغم من ذلك. +إذا كنت تبحث عن خادم Git حديث (modern Git server) وكامل الميزات (fully featured)، فهناك العديد من الحلول مفتوحة المصدر (open source solutions) المتاحة التي يمكنك تثبيتها بدلاً من ذلك. +نظراً لأن GitLab هو أحد الحلول الشائعة، فسنغطي تثبيته (installing) واستخدامه (using) كمثال. +هذا الخيار أصعب من خيار GitWeb وسيتطلب مزيداً من الصيانة (maintenance)، ولكنه خيار كامل الميزات. -==== Installation +==== Installation (التثبيت) -GitLab is a database-backed web application, so its installation is more involved than some other Git servers. -Fortunately, this process is well-documented and supported. -GitLab strongly recommends installing GitLab on your server via the official Omnibus GitLab package. +GitLab هو تطبيق ويب مدعوم بقاعدة بيانات (database-backed web application)، لذا فإن تثبيته أكثر تعقيداً من بعض خوادم Git الأخرى. +لحسن الحظ، هذه العملية موثقة جيداً (well-documented) ومدعومة (supported). +يوصي GitLab بشدة بتثبيت GitLab على الخادم (server) الخاص بك عبر حزمة Omnibus GitLab الرسمية. -The other installation options are: +خيارات التثبيت الأخرى هي: -* GitLab Helm chart, for use with Kubernetes. -* Dockerized GitLab packages for use with Docker. -* From the source files. -* Cloud providers such as AWS, Google Cloud Platform, Azure, OpenShift and Digital Ocean. +* مخطط (GitLab Helm chart)، للاستخدام مع Kubernetes. +* حزم GitLab المعبأة في حاويات (Dockerized GitLab packages) للاستخدام مع Docker. +* من ملفات المصدر (source files). +* موفرو الخدمات السحابية (Cloud providers) مثل AWS و Google Cloud Platform و Azure و OpenShift و Digital Ocean. -For more information read the https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/README.md[GitLab Community Edition (CE) readme^]. +لمزيد من المعلومات، اقرأ https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/README.md[ملف التعليمات (readme) الخاص بإصدار مجتمع GitLab (GitLab Community Edition (CE))^]. -==== Administration +==== Administration (الإدارة) -GitLab's administration interface is accessed over the web. -Simply point your browser to the hostname or IP address where GitLab is installed, and log in as the `root` user. -The password will depend on your installation type but by default, Omnibus GitLab automatically generates a password for and stores it to /etc/gitlab/initial_root_password for at least 24 hours. -Follow the documentation for more details. -After you've logged in, click the "`Admin area`" icon in the menu at the top right. +يتم الوصول إلى واجهة إدارة (administration interface) GitLab عبر الويب. +ما عليك سوى توجيه متصفحك (browser) إلى اسم المضيف (hostname) أو عنوان IP الذي تم تثبيت GitLab عليه، وتسجيل الدخول (log in) كمستخدم `root`. +ستعتمد كلمة المرور (password) على نوع التثبيت الخاص بك ولكن بشكل افتراضي، تقوم حزمة Omnibus GitLab بإنشاء كلمة مرور (password) تلقائياً وتخزينها في `/etc/gitlab/initial_root_password` لمدة 24 ساعة على الأقل. +اتبع الوثائق (documentation) لمزيد من التفاصيل. +بعد تسجيل الدخول، انقر على أيقونة "`Admin area`" (منطقة الإدارة) في القائمة (menu) أعلى اليمين. [[gitlab_menu]] -.The "`Admin area`" item in the GitLab menu +.The "`Admin area`" item in the GitLab menu (عنصر "`منطقة الإدارة`" في قائمة GitLab) image::images/gitlab-menu.png[The “Admin area” item in the GitLab menu] -===== Users +===== Users (المستخدمون) -Everybody using your GitLab server must have a user account. -User accounts are quite simple, they mainly contain personal information attached to login data. -Each user account has a *namespace*, which is a logical grouping of projects that belong to that user. -If the user +jane+ had a project named +project+, that project's URL would be `http://server/jane/project`. +يجب أن يكون لدى كل شخص يستخدم خادم GitLab الخاص بك حساب مستخدم (user account). +حسابات المستخدمين بسيطة للغاية، فهي تحتوي بشكل أساسي على معلومات شخصية (personal information) مرتبطة ببيانات تسجيل الدخول (login data). +يحتوي كل حساب مستخدم على *مساحة أسماء (namespace)*، وهي تجميع منطقي (logical grouping) للمشاريع (projects) التي تنتمي إلى ذلك المستخدم. +إذا كان لدى المستخدم `jane` مشروع يسمى `project`، فسيكون عنوان URL الخاص بذلك المشروع هو `http://server/jane/project`. [[gitlab_users]] -.The GitLab user administration screen +.The GitLab user administration screen (شاشة إدارة مستخدمي GitLab) image::images/gitlab-users.png[The GitLab user administration screen] -You can remove a user account in two ways: -"`Blocking`" a user prevents them from logging into the GitLab instance, but all of the data under that user's namespace will be preserved, and commits signed with that user's email address will still link back to their profile. +يمكنك إزالة (remove) حساب مستخدم بطريقتين: +يمنع "`Blocking`" (الحظر) المستخدم من تسجيل الدخول (logging in) إلى مثيل GitLab (GitLab instance)، ولكن سيتم الاحتفاظ بجميع البيانات (data) الموجودة ضمن مساحة أسماء (namespace) ذلك المستخدم، وستظل عمليات التأكيد (commits) الموقعة (signed) بعنوان البريد الإلكتروني (email address) الخاص بذلك المستخدم مرتبطة بملفه الشخصي (profile). -"`Destroying`" a user, on the other hand, completely removes them from the database and filesystem. -All projects and data in their namespace is removed, and any groups they own will also be removed. -This is obviously a much more permanent and destructive action, and you will rarely need it. +من ناحية أخرى، يؤدي "`Destroying`" (التدمير) إلى إزالة المستخدم تماماً من قاعدة البيانات (database) ونظام الملفات (filesystem). +تتم إزالة جميع المشاريع والبيانات الموجودة في مساحة الأسماء الخاصة بهم، كما ستتم إزالة أي مجموعات (groups) يمتلكونها. +من الواضح أن هذا إجراء دائم ومدمر (permanent and destructive action) بكثير، ونادراً ما ستحتاج إليه. [[_gitlab_groups_section]] -===== Groups +===== Groups (المجموعات) -A GitLab group is a collection of projects, along with data about how users can access those projects. -Each group has a project namespace (the same way that users do), so if the group +training+ has a project +materials+, its URL would be `http://server/training/materials`. +مجموعة GitLab (GitLab group) هي مجموعة (collection) من المشاريع، جنباً إلى جنب مع بيانات حول كيفية وصول المستخدمين (how users can access) إلى تلك المشاريع. +تحتوي كل مجموعة على مساحة أسماء مشروع (project namespace) (بنفس الطريقة التي يمتلك بها المستخدمون ذلك)، لذلك إذا كان لدى المجموعة `training` مشروع `materials`، فسيكون عنوان URL الخاص بها هو `http://server/training/materials`. [[gitlab_groups]] -.The GitLab group administration screen +.The GitLab group administration screen (شاشة إدارة مجموعات GitLab) image::images/gitlab-groups.png[The GitLab group administration screen] -Each group is associated with a number of users, each of which has a level of permissions for the group's projects and the group itself. -These range from "`Guest`" (issues and chat only) to "`Owner`" (full control of the group, its members, and its projects). -The types of permissions are too numerous to list here, but GitLab has a helpful link on the administration screen. +ترتبط كل مجموعة بعدد من المستخدمين، ولكل منهم مستوى من الأذونات (permissions) لمشاريع المجموعة والمجموعة نفسها. +وتتراوح هذه من "`Guest`" (ضيف - للمشكلات والمحادثة فقط) إلى "`Owner`" (مالك - تحكم كامل في المجموعة وأعضائها ومشاريعها). +أنواع الأذونات (permissions) كثيرة جداً بحيث لا يمكن سردها هنا، ولكن لدى GitLab رابط مفيد (helpful link) على شاشة الإدارة (administration screen). -===== Projects +===== Projects (المشاريع) -A GitLab project roughly corresponds to a single Git repository. -Every project belongs to a single namespace, either a user or a group. -If the project belongs to a user, the owner of the project has direct control over who has access to the project; if the project belongs to a group, the group's user-level permissions will take effect. +يتوافق مشروع GitLab بشكل تقريبي مع مستودع Git (Git repository) واحد. +ينتمي كل مشروع إلى مساحة أسماء (namespace) واحدة، إما مستخدم (user) أو مجموعة (group). +إذا كان المشروع ينتمي إلى مستخدم، فإن مالك (owner) المشروع لديه تحكم مباشر (direct control) في من لديه حق الوصول إلى المشروع؛ وإذا كان المشروع ينتمي إلى مجموعة، فستسري أذونات مستوى المستخدم (user-level permissions) الخاصة بالمجموعة. -Every project has a visibility level, which controls who has read access to that project's pages and repository. -If a project is _Private_, the project's owner must explicitly grant access to specific users. -An _Internal_ project is visible to any logged-in user, and a _Public_ project is visible to anyone. -Note that this controls both `git fetch` access as well as access to the web UI for that project. +يحتوي كل مشروع على مستوى رؤية (visibility level)، والذي يتحكم في من لديه وصول للقراءة (read access) إلى صفحات ذلك المشروع ومستودعه. +إذا كان المشروع _Private_ (خاصاً)، يجب على مالك المشروع منح حق الوصول (grant access) صراحةً لمستخدمين محددين (specific users). +يكون المشروع _Internal_ (الداخلي) مرئياً لأي مستخدم قام بتسجيل الدخول (logged-in user)، ويكون المشروع _Public_ (العام) مرئياً لأي شخص. +لاحظ أن هذا يتحكم في كل من وصول `git fetch` بالإضافة إلى الوصول إلى واجهة مستخدم الويب (web UI) لذلك المشروع. -===== Hooks +===== Hooks (المشغلات) -GitLab includes support for hooks, both at a project or system level. -For either of these, the GitLab server will perform an HTTP POST with some descriptive JSON whenever relevant events occur. -This is a great way to connect your Git repositories and GitLab instance to the rest of your development automation, such as CI servers, chat rooms, or deployment tools. +يتضمن GitLab دعماً للمشغلات (hooks)، سواء على مستوى المشروع أو مستوى النظام. +بالنسبة لأي منهما، سيقوم خادم GitLab (GitLab server) بإجراء HTTP POST مع بعض ملفات JSON الوصفية (descriptive JSON) كلما وقعت أحداث (events) ذات صلة. +هذه طريقة رائعة لربط مستودعات Git (Git repositories) ومثيل GitLab الخاص بك ببقية أدوات أتمتة التطوير (development automation) الخاصة بك، مثل خوادم التكامل المستمر (CI servers) أو غرف الدردشة (chat rooms) أو أدوات النشر (deployment tools). -==== Basic Usage +==== Basic Usage (الاستخدام الأساسي) -The first thing you'll want to do with GitLab is create a new project. -You can do this by clicking on the "`+`" icon on the toolbar. -You'll be asked for the project's name, which namespace it should belong to, and what its visibility level should be. -Most of what you specify here isn't permanent, and can be changed later through the settings interface. -Click "`Create Project`", and you're done. +أول شيء سترغب في القيام به مع GitLab هو إنشاء مشروع جديد. +يمكنك القيام بذلك بالنقر فوق أيقونة "`+`" في شريط الأدوات (toolbar). +سيُطلب منك إدخال اسم المشروع، ومساحة الأسماء (namespace) التي يجب أن ينتمي إليها، وما يجب أن يكون عليه مستوى رؤيته (visibility level). +معظم ما تحدده هنا ليس دائماً، ويمكن تغييره لاحقاً من خلال واجهة الإعدادات (settings interface). +انقر فوق "`Create Project`" (إنشاء مشروع)، وبذلك تكون قد انتهيت. -Once the project exists, you'll probably want to connect it with a local Git repository. -Each project is accessible over HTTPS or SSH, either of which can be used to configure a Git remote. -The URLs are visible at the top of the project's home page. -For an existing local repository, this command will create a remote named `gitlab` to the hosted location: +بمجرد وجود المشروع، ربما سترغب في ربطه بمستودع Git محلي (local Git repository). +يمكن الوصول إلى كل مشروع عبر HTTPS أو SSH، ويمكن استخدام أي منهما لتكوين جهاز تحكم عن بعد (configure a Git remote) لـ Git. +عناوين URL مرئية في الجزء العلوي من الصفحة الرئيسية للمشروع (project's home page). +بالنسبة لمستودع محلي موجود، سيقوم هذا الأمر بإنشاء جهاز تحكم عن بعد يسمى `gitlab` إلى الموقع المستضاف (hosted location): [source,console] ---- $ git remote add gitlab https://server/namespace/project.git ---- -If you don't have a local copy of the repository, you can simply do this: +إذا لم يكن لديك نسخة محلية من المستودع، فيمكنك ببساطة القيام بذلك: [source,console] ---- $ git clone https://server/namespace/project.git ---- -The web UI provides access to several useful views of the repository itself. -Each project's home page shows recent activity, and links along the top will lead you to views of the project's files and commit log. +توفر واجهة مستخدم الويب (web UI) وصولاً إلى العديد من طرق العرض المفيدة للمستودع نفسه. +تُظهر الصفحة الرئيسية (home page) لكل مشروع النشاط الأخير (recent activity)، وستقودك الروابط الموجودة على طول الجزء العلوي إلى طرق عرض لملفات المشروع (project's files) وسجل التأكيد (commit log). -==== Working Together +==== Working Together (العمل معاً) -The simplest way of working together on a GitLab project is by giving each user direct push access to the Git repository. -You can add a user to a project by going to the "`Members`" section of that project's settings, and associating the new user with an access level (the different access levels are discussed a bit in <<_gitlab_groups_section>>). -By giving a user an access level of "`Developer`" or above, that user can push commits and branches directly to the repository. +أبسط طريقة للعمل معاً في مشروع GitLab هي منح كل مستخدم وصول دفع مباشر (direct push access) إلى مستودع Git. +يمكنك إضافة مستخدم إلى مشروع بالانتقال إلى قسم "`Members`" (الأعضاء) في إعدادات (settings) ذلك المشروع، وربط المستخدم الجديد بمستوى وصول (access level) (تتم مناقشة مستويات الوصول المختلفة قليلاً في <<_gitlab_groups_section>>). +من خلال منح مستخدم مستوى وصول "`Developer`" (مطور) أو أعلى، يمكن لذلك المستخدم دفع عمليات التأكيد والفروع (push commits and branches) مباشرة إلى المستودع (repository). -Another, more decoupled way of collaboration is by using merge requests. -This feature enables any user that can see a project to contribute to it in a controlled way. -Users with direct access can simply create a branch, push commits to it, and open a merge request from their branch back into `master` or any other branch. -Users who don't have push permissions for a repository can "`fork`" it to create their own copy, push commits to _their_ copy, and open a merge request from their fork back to the main project. -This model allows the owner to be in full control of what goes into the repository and when, while allowing contributions from untrusted users. +طريقة أخرى منفصلة (decoupled) للتعاون هي استخدام طلبات الدمج (merge requests). +تمكّن هذه الميزة (feature) أي مستخدم يمكنه رؤية مشروع من المساهمة (contribute) فيه بطريقة خاضعة للرقابة (controlled way). +يمكن للمستخدمين الذين لديهم وصول مباشر ببساطة إنشاء فرع (create a branch)، ودفع عمليات التأكيد (push commits) إليه، وفتح طلب دمج (open a merge request) من فرعهم مرة أخرى إلى `master` أو أي فرع آخر. +يمكن للمستخدمين الذين ليس لديهم أذونات دفع (push permissions) لمستودع "`نسخه احتياطياً`" ("`fork`") لإنشاء نسختهم (copy) الخاصة، ودفع عمليات التأكيد إلى نسختهم _الخاصة_، وفتح طلب دمج من نسختهم (fork) مرة أخرى إلى المشروع الرئيسي (main project). +يسمح هذا النموذج (model) للمالك (owner) بالتحكم الكامل (full control) فيما يدخل في المستودع ومتى، مع السماح بالمساهمات من مستخدمين غير موثوق بهم (untrusted users). -Merge requests and issues are the main units of long-lived discussion in GitLab. -Each merge request allows a line-by-line discussion of the proposed change (which supports a lightweight kind of code review), as well as a general overall discussion thread. -Both can be assigned to users, or organized into milestones. +طلبات الدمج والمشكلات (Merge requests and issues) هي الوحدات الرئيسية للمناقشة طويلة الأمد (long-lived discussion) في GitLab. +يسمح كل طلب دمج بمناقشة (discussion) التغيير المقترح سطراً بسطر (line-by-line) (والذي يدعم نوعاً خفيفاً من مراجعة الكود (code review))، بالإضافة إلى موضوع مناقشة عام (general overall discussion thread). +يمكن تعيين كليهما للمستخدمين، أو تنظيمهما في معالم (milestones). -This section is focused mainly on the Git-related features of GitLab, but as a mature project, it provides many other features to help your team work together, such as project wikis and system maintenance tools. -One benefit to GitLab is that, once the server is set up and running, you'll rarely need to tweak a configuration file or access the server via SSH; most administration and general usage can be done through the in-browser interface. +يركز هذا القسم بشكل أساسي على ميزات (features) GitLab المتعلقة بـ Git، ولكن كمشروع ناضج (mature project)، فإنه يوفر العديد من الميزات الأخرى لمساعدة فريقك على العمل معاً، مثل مواقع wiki للمشاريع (project wikis) وأدوات صيانة النظام (system maintenance tools). +تتمثل إحدى فوائد GitLab في أنه بمجرد إعداد الخادم (server) وتشغيله، نادراً ما ستحتاج إلى تعديل ملف تكوين (configuration file) أو الوصول إلى الخادم عبر SSH؛ حيث يمكن إجراء معظم الإدارة (administration) والاستخدام العام من خلال واجهة المتصفح (in-browser interface). diff --git a/book/04-git-server/sections/gitweb.asc b/book/04-git-server/sections/gitweb.asc index 1565dc498..1c92dfbe8 100644 --- a/book/04-git-server/sections/gitweb.asc +++ b/book/04-git-server/sections/gitweb.asc @@ -1,17 +1,17 @@ -=== GitWeb +=== GitWeb (جيت ويب) (((serving repositories, GitWeb)))(((GitWeb))) -Now that you have basic read/write and read-only access to your project, you may want to set up a simple web-based visualizer. -Git comes with a CGI script called GitWeb that is sometimes used for this. +الآن بعد أن أصبح لديك وصول أساسي للقراءة/الكتابة (read/write) والقراءة فقط (read-only) إلى مشروعك، قد ترغب في إعداد واجهة مرئية (visualizer) بسيطة قائمة على الويب (web-based). +يأتي Git مزوداً ببرنامج نصي لـ CGI (CGI script) يسمى GitWeb يُستخدم أحياناً لهذا الغرض. [[gitweb]] -.The GitWeb web-based user interface +.The GitWeb web-based user interface (واجهة مستخدم GitWeb المستندة إلى الويب) image::images/git-instaweb.png[The GitWeb web-based user interface] -If you want to check out what GitWeb would look like for your project, Git comes with a command to fire up a temporary instance if you have a lightweight web server on your system like `lighttpd` or `webrick`. -On Linux machines, `lighttpd` is often installed, so you may be able to get it to run by typing `git instaweb` in your project directory. -If you're running macOS, Leopard comes preinstalled with Ruby, so `webrick` may be your best bet. -To start `instaweb` with a non-lighttpd handler, you can run it with the `--httpd` option.(((git commands, instaweb))) +إذا كنت ترغب في التحقق من شكل GitWeb لمشروعك، فإن Git يأتي مع أمر (command) لتشغيل مثيل مؤقت (temporary instance) إذا كان لديك خادم ويب خفيف الوزن (lightweight web server) على نظامك مثل `lighttpd` أو `webrick`. +على أجهزة Linux (Linux machines)، غالباً ما يكون `lighttpd` مثبتاً، لذا قد تتمكن من تشغيله بكتابة `git instaweb` في دليل مشروعك (project directory). +إذا كنت تقوم بتشغيل macOS، فإن Leopard يأتي مثبتاً عليه مسبقاً Ruby، لذلك قد يكون `webrick` هو خيارك الأفضل. +لبدء `instaweb` بمعالج (handler) غير `lighttpd`، يمكنك تشغيله باستخدام الخيار `--httpd`.(((git commands, instaweb))) [source,console] ---- @@ -20,19 +20,19 @@ $ git instaweb --httpd=webrick [2009-02-21 10:02:21] INFO ruby 1.8.6 (2008-03-03) [universal-darwin9.0] ---- -That starts up an HTTPD server on port 1234 and then automatically starts a web browser that opens on that page. -It's pretty easy on your part. -When you're done and want to shut down the server, you can run the same command with the `--stop` option: +يؤدي ذلك إلى بدء تشغيل خادم HTTPD (HTTPD server) على المنفذ (port) 1234 ثم بدء تشغيل متصفح ويب (web browser) تلقائياً يفتح على تلك الصفحة. +هذا سهل جداً من جانبك. +عندما تنتهي وتريد إيقاف تشغيل الخادم (shut down the server)، يمكنك تشغيل نفس الأمر (command) مع الخيار `--stop`: [source,console] ---- $ git instaweb --httpd=webrick --stop ---- -If you want to run the web interface on a server all the time for your team or for an open source project you're hosting, you'll need to set up the CGI script to be served by your normal web server. -Some Linux distributions have a `gitweb` package that you may be able to install via `apt` or `dnf`, so you may want to try that first. -We'll walk through installing GitWeb manually very quickly. -First, you need to get the Git source code, which GitWeb comes with, and generate the custom CGI script: +إذا كنت ترغب في تشغيل واجهة الويب (web interface) على خادم (server) طوال الوقت لفريقك أو لمشروع مفتوح المصدر (open source project) تستضيفه (hosting)، فستحتاج إلى إعداد البرنامج النصي لـ CGI (CGI script) ليتم تقديمه (served) بواسطة خادم الويب (web server) العادي الخاص بك. +تحتوي بعض توزيعات Linux (Linux distributions) على حزمة (package) `gitweb` قد تتمكن من تثبيتها عبر `apt` أو `dnf`، لذا قد ترغب في تجربة ذلك أولاً. +سنستعرض تثبيت GitWeb يدوياً (manually) بسرعة كبيرة. +أولاً، تحتاج إلى الحصول على الكود المصدري (source code) لـ Git، والذي يأتي GitWeb معه، وإنشاء البرنامج النصي المخصص (custom CGI script) لـ CGI: [source,console] ---- @@ -47,8 +47,8 @@ make[2]: `GIT-VERSION-FILE' is up to date. $ sudo cp -Rf gitweb /var/www/ ---- -Notice that you have to tell the command where to find your Git repositories with the `GITWEB_PROJECTROOT` variable. -Now, you need to make Apache use CGI for that script, for which you can add a VirtualHost: +لاحظ أنه يجب عليك إخبار الأمر (command) بمكان العثور على مستودعات Git (Git repositories) الخاصة بك باستخدام المتغير (variable) `GITWEB_PROJECTROOT`. +الآن، تحتاج إلى جعل Apache يستخدم CGI لذلك البرنامج النصي (script)، والذي يمكنك إضافة VirtualHost من أجله: [source,console] ---- @@ -66,5 +66,5 @@ Now, you need to make Apache use CGI for that script, for which you can add a Vi ---- -Again, GitWeb can be served with any CGI or Perl capable web server; if you prefer to use something else, it shouldn't be difficult to set up. -At this point, you should be able to visit `http://gitserver/` to view your repositories online. +مرة أخرى، يمكن تقديم (served) GitWeb باستخدام أي خادم ويب (web server) يدعم CGI أو Perl؛ إذا كنت تفضل استخدام شيء آخر، فلا ينبغي أن يكون إعداده صعباً. +في هذه المرحلة، يجب أن تكون قادراً على زيارة `http://gitserver/` لعرض مستودعاتك (repositories) عبر الإنترنت (online). diff --git a/book/04-git-server/sections/hosted.asc b/book/04-git-server/sections/hosted.asc index 54eb79334..c7608281c 100644 --- a/book/04-git-server/sections/hosted.asc +++ b/book/04-git-server/sections/hosted.asc @@ -1,10 +1,10 @@ -=== Third Party Hosted Options +=== Third Party Hosted Options (خيارات الاستضافة من جهات خارجية) -If you don't want to go through all of the work involved in setting up your own Git server, you have several options for hosting your Git projects on an external dedicated hosting site. -Doing so offers a number of advantages: a hosting site is generally quick to set up and easy to start projects on, and no server maintenance or monitoring is involved. -Even if you set up and run your own server internally, you may still want to use a public hosting site for your open source code -- it's generally easier for the open source community to find and help you with. +إذا كنت لا ترغب في الخوض في كل العمل (work) الذي ينطوي عليه إعداد خادم Git (Git server) الخاص بك، فلديك العديد من الخيارات (options) لاستضافة مشاريع Git (Git projects) الخاصة بك على موقع استضافة مخصص (dedicated hosting site) خارجي. +القيام بذلك يوفر عدداً من المزايا (advantages): موقع الاستضافة سريع عموماً في الإعداد وسهل في بدء المشاريع (projects) عليه، ولا ينطوي على صيانة خادم (server maintenance) أو مراقبة (monitoring). +حتى إذا قمت بإعداد (set up) خادمك (server) الخاص وتشغيله داخلياً (internally)، فقد ترغب في استخدام موقع استضافة عام (public hosting site) للكود المصدري المفتوح (open source code) الخاص بك -- عادةً ما يكون من الأسهل على مجتمع المصادر المفتوحة (open source community) العثور عليك ومساعدتك. -These days, you have a huge number of hosting options to choose from, each with different advantages and disadvantages. -To see an up-to-date list, check out the GitHosting page on the main Git wiki at https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitHosting.html[^]. +في هذه الأيام، لديك عدد كبير من خيارات الاستضافة (hosting options) للاختيار من بينها، ولكل منها مزايا وعيوب (advantages and disadvantages) مختلفة. +للاطلاع على قائمة محدثة (up-to-date list)، تحقق من صفحة GitHosting على موقع ويكي Git الرئيسي (main Git wiki) على https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitHosting.html[^]. -We'll cover using GitHub in detail in <>, as it is the largest Git host out there and you may need to interact with projects hosted on it in any case, but there are dozens more to choose from should you not want to set up your own Git server. +سنغطي استخدام GitHub بالتفصيل (in detail) في <>، لأنه أكبر مضيف Git (Git host) موجود وقد تحتاج إلى التفاعل مع المشاريع (projects) المستضافة عليه على أي حال، ولكن هناك العشرات للاختيار من بينها إذا كنت لا ترغب في إعداد (set up) خادم Git (Git server) الخاص بك. diff --git a/book/04-git-server/sections/protocols.asc b/book/04-git-server/sections/protocols.asc index ff226d1e6..475110708 100644 --- a/book/04-git-server/sections/protocols.asc +++ b/book/04-git-server/sections/protocols.asc @@ -1,98 +1,209 @@ -=== The Protocols +=== The Protocols (البروتوكولات) -Git can use four distinct protocols to transfer data: Local, HTTP, Secure Shell (SSH) and Git. -Here we'll discuss what they are and in what basic circumstances you would want (or not want) to use them. +يمكن لـ Git استخدام أربعة بروتوكولات (protocols) مميزة لنقل البيانات: المحلي (Local)، بروتوكول نقل النص الفائق (HTTP)، قشرة آمنة (SSH) و Git. +هنا سنناقش ما هي وفي أي ظروف أساسية قد ترغب (أو لا ترغب) في استخدامها. -==== Local Protocol +==== Local Protocol (البروتوكول المحلي) (((protocols, local))) -The most basic is the _Local protocol_, in which the remote repository is in another directory on the same host. -This is often used if everyone on your team has access to a shared filesystem such as an https://en.wikipedia.org/wiki/Network_File_System[NFS^] mount, or in the less likely case that everyone logs in to the same computer. -The latter wouldn't be ideal, because all your code repository instances would reside on the same computer, making a catastrophic loss much more likely. +أبسطها هو _البروتوكول المحلي (Local protocol)_، حيث يكون المستودع البعيد (remote repository) في دليل آخر على نفس المضيف (same host). +يُستخدم هذا غالباً إذا كان لدى كل فرد في فريقك إمكانية الوصول إلى نظام ملفات مشترك (shared filesystem) مثل تحميل https://en.wikipedia.org/wiki/Network_File_System[NFS^]، أو في الحالة الأقل احتمالاً حيث يسجل الجميع الدخول إلى نفس الكمبيوتر. +لن يكون الخيار الأخير مثالياً، لأن جميع مثيلات مستودع الكود (code repository instances) الخاصة بك ستقيم على نفس الكمبيوتر، مما يجعل الفقدان الكارثي أكثر احتمالاً بكثير. -If you have a shared mounted filesystem, then you can clone, push to, and pull from a local file-based repository. -To clone a repository like this, or to add one as a remote to an existing project, use the path to the repository as the URL. -For example, to clone a local repository, you can run something like this: +إذا كان لديك نظام ملفات مشترك محمل (shared mounted filesystem)، فيمكنك الاستنساخ (clone)، والدفع (push) إليه، والسحب (pull) من مستودع محلي قائم على الملفات (local file-based repository). +لاستنساخ (clone) مستودع مثل هذا، أو لإضافته كجهاز تحكم عن بعد (remote) إلى مشروع موجود، استخدم المسار (path) إلى المستودع كعنوان URL. +على سبيل المثال، لاستنساخ مستودع محلي، يمكنك تشغيل شيء مثل هذا: [source,console] ---- $ git clone /srv/git/project.git ---- -Or you can do this: +أو يمكنك القيام بذلك: [source,console] ---- $ git clone file:///srv/git/project.git ---- -Git operates slightly differently if you explicitly specify `file://` at the beginning of the URL. -If you just specify the path, Git tries to use hardlinks or directly copy the files it needs. -If you specify `file://`, Git fires up the processes that it normally uses to transfer data over a network, which is generally much less efficient. -The main reason to specify the `file://` prefix is if you want a clean copy of the repository with extraneous references or objects left out -- generally after an import from another VCS or something similar (see <> for maintenance tasks). -We'll use the normal path here because doing so is almost always faster. +يعمل Git بشكل مختلف قليلاً إذا حددت بشكل صريح `file://` في بداية عنوان URL. +إذا قمت بتحديد المسار (path) فقط، يحاول Git استخدام الارتباطات الثابتة (hardlinks) أو نسخ الملفات التي يحتاجها مباشرة. +إذا حددت `file://`، يقوم Git بتشغيل العمليات (processes) التي يستخدمها عادةً لنقل البيانات عبر الشبكة، وهي عموماً أقل كفاءة بكثير. +السبب الرئيسي لتحديد البادئة `file://` هو إذا كنت تريد نسخة نظيفة (clean copy) من المستودع مع استبعاد المراجع الإضافية (extraneous references) أو الكائنات (objects) متروكة -- عموماً بعد استيراد من نظام VCS آخر أو شيء مشابه (انظر <> لمهام الصيانة). +سنستخدم المسار العادي هنا لأن القيام بذلك يكون أسرع دائماً تقريباً. -To add a local repository to an existing Git project, you can run something like this: + + +السبب الرئيسي لتحديد البادئة `file://` هو إذا كنت تريد نسخة نظيفة (clean copy) من المستودع مع استبعاد المراجع الإضافية (extraneous references) أو الكائنات (objects) -- عموماً بعد استيراد من نظام VCS آخر أو شيء مشابه (انظر <> لمهام الصيانة). +سنستخدم المسار العادي هنا لأن القيام بذلك يكون أسرع دائماً تقريباً. + +لإضافة مستودع محلي إلى مشروع Git موجود، يمكنك تشغيل شيء مثل هذا: [source,console] ---- $ git remote add local_proj /srv/git/project.git ---- -Then, you can push to and pull from that remote via your new remote name `local_proj` as though you were doing so over a network. +بعد ذلك، يمكنك الدفع إلى (push to) والسحب من (pull from) ذلك المستودع البعيد (remote) عبر عنوان الشبكة (network address) الخاص بك كما لو كنت تفعل عبر شبكة. + +===== The Pros (الإيجابيات) + +الإيجابيات (pros) للبروتوكولات المستندة إلى الملفات (file-based protocols) هي أنها بسيطة (simple) وتستخدم ملفات الأذونات الحالية (existing file permissions) والوصول إلى الشبكة (network access). +إذا كان لديك بالفعل نظام ملفات مشترك (shared filesystem) تم إعداده ليتمكن فريقك بأكمله من الوصول إليه، فإن إعداد مستودع (setting up a repository) يكون سهلاً للغاية. +تضع المستودع المجرد (bare repository) في مكان يمكن للجميع الوصول إليه وتعين أذونات القراءة/الكتابة (read/write permissions) كما تفعل لأي دليل (directory) مشترك آخر. +سنناقش كيفية تصدير نسخة من مستودع مجرد لهذا الغرض في <>. + +هذا أيضاً خيار رائع لجلب (grab) عمل من مستودع العمل (working repository) الخاص بشخص آخر بسرعة. +إذا كنت أنت وزميلك في العمل تعملان على نفس المشروع ويريد منك التحقق من شيء ما، فإن تشغيل أمر مثل `git pull /home/john/project` يكون غالباً أسهل من دفعه (pushing) إلى خادم بعيد (remote server) وسحبك (pulling) منه. + +===== The Cons (السلبيات) + +السلبيات (cons) لهذا النهج هي أن الوصول المشترك (shared access) يكون عموماً أكثر صعوبة في الإعداد والوصول إليه من مواقع متعددة (multiple locations) من الوصول الأساسي للشبكة (basic network access). +إذا كنت ترغب في الدفع (push) من الكمبيوتر المحمول (laptop) الخاص بك عندما تكون في المنزل، يجب عليك تركيب (mount) القرص البعيد (remote disk)، وهو ما يمكن أن يكون صعباً وبطيئاً مقارنة بالوصول القائم على الشبكة (network-based access). + +من المهم أيضاً ملاحظة أن استخدام تثبيت (mount) مشترك من نوع ما ليس دائماً الخيار الأسرع إذا كانت العقدة (node) المستندة إلى الشبكة هي المكان الذي يتواجد فيه المجلد (directory) بالفعل. +يعتمد المستودع المحلي على سرعة نظام الملفات (filesystem) في توفير البيانات، بينما يستخدم مستودع الشبكة (network repository) عادةً برامج خفية (daemons) محلية للقرص (local-to-the-disk) يمكنها تلبية الطلبات (requests) بسرعة أكبر عبر الشبكة بدلاً من توجيهها (routing) عبر بروتوكول نظام الملفات (filesystem protocol). + +أخيراً، هذا البروتوكول لا يحمي المستودع من التلف العرضي (accidental damage). +يتمتع كل مستخدم بوصول كامل إلى القشرة (full shell access) للدليل (directory) "`البعيد`" ("`remote`")، ولا يوجد ما يمنعهم من تغيير أو إزالة ملفات Git الداخلية وإفساد المستودع (corrupting the repository). + +==== The HTTP Protocols (بروتوكولات HTTP) + +يمكن لـ Git التواصل عبر HTTP باستخدام وضعين (modes) مختلفين. +قبل Git 1.6.6، كانت هناك طريقة واحدة فقط للقيام بذلك، وكانت بسيطة جداً وعموماً للقراءة فقط (read-only). +في الإصدار 1.6.6، تم تقديم بروتوكول جديد وأكثر ذكاءً يتضمن قدرة Git على التفاوض بذكاء (intelligently negotiate) لنقل البيانات بطريقة مشابهة لكيفية قيامه بذلك عبر SSH. +في السنوات القليلة الماضية، أصبح بروتوكول HTTP الجديد هذا شائعاً جداً لأنه أبسط للمستخدم وأكثر ذكاءً بشأن كيفية تواصله. +غالباً ما يُشار إلى الإصدار الأحدث باسم بروتوكول HTTP _الذكي (Smart)_ والطريقة القديمة باسم HTTP _الغبي (Dumb)_. +سنغطي بروتوكول Smart HTTP الأحدث أولاً. + +===== The Pros (الإيجابيات) + +الإيجابيات (pros) للبروتوكولات المستندة إلى الملفات (file-based protocols) هي أنها بسيطة (simple) وتستخدم ملفات الأذونات الحالية (existing file permissions) والوصول إلى الشبكة (network access). +إذا كان لديك بالفعل نظام ملفات مشترك (shared filesystem) تم إعداده ليتمكن فريقك بأكمله من الوصول إليه، فإن إعداد مستودع (setting up a repository) يكون سهلاً للغاية. +تضع المستودع المجرد (bare repository) في مكان يمكن للجميع الوصول إليه وتعين أذونات القراءة/الكتابة (read/write permissions) كما تفعل لأي دليل (directory) مشترك آخر. +سنناقش كيفية تصدير نسخة من مستودع مجرد لهذا الغرض في <>. + +هذا أيضاً خيار رائع لجلب (grab) عمل من مستودع العمل (working repository) الخاص بشخص آخر بسرعة. +إذا كنت أنت وزميلك في العمل تعملان على نفس المشروع ويريد منك التحقق من شيء ما، فإن تشغيل أمر مثل `git pull /home/john/project` يكون غالباً أسهل من دفعه (pushing) إلى خادم بعيد (remote server) وسحبك (pulling) منه. + +===== The Cons (السلبيات) + +السلبيات (cons) لهذا النهج هي أن الوصول المشترك (shared access) يكون عموماً أكثر صعوبة في الإعداد والوصول إليه من مواقع متعددة (multiple locations) من الوصول الأساسي للشبكة (basic network access). +إذا كنت ترغب في الدفع (push) من الكمبيوتر المحمول (laptop) الخاص بك عندما تكون في المنزل، يجب عليك تركيب (mount) القرص البعيد (remote disk)، وهو ما يمكن أن يكون صعباً وبطيئاً مقارنة بالوصول القائم على الشبكة (network-based access). + +من المهم أيضاً ملاحظة أن استخدام تثبيت (mount) مشترك من نوع ما ليس دائماً الخيار الأسرع إذا كانت العقدة (node) المستندة إلى الشبكة هي المكان الذي يتواجد فيه المجلد (directory) بالفعل. +يعتمد المستودع المحلي على سرعة نظام الملفات (filesystem) في توفير البيانات، بينما يستخدم مستودع الشبكة (network repository) عادةً برامج خفية (daemons) محلية للقرص (local-to-the-disk) يمكنها تلبية الطلبات (requests) بسرعة أكبر عبر الشبكة بدلاً من توجيهها (routing) عبر بروتوكول نظام الملفات (filesystem protocol). + +أخيراً، هذا البروتوكول لا يحمي المستودع من التلف العرضي (accidental damage). +يتمتع كل مستخدم بوصول كامل إلى القشرة (full shell access) للدليل (directory) "`البعيد`" ("`remote`")، ولا يوجد ما يمنعهم من تغيير أو إزالة ملفات Git الداخلية وإفساد المستودع (corrupting the repository). + +==== The HTTP Protocols (بروتوكولات HTTP) + +يمكن لـ Git التواصل عبر HTTP باستخدام وضعين (modes) مختلفين. +قبل Git 1.6.6، كانت هناك طريقة واحدة فقط للقيام بذلك، وكانت بسيطة جداً وعموماً للقراءة فقط (read-only). +في الإصدار 1.6.6، تم تقديم بروتوكول جديد وأكثر ذكاءً يتضمن قدرة Git على التفاوض بذكاء (intelligently negotiate) لنقل البيانات بطريقة مشابهة لكيفية قيامه بذلك عبر SSH. +في السنوات القليلة الماضية، أصبح بروتوكول HTTP الجديد هذا شائعاً جداً لأنه أبسط للمستخدم وأكثر ذكاءً بشأن كيفية تواصله. +غالباً ما يُشار إلى الإصدار الأحدث باسم بروتوكول HTTP _الذكي (Smart)_ والطريقة القديمة باسم HTTP _الغبي (Dumb)_. +سنغطي بروتوكول Smart HTTP الأحدث أولاً. + +===== Smart HTTP (HTTP الذكي) + +(((protocols, smart HTTP))) +يعمل بروتوكول HTTP الذكي (Smart HTTP) بشكل مشابه جداً لبروتوكول SSH أو Git ولكنه يعمل عبر منافذ (ports) HTTPS القياسية ويمكنه استخدام آليات مصادقة (authentication mechanisms) HTTP المختلفة، مما يعني أنه غالباً ما يكون أسهل للمستخدم من شيء مثل SSH، حيث يمكنك استخدام أشياء مثل المصادقة المستندة إلى اسم المستخدم/كلمة المرور (username/password authentication) بدلاً من الاضطرار إلى إعداد مفاتيح SSH (SSH keys). + +لقد أصبح ربما الطريقة الأكثر شيوعاً لاستخدام Git الآن، حيث يمكن إعداده لتقديم (serve) البيانات بشكل مجهول (anonymously) مثل بروتوكول `git://`، ويمكن أيضاً الدفع (pushed over) إليه باستخدام المصادقة (authentication) والتشفير (encryption) مثل بروتوكول SSH. +بدلاً من الاضطرار إلى إعداد عناوين URL مختلفة لهذه الأشياء، يمكنك الآن استخدام عنوان URL واحد لكليهما. +إذا حاولت الدفع (push) وكان المستودع يتطلب مصادقة (والتي ينبغي أن يتطلبها عادةً)، فيمكن للخادم أن يطلب (prompt) اسم المستخدم وكلمة المرور (username and password). +الشيء نفسه ينطبق على الوصول للقراءة (read access). + +في الواقع، بالنسبة للخدمات الشائعة (services) مثل GitHub، فإن عنوان URL الذي تستخدمه لعرض المستودع (view the repository) عبر الإنترنت (على سبيل المثال، https://github.com/schacon/simplegit[^]) هو نفس عنوان URL الذي يمكنك استخدامه للاستنساخ (clone)، وإذا كان لديك حق الوصول، للدفع (push over). + +===== The Pros (الإيجابيات) + +الإيجابيات (pros) للبروتوكولات المستندة إلى الملفات (file-based protocols) هي أنها بسيطة (simple) وتستخدم ملفات الأذونات الحالية (existing file permissions) والوصول إلى الشبكة (network access). +إذا كان لديك بالفعل نظام ملفات مشترك (shared filesystem) تم إعداده ليتمكن فريقك بأكمله من الوصول إليه، فإن إعداد مستودع (setting up a repository) يكون سهلاً للغاية. +تضع المستودع المجرد (bare repository) في مكان يمكن للجميع الوصول إليه وتعين أذونات القراءة/الكتابة (read/write permissions) كما تفعل لأي دليل (directory) مشترك آخر. +سنناقش كيفية تصدير نسخة من مستودع مجرد لهذا الغرض في <>. + +هذا أيضاً خيار رائع لجلب (grab) عمل من مستودع العمل (working repository) الخاص بشخص آخر بسرعة. +إذا كنت أنت وزميلك في العمل تعملان على نفس المشروع ويريد منك التحقق من شيء ما، فإن تشغيل أمر مثل `git pull /home/john/project` يكون غالباً أسهل من دفعه (pushing) إلى خادم بعيد (remote server) وسحبك (pulling) منه. + +===== The Cons (السلبيات) -===== The Pros +السلبيات (cons) لهذا النهج هي أن الوصول المشترك (shared access) يكون عموماً أكثر صعوبة في الإعداد والوصول إليه من مواقع متعددة (multiple locations) من الوصول الأساسي للشبكة (basic network access). +إذا كنت ترغب في الدفع (push) من الكمبيوتر المحمول (laptop) الخاص بك عندما تكون في المنزل، يجب عليك تركيب (mount) القرص البعيد (remote disk)، وهو ما يمكن أن يكون صعباً وبطيئاً مقارنة بالوصول القائم على الشبكة (network-based access). -The pros of file-based repositories are that they're simple and they use existing file permissions and network access. -If you already have a shared filesystem to which your whole team has access, setting up a repository is very easy. -You stick the bare repository copy somewhere everyone has shared access to and set the read/write permissions as you would for any other shared directory. -We'll discuss how to export a bare repository copy for this purpose in <>. +من المهم أيضاً ملاحظة أن استخدام تثبيت (mount) مشترك من نوع ما ليس دائماً الخيار الأسرع إذا كانت العقدة (node) المستندة إلى الشبكة هي المكان الذي يتواجد فيه المجلد (directory) بالفعل. +يعتمد المستودع المحلي على سرعة نظام الملفات (filesystem) في توفير البيانات، بينما يستخدم مستودع الشبكة (network repository) عادةً برامج خفية (daemons) محلية للقرص (local-to-the-disk) يمكنها تلبية الطلبات (requests) بسرعة أكبر عبر الشبكة بدلاً من توجيهها (routing) عبر بروتوكول نظام الملفات (filesystem protocol). -This is also a nice option for quickly grabbing work from someone else's working repository. -If you and a co-worker are working on the same project and they want you to check something out, running a command like `git pull /home/john/project` is often easier than them pushing to a remote server and you subsequently fetching from it. +أخيراً، هذا البروتوكول لا يحمي المستودع من التلف العرضي (accidental damage). +يتمتع كل مستخدم بوصول كامل إلى القشرة (full shell access) للدليل (directory) "`البعيد`" ("`remote`")، ولا يوجد ما يمنعهم من تغيير أو إزالة ملفات Git الداخلية وإفساد المستودع (corrupting the repository). -===== The Cons +==== The HTTP Protocols (بروتوكولات HTTP) -The cons of this method are that shared access is generally more difficult to set up and reach from multiple locations than basic network access. -If you want to push from your laptop when you're at home, you have to mount the remote disk, which can be difficult and slow compared to network-based access. +يمكن لـ Git التواصل عبر HTTP باستخدام وضعين (modes) مختلفين. +قبل Git 1.6.6، كانت هناك طريقة واحدة فقط للقيام بذلك، وكانت بسيطة جداً وعموماً للقراءة فقط (read-only). +في الإصدار 1.6.6، تم تقديم بروتوكول جديد وأكثر ذكاءً يتضمن قدرة Git على التفاوض بذكاء (intelligently negotiate) لنقل البيانات بطريقة مشابهة لكيفية قيامه بذلك عبر SSH. +في السنوات القليلة الماضية، أصبح بروتوكول HTTP الجديد هذا شائعاً جداً لأنه أبسط للمستخدم وأكثر ذكاءً بشأن كيفية تواصله. +غالباً ما يُشار إلى الإصدار الأحدث باسم بروتوكول HTTP _الذكي (Smart)_ والطريقة القديمة باسم HTTP _الغبي (Dumb)_. +سنغطي بروتوكول Smart HTTP الأحدث أولاً. -It's important to mention that this isn't necessarily the fastest option if you're using a shared mount of some kind. -A local repository is fast only if you have fast access to the data. -A repository on NFS is often slower than the repository over SSH on the same server, allowing Git to run off local disks on each system. +===== Smart HTTP (HTTP الذكي) -Finally, this protocol does not protect the repository against accidental damage. -Every user has full shell access to the "`remote`" directory, and there is nothing preventing them from changing or removing internal Git files and corrupting the repository. +(((protocols, smart HTTP))) +يعمل بروتوكول HTTP الذكي (Smart HTTP) بشكل مشابه جداً لبروتوكول SSH أو Git ولكنه يعمل عبر منافذ (ports) HTTPS القياسية ويمكنه استخدام آليات مصادقة (authentication mechanisms) HTTP المختلفة، مما يعني أنه غالباً ما يكون أسهل للمستخدم من شيء مثل SSH، حيث يمكنك استخدام أشياء مثل المصادقة المستندة إلى اسم المستخدم/كلمة المرور (username/password authentication) بدلاً من الاضطرار إلى إعداد مفاتيح SSH (SSH keys). + +لقد أصبح ربما الطريقة الأكثر شيوعاً لاستخدام Git الآن، حيث يمكن إعداده لتقديم (serve) البيانات بشكل مجهول (anonymously) مثل بروتوكول `git://`، ويمكن أيضاً الدفع (pushed over) إليه باستخدام المصادقة (authentication) والتشفير (encryption) مثل بروتوكول SSH. +بدلاً من الاضطرار إلى إعداد عناوين URL مختلفة لهذه الأشياء، يمكنك الآن استخدام عنوان URL واحد لكليهما. +إذا حاولت الدفع (push) وكان المستودع يتطلب مصادقة (والتي ينبغي أن يتطلبها عادةً)، فيمكن للخادم أن يطلب (prompt) اسم المستخدم وكلمة المرور (username and password). +الشيء نفسه ينطبق على الوصول للقراءة (read access). -==== The HTTP Protocols +في الواقع، بالنسبة للخدمات الشائعة (services) مثل GitHub، فإن عنوان URL الذي تستخدمه لعرض المستودع (view the repository) عبر الإنترنت (على سبيل المثال، https://github.com/schacon/simplegit[^]) هو نفس عنوان URL الذي يمكنك استخدامه للاستنساخ (clone)، وإذا كان لديك حق الوصول، للدفع (push over). +==== The HTTP Protocols (بروتوكولات HTTP) -Git can communicate over HTTP using two different modes. -Prior to Git 1.6.6, there was only one way it could do this which was very simple and generally read-only. -In version 1.6.6, a new, smarter protocol was introduced that involved Git being able to intelligently negotiate data transfer in a manner similar to how it does over SSH. -In the last few years, this new HTTP protocol has become very popular since it's simpler for the user and smarter about how it communicates. -The newer version is often referred to as the _Smart_ HTTP protocol and the older way as _Dumb_ HTTP. -We'll cover the newer Smart HTTP protocol first. +(((protocols, http))) +يمكن لـ Git التواصل عبر HTTP باستخدام وضعين (modes) مختلفين. +قبل Git 1.6.6، كانت هناك طريقة واحدة فقط للقيام بذلك، وكانت بسيطة جداً وعموماً للقراءة فقط (read-only). +في الإصدار 1.6.6، تم تقديم بروتوكول جديد وأكثر ذكاءً يتضمن تفاوض (negotiating) Git لنقل البيانات بشكل مشابه لكيفية قيامه بذلك عبر SSH. +في السنوات التي تلت ذلك، أصبح بروتوكول HTTP "`Smart`" (الذكي) الجديد هذا شائعاً بشكل لا يصدق لأنه يوفر بساطة (simplicity) بروتوكول HTTP "`Dumb`" (الغبي) وميزات وأمان (features and security) بروتوكول SSH. +لنتحدث عن بروتوكول Smart HTTP الجديد أولاً. -===== Smart HTTP +===== Smart HTTP (HTTP الذكي) (((protocols, smart HTTP))) -Smart HTTP operates very similarly to the SSH or Git protocols but runs over standard HTTPS ports and can use various HTTP authentication mechanisms, meaning it's often easier on the user than something like SSH, since you can use things like username/password authentication rather than having to set up SSH keys. +يعمل بروتوكول HTTP الذكي (Smart HTTP) بشكل مشابه جداً لبروتوكول SSH أو Git ولكنه يعمل عبر منافذ (ports) HTTPS القياسية ويمكنه استخدام آليات مصادقة (authentication mechanisms) HTTP المختلفة، مما يعني أنه غالباً ما يكون أسهل للمستخدم من شيء مثل SSH، حيث يمكنك استخدام أشياء مثل المصادقة المستندة إلى اسم المستخدم/كلمة المرور (username/password authentication) بدلاً من الاضطرار إلى إعداد مفاتيح SSH (SSH keys). + +لقد أصبح ربما الطريقة الأكثر شيوعاً لاستخدام Git الآن، حيث يمكن إعداده لتقديم (serve) البيانات بشكل مجهول (anonymously) مثل بروتوكول `git://`، ويمكن أيضاً الدفع (pushed over) إليه باستخدام المصادقة (authentication) والتشفير (encryption) مثل بروتوكول SSH. +بدلاً من الاضطرار إلى إعداد عناوين URL مختلفة لهذه الأشياء، يمكنك الآن استخدام عنوان URL واحد لكليهما. +إذا حاولت الدفع (push) وكان المستودع يتطلب مصادقة (والتي ينبغي أن يتطلبها عادةً)، فيمكن للخادم أن يطلب (prompt) اسم المستخدم وكلمة المرور (username and password). +الشيء نفسه ينطبق على الوصول للقراءة (read access). + +في الواقع، بالنسبة للخدمات الشائعة (services) مثل GitHub، فإن عنوان URL الذي تستخدمه لعرض المستودع (view the repository) عبر الإنترنت (على سبيل المثال، https://github.com/schacon/simplegit[^]) هو نفس عنوان URL الذي يمكنك استخدامه للاستنساخ (clone)، وإذا كان لديك حق الوصول، للدفع (push over). +يعمل بروتوكول "`Smart`" HTTP بشكل مشابه جداً لبروتوكول SSH أو Git ولكنه يعمل عبر منافذ (ports) HTTP/S القياسية ويمكنه استخدام آليات مصادقة (authentication mechanisms) HTTP المختلفة، مما يعني أنه غالباً ما يكون أسهل للمستخدم من شيء مثل SSH، حيث يمكنك استخدام المصادقة الأساسية (Basic authentication) المستندة إلى اسم المستخدم/كلمة المرور (username/password) بدلاً من الاضطرار إلى إعداد مفاتيح SSH (SSH keys). -It has probably become the most popular way to use Git now, since it can be set up to both serve anonymously like the `git://` protocol, and can also be pushed over with authentication and encryption like the SSH protocol. -Instead of having to set up different URLs for these things, you can now use a single URL for both. -If you try to push and the repository requires authentication (which it normally should), the server can prompt for a username and password. -The same goes for read access. +لقد أصبح ربما الطريقة الأكثر شيوعاً لاستخدام Git الآن، حيث يمكن إعداده لتقديم (serve) البيانات بشكل مجهول (anonymously) مثل بروتوكول `git://`، ويمكن أيضاً الدفع (pushed to) إليه باستخدام المصادقة (authentication) والتشفير (encryption) مثل بروتوكول SSH. +بدلاً من الاضطرار إلى إعداد عناوين URL مختلفة لهذه الأشياء، يمكنك الآن استخدام عنوان URL واحد لكليهما. +إذا حاولت الدفع (push) ولم يكن المستودع يتطلب مصادقة (authentication) للقراءة (read)، سيطلب الخادم ببساطة اسم المستخدم وكلمة المرور (username and password) أو تفاصيل المصادقة (authentication details) الأخرى لتلك العملية (action). +الشيء نفسه ينطبق على القراءة (read). -In fact, for services like GitHub, the URL you use to view the repository online (for example, https://github.com/schacon/simplegit[^]) is the same URL you can use to clone and, if you have access, push over. +في الواقع، بالنسبة للخدمات الشائعة (popular services) مثل GitHub، سيعطيك عنوان URL الذي ستستخدمه للعرض (view) عبر الإنترنت (عبر متصفح - browser) غالباً ما يكون هو نفس عنوان URL الذي ستستخدمه للاستنساخ (clone) والدفع (push). +هذا يسهل الأمور كثيراً على المستخدمين. -===== Dumb HTTP +===== Dumb HTTP (HTTP الغبي) (((protocols, dumb HTTP))) -If the server does not respond with a Git HTTP smart service, the Git client will try to fall back to the simpler _Dumb_ HTTP protocol. -The Dumb protocol expects the bare Git repository to be served like normal files from the web server. -The beauty of Dumb HTTP is the simplicity of setting it up. -Basically, all you have to do is put a bare Git repository under your HTTP document root and set up a specific `post-update` hook, and you're done (see <>). -At that point, anyone who can access the web server under which you put the repository can also clone your repository. -To allow read access to your repository over HTTP, do something like this: +إذا لم يستجب الخادم لبروتوكول Git HTTP ذكي (smart Git HTTP service)، فسيحاول عميل (client) Git الرجوع (fall back) إلى بروتوكول `Dumb` HTTP (HTTP الغبي) الأبسط. +يتوقع البروتوكول الغبي أن يتم تقديم (served) مستودع Git المجرد (bare Git repository) مثل الملفات العادية عبر خادم ويب (web server). +يكمن جمال `Dumb` HTTP في بساطة (simplicity) إعداده. +في الأساس، كل ما عليك فعله هو وضع مستودع Git مجرد (bare Git repository) تحت الجذر الوثائقي (document root) الخاص بخادم HTTP وإعداد مشغل (hook) محدد `post-update`، وتكون قد انتهيت (انظر <>). +في تلك اللحظة، يمكن لأي شخص لديه حق الوصول إلى خادم الويب (web server) الذي وضعت عليه المستودع أيضاً استنساخ (clone) مستودعك. +لإتاحة الوصول إلى القراءة (read access) لمستودعك عبر HTTP، افعل شيئاً كهذا: + +يعتمد بروتوكول `Dumb` HTTP على أن يتم تقديم (served) مستودع Git المجرد (bare Git repository) مثل الملفات العادية عبر خادم ويب (web server). +يكمن جمال `Dumb` HTTP في بساطة (simplicity) إعداده. +كل ما عليك فعله هو وضع مستودع Git مجرد (bare Git repository) تحت الجذر الوثائقي (document root) الخاص بخادم HTTP وإعداد مشغل (hook) محدد `post-update` (الذي سنتناوله في <>)، وتكون قد انتهيت. +في تلك اللحظة، يمكن لأي شخص لديه حق الوصول إلى خادم الويب (web server) الذي وضعت عليه المستودع أيضاً استنساخ (clone) مستودعك. +لإتاحة الوصول إلى القراءة (read access) لمستودعك عبر HTTP، افعل هذا: [source,console] ---- @@ -103,109 +214,180 @@ $ mv hooks/post-update.sample hooks/post-update $ chmod a+x hooks/post-update ---- -That's all.(((hooks, post-update))) -The `post-update` hook that comes with Git by default runs the appropriate command (`git update-server-info`) to make HTTP fetching and cloning work properly. -This command is run when you push to this repository (over SSH perhaps); then, other people can clone via something like: +هذا كل شيء.(((hooks, post-update))) +يقوم المشغل (hook) `post-update` الذي يأتي مع Git بشكل افتراضي بتشغيل الأمر (command) المناسب (`git update-server-info`) لجعل الجلب والنسخ عبر HTTP (HTTP fetching and cloning) يعملان بشكل صحيح. +يتم تشغيل هذا الأمر (command) عند الدفع (push) إلى هذا المستودع (عبر (over) SSH ربما)؛ ثم يمكن للآخرين الاستنساخ (clone) عبر (via) شيء يشبه هذا: + + + +(((hooks, post-update))) +هذا كل شيء. +يقوم المشغل (hook) `post-update` الذي يأتي مع Git بشكل افتراضي بتشغيل الأمر (command) المناسب (`git update-server-info`) لجعل الجلب والنسخ (HTTP fetching and cloning) يعملان بشكل صحيح. +يتم تنفيذ هذا الأمر (command) عند الدفع (push) إلى هذا المستودع عبر (via) SSH، على سبيل المثال؛ ثم يمكن للآخرين الاستنساخ (clone) عبر (via) أمر يشبه هذا: [source,console] ---- $ git clone https://example.com/gitproject.git ---- -In this particular case, we're using the `/var/www/htdocs` path that is common for Apache setups, but you can use any static web server -- just put the bare repository in its path. -The Git data is served as basic static files (see the <> chapter for details about exactly how it's served). +في هذه الحالة بالذات، نحن نستخدم مسار (path) `/var/www/htdocs` الشائع لإعدادات Apache (Apache setups)، ولكن يمكنك استخدام أي خادم ويب ثابت (static web server) -- فقط ضع المستودع المجرد (bare repository) في مساره العادي. +يتم تقديم (served) بيانات Git كملفات ثابتة (static files) أساسية (انظر فصل <> للحصول على تفاصيل حول كيفية تقديمها بالضبط). + +عموماً، ستختار إما تشغيل خادم Smart HTTP (HTTP ذكي) للقراءة/الكتابة (read/write) أو ببساطة جعل الملفات قابلة للوصول (accessible) للقراءة فقط (read-only) بالطريقة الغبية (Dumb manner). +من النادر تشغيل مزيج (mix) من الخدمتين. + +===== The Pros (الإيجابيات) + +سنركز على إيجابيات (pros) الإصدار الذكي (Smart version) من بروتوكول HTTP. + +إن بساطة وجود عنوان URL واحد لجميع أنواع الوصول (types of access) ومطالبة الخادم فقط (prompting only) عند الحاجة إلى المصادقة (authentication is needed) تجعل الأمور سهلة للغاية بالنسبة للمستخدم النهائي (end user). +إن القدرة على المصادقة باستخدام اسم مستخدم وكلمة مرور تعد أيضاً ميزة كبيرة (big advantage) مقارنة بـ SSH، حيث لا يضطر المستخدمون إلى إنشاء مفاتيح SSH (SSH keys) محلياً وتحميل مفتاحهم العام (public key) إلى الخادم قبل التمكن من التفاعل معه. +بالنسبة للمستخدمين الأقل خبرة (less sophisticated users)، أو المستخدمين على الأنظمة التي يكون فيها SSH أقل شيوعاً، فهذه ميزة رئيسية في قابلية الاستخدام (usability). +وهو أيضاً بروتوكول سريع وفعال جداً (very fast and efficient protocol)، على غرار بروتوكول SSH. + +يمكنك أيضاً تقديم (serve) مستودعاتك للقراءة فقط (read-only) عبر HTTPS، مما يعني أنه يمكنك تشفير نقل المحتوى (encrypt the content transfer)؛ أو يمكنك الذهاب إلى حد جعل العملاء (clients) يستخدمون شهادات SSL موقعة (signed SSL certificates) محددة. + +شيء آخر رائع هو أن HTTP و HTTPS هي بروتوكولات شائعة الاستخدام (commonly used protocols) لدرجة أن جدران حماية الشركات (corporate firewalls) غالباً ما يتم إعدادها للسماح بمرور حركة المرور (traffic) عبر منافذها. + +===== The Cons (السلبيات) + +يمكن أن يكون إعداد Git عبر HTTPS أكثر صعوبة قليلاً (little more tricky) مقارنة بـ SSH على بعض الخوادم. +بخلاف ذلك، لا توجد ميزة تذكر للبروتوكولات الأخرى على Smart HTTP لتقديم (serving) محتوى Git. + +عموماً، ستختار إما تشغيل خادم Smart HTTP (HTTP ذكي) للقراءة/الكتابة (read/write) أو ببساطة جعل الملفات قابلة للوصول (accessible) للقراءة فقط (read-only) بالطريقة الغبية (Dumb manner). +من النادر تشغيل مزيج (mix) من الخدمتين. + +===== The Pros (الإيجابيات) + +سنركز على إيجابيات (pros) الإصدار الذكي (Smart version) من بروتوكول HTTP. + +إن بساطة وجود عنوان URL واحد لجميع أنواع الوصول (types of access) ومطالبة الخادم فقط (prompting only) عند الحاجة إلى المصادقة (authentication is needed) تجعل الأمور سهلة للغاية بالنسبة للمستخدم النهائي (end user). +إن القدرة على المصادقة باستخدام اسم مستخدم وكلمة مرور تعد أيضاً ميزة كبيرة (big advantage) مقارنة بـ SSH، حيث لا يضطر المستخدمون إلى إنشاء مفاتيح SSH (SSH keys) محلياً وتحميل مفتاحهم العام (public key) إلى الخادم قبل التمكن من التفاعل معه. +بالنسبة للمستخدمين الأقل خبرة (less sophisticated users)، أو المستخدمين على الأنظمة التي يكون فيها SSH أقل شيوعاً، فهذه ميزة رئيسية في قابلية الاستخدام (usability). +وهو أيضاً بروتوكول سريع وفعال جداً (very fast and efficient protocol)، على غرار بروتوكول SSH. + +يمكنك أيضاً تقديم (serve) مستودعاتك للقراءة فقط (read-only) عبر HTTPS، مما يعني أنه يمكنك تشفير نقل المحتوى (encrypt the content transfer)؛ أو يمكنك الذهاب إلى حد جعل العملاء (clients) يستخدمون شهادات SSL موقعة (signed SSL certificates) محددة. + +شيء آخر رائع هو أن HTTP و HTTPS هي بروتوكولات شائعة الاستخدام (commonly used protocols) لدرجة أن جدران حماية الشركات (corporate firewalls) غالباً ما يتم إعدادها للسماح بمرور حركة المرور (traffic) عبر منافذها. + +===== The Cons (السلبيات) + +يمكن أن يكون إعداد Git عبر HTTPS أكثر صعوبة قليلاً (little more tricky) مقارنة بـ SSH على بعض الخوادم. +بخلاف ذلك، لا توجد ميزة تذكر للبروتوكولات الأخرى على Smart HTTP لتقديم (serving) محتوى Git. + +عموماً، ستختار إما تشغيل خادم Smart HTTP (HTTP ذكي) للقراءة/الكتابة (read/write) أو ببساطة جعل الملفات قابلة للوصول (accessible) للقراءة فقط (read-only) بالطريقة الغبية (Dumb manner). +من النادر تشغيل مزيج (mix) من الخدمتين. + +===== The Pros (الإيجابيات) + +سنركز على إيجابيات (pros) الإصدار الذكي (Smart version) من بروتوكول HTTP. + +إن بساطة وجود عنوان URL واحد لجميع أنواع الوصول (types of access) ومطالبة الخادم فقط (prompting only) عند الحاجة إلى المصادقة (authentication is needed) تجعل الأمور سهلة للغاية بالنسبة للمستخدم النهائي (end user). +إن القدرة على المصادقة باستخدام اسم مستخدم وكلمة مرور تعد أيضاً ميزة كبيرة (big advantage) مقارنة بـ SSH، حيث لا يضطر المستخدمون إلى إنشاء مفاتيح SSH (SSH keys) محلياً وتحميل مفتاحهم العام (public key) إلى الخادم قبل التمكن من التفاعل معه. +بالنسبة للمستخدمين الأقل خبرة (less sophisticated users)، أو المستخدمين على الأنظمة التي يكون فيها SSH أقل شيوعاً، فهذه ميزة رئيسية في قابلية الاستخدام (usability). +وهو أيضاً بروتوكول سريع وفعال جداً (very fast and efficient protocol)، على غرار بروتوكول SSH. + +يمكنك أيضاً تقديم (serve) مستودعاتك للقراءة فقط (read-only) عبر HTTPS، مما يعني أنه يمكنك تشفير نقل المحتوى (encrypt the content transfer)؛ أو يمكنك الذهاب إلى حد جعل العملاء (clients) يستخدمون شهادات SSL موقعة (signed SSL certificates) محددة. + +شيء آخر رائع هو أن HTTP و HTTPS هي بروتوكولات شائعة الاستخدام (commonly used protocols) لدرجة أن جدران حماية الشركات (corporate firewalls) غالباً ما يتم إعدادها للسماح بمرور حركة المرور (traffic) عبر منافذها. + +===== The Cons (السلبيات) -Generally you would either choose to run a read/write Smart HTTP server or simply have the files accessible as read-only in the Dumb manner. -It's rare to run a mix of the two services. +يمكن أن يكون إعداد Git عبر HTTPS أكثر صعوبة قليلاً (little more tricky) مقارنة بـ SSH على بعض الخوادم. +بخلاف ذلك، لا توجد ميزة تذكر للبروتوكولات الأخرى على Smart HTTP لتقديم (serving) محتوى Git. +في هذه الحالة بالذات، نستخدم مسار (path) `/var/www/htdocs` الشائع لإعدادات Apache (Apache setups)، ولكن يمكنك استخدام أي خادم ويب ثابت (static web server) يقدم الملفات ببساطة -- ضع المستودع المجرد (bare repository) في مساره العادي. +يتم تقديم (served) بيانات Git كملفات ثابتة (static files) أساسية، وسنلقي نظرة فاحصة على كيفية عمل ذلك، بالضبط، في <>. -===== The Pros +غالباً ما يتم تقديم (serve) مستودعات القراءة والكتابة (read/write repositories) كـ Smart HTTP (HTTP ذكي) ومستودعات القراءة فقط (read-only repositories) كـ Dumb HTTP (HTTP غبي). +نادراً ما يجمع (mix) المرء بين الخدمتين هذه الأيام. -We'll concentrate on the pros of the Smart version of the HTTP protocol. +===== The Pros (الإيجابيات) -The simplicity of having a single URL for all types of access and having the server prompt only when authentication is needed makes things very easy for the end user. -Being able to authenticate with a username and password is also a big advantage over SSH, since users don't have to generate SSH keys locally and upload their public key to the server before being able to interact with it. -For less sophisticated users, or users on systems where SSH is less common, this is a major advantage in usability. -It is also a very fast and efficient protocol, similar to the SSH one. +نحن نركز على إيجابيات (pros) إصدار `Smart` (الذكي) من بروتوكول HTTP. -You can also serve your repositories read-only over HTTPS, which means you can encrypt the content transfer; or you can go so far as to make the clients use specific signed SSL certificates. +تتمثل بساطة استخدام عنوان URL واحد لجميع أنواع الوصول (access) في ميزة هائلة. +القدرة على ببساطة حث المستخدم (prompt the user) على إدخال بيانات الاعتماد (credentials) عند الاقتضاء، بدلاً من الاضطرار إلى التعامل مع مفاتيح SSH (SSH keys) المعقدة، هو مكسب كبير. -Another nice thing is that HTTP and HTTPS are such commonly used protocols that corporate firewalls are often set up to allow traffic through their ports. +ميزة أخرى كبيرة هي أن بروتوكولات HTTP مدعومة عالمياً، ومنافذ الشبكة (network ports) الخاصة بها مفتوحة على كل جدار حماية (firewall) للمؤسسات تقريباً، مما يجعل استخدامها متاحاً على نطاق واسع في بيئات الشركات (corporate environments) المقيدة. +لا يزال من الممكن تأمين (secure) نقل البيانات (data transfer) باستخدام HTTPS، وغالباً ما يدعمها حتى عملاء (clients) الويب القياسيون (standard web clients). -===== The Cons +===== The Cons (السلبيات) -Git over HTTPS can be a little more tricky to set up compared to SSH on some servers. -Other than that, there is very little advantage that other protocols have over Smart HTTP for serving Git content. +العيب (con) الحقيقي الوحيد هو أن بروتوكولات HTTP قد تكون أبطأ من خيارات بروتوكولات Git أو SSH إذا كانت العقدة (node) الخاصة بك تتصل بخادم يقدم (serves) الكثير من المستودعات لعدد كبير من العملاء (clients). +هذا لأن بروتوكول HTTP يعتمد على خادم HTTP (HTTP server) الذي ربما لم يتم تحسينه (optimized) لتقديم (serve) مستودعات Git أو قد لا يكون قادراً على التعامل مع كمية كبيرة من الاتصالات (connections) المتزامنة. +بينما تقوم خوادم Git و SSH بإطلاق (spawn) عملية (process) لكل اتصال عميل (client connection) وتتصل (communicate) مباشرة مع مستودع Git، متجاوزة (bypassing) أي طبقات وسيطة (middle layers). -If you're using HTTP for authenticated pushing, providing your credentials is sometimes more complicated than using keys over SSH. -There are, however, several credential caching tools you can use, including Keychain access on macOS and Credential Manager on Windows, to make this pretty painless. -Read <> to see how to set up secure HTTP password caching on your system. +إذا كنت تستخدم HTTP للمصادقة على الدفع (authenticated pushing)، فإن توفير بيانات الاعتماد (credentials) الخاصة بك يكون أحياناً أكثر تعقيداً من استخدام المفاتيح عبر (keys over) SSH. +ومع ذلك، هناك العديد من أدوات التخزين المؤقت لبيانات الاعتماد (credential caching tools) التي يمكنك استخدامها، بما في ذلك الوصول إلى Keychain على macOS و Credential Manager على Windows، لجعل هذا غير مؤلم إلى حد كبير. +اقرأ <> لمعرفة كيفية إعداد التخزين المؤقت الآمن لكلمات مرور HTTP (secure HTTP password caching) على نظامك. -==== The SSH Protocol +==== The SSH Protocol (بروتوكول SSH) (((protocols, SSH))) -A common transport protocol for Git when self-hosting is over SSH. -This is because SSH access to servers is already set up in most places -- and if it isn't, it's easy to do. -SSH is also an authenticated network protocol and, because it's ubiquitous, it's generally easy to set up and use. +بروتوكول النقل (transport protocol) الشائع لـ Git عند الاستضافة الذاتية (self-hosting) هو عبر SSH. +هذا لأنه في معظم الأماكن، يكون الوصول عبر SSH إلى الخوادم (servers) معداً بالفعل -- وإذا لم يكن كذلك، فمن السهل القيام بذلك. +هذا لأنه في معظم الأماكن، يكون الوصول عبر SSH إلى الخوادم (servers) معداً بالفعل — وإذا لم يكن كذلك، فمن السهل القيام بذلك. +SSH هو أيضاً بروتوكول شبكة مصادق عليه (authenticated network protocol) وبما أنه منتشر في كل مكان، فمن السهل عموماً إعداده واستخدامه. -To clone a Git repository over SSH, you can specify an `ssh://` URL like this: +لاستنساخ (clone) مستودع Git عبر SSH، يمكنك تحديد عنوان URL `ssh://` هكذا: [source,console] ---- $ git clone ssh://[user@]server/project.git ---- -Or you can use the shorter scp-like syntax for the SSH protocol: +أو يمكنك استخدام بنية (syntax) شبيهة بنسخ (scp-like) الأقصر لبروتوكول SSH: [source,console] ---- $ git clone [user@]server:project.git ---- -In both cases above, if you don't specify the optional username, Git assumes the user you're currently logged in as. +في كلتا الحالتين أعلاه، إذا لم تحدد (specify) اسم المستخدم (username) الاختياري، يفترض (assumes) Git المستخدم الذي قمت بتسجيل الدخول به حالياً (currently logged in). -===== The Pros +===== The Pros (الإيجابيات) -The pros of using SSH are many. -First, SSH is relatively easy to set up -- SSH daemons are commonplace, many network admins have experience with them, and many OS distributions are set up with them or have tools to manage them. -Next, access over SSH is secure -- all data transfer is encrypted and authenticated. -Last, like the HTTPS, Git and Local protocols, SSH is efficient, making the data as compact as possible before transferring it. +إيجابيات استخدام SSH متعددة. +أولاً، من السهل نسبياً إعداد (set up) SSH -- تنتشر برامج الخادم الخفي (SSH daemons) في كل مكان، والعديد من مسؤولي الشبكات (network admins) لديهم خبرة فيها، والعديد من توزيعات أنظمة التشغيل (OS distributions) تأتي مزودة بها أو لديها أدوات لإدارتها. +ثانياً، الوصول عبر SSH آمن (secure) -- يتم تشفير (encrypted) ومصادقة (authenticated) جميع عمليات نقل البيانات (data transfer). +أخيراً، مثل بروتوكولات HTTPS و Git و Local (المحلي)، يكون بروتوكول SSH فعالاً، مما يجعل البيانات مضغوطة (compact) قدر الإمكان قبل نقلها. -===== The Cons +===== The Cons (السلبيات) -The negative aspect of SSH is that it doesn't support anonymous access to your Git repository. -If you're using SSH, people _must_ have SSH access to your machine, even in a read-only capacity, which doesn't make SSH conducive to open source projects for which people might simply want to clone your repository to examine it. -If you're using it only within your corporate network, SSH may be the only protocol you need to deal with. -If you want to allow anonymous read-only access to your projects and also want to use SSH, you'll have to set up SSH for you to push over but something else for others to fetch from. +الجانب السلبي لـ SSH هو أنه لا يدعم الوصول المجهول (anonymous access) إلى مستودع Git الخاص بك. +إذا كنت تستخدم SSH، _يجب_ أن يكون لدى الأشخاص وصول عبر SSH إلى جهازك، حتى بصفة قراءة فقط (read-only capacity)، مما لا يجعل SSH مناسباً للمشاريع مفتوحة المصدر (open source projects) التي قد يرغب الأشخاص ببساطة في استنساخ (clone) مستودعك لفحصها. +إذا كنت تستخدمه فقط داخل شبكة شركتك (corporate network)، فقد يكون SSH هو البروتوكول الوحيد الذي تحتاج للتعامل معه. +إذا كنت ترغب في السماح بالوصول المجهول للقراءة فقط (anonymous read-only access) إلى مشاريعك وترغب أيضاً في استخدام SSH، فسيتعين عليك إعداد SSH لتتمكن من الدفع (push over) وشيء آخر للآخرين للسحب منه (fetch from). -==== The Git Protocol +==== The Git Protocol (بروتوكول Git) (((protocols, git))) -Finally, we have the Git protocol. -This is a special daemon that comes packaged with Git; it listens on a dedicated port (9418) that provides a service similar to the SSH protocol, but with absolutely no authentication or cryptography. -In order for a repository to be served over the Git protocol, you must create a `git-daemon-export-ok` file -- the daemon won't serve a repository without that file in it -- but, other than that, there is no security. -Either the Git repository is available for everyone to clone, or it isn't. -This means that there is generally no pushing over this protocol. -You can enable push access but, given the lack of authentication, anyone on the internet who finds your project's URL could push to that project. -Suffice it to say that this is rare. - -===== The Pros - -The Git protocol is often the fastest network transfer protocol available. -If you're serving a lot of traffic for a public project or serving a very large project that doesn't require user authentication for read access, it's likely that you'll want to set up a Git daemon to serve your project. -It uses the same data-transfer mechanism as the SSH protocol but without the encryption and authentication overhead. - -===== The Cons - -Due to the lack of TLS or other cryptography, cloning over `git://` might lead to an arbitrary code execution vulnerability, and should therefore be avoided unless you know what you are doing. - -* If you run `git clone git://example.com/project.git`, an attacker who controls e.g your router can modify the repo you just cloned, inserting malicious code into it. - If you then compile/run the code you just cloned, you will execute the malicious code. - Running `git clone http://example.com/project.git` should be avoided for the same reason. -* Running `git clone https://example.com/project.git` does not suffer from the same problem (unless the attacker can provide a TLS certificate for example.com). - Running `git clone git@example.com:project.git` only suffers from this problem if you accept a wrong SSH key fingerprint. - -It also has no authentication, i.e. anyone can clone the repo (although this is often exactly what you want). -It's also probably the most difficult protocol to set up. -It must run its own daemon, which requires `xinetd` or `systemd` configuration or the like, which isn't always a walk in the park. -It also requires firewall access to port 9418, which isn't a standard port that corporate firewalls always allow. -Behind big corporate firewalls, this obscure port is commonly blocked. +أخيراً، لدينا بروتوكول Git. +هذا خادم خفي خاص (special daemon) يأتي معبأ (packaged) مع Git؛ يستمع على منفذ مخصص (dedicated port) (9418) يوفر خدمة مشابهة لبروتوكول SSH، ولكن بدون أي مصادقة (authentication) أو تشفير (cryptography) على الإطلاق. +من أجل تقديم (served) مستودع عبر بروتوكول Git، يجب عليك إنشاء ملف `git-daemon-export-ok` -- لن يقدم الخادم الخفي (daemon) مستودعاً بدون ذلك الملف فيه -- ولكن، باستثناء ذلك، لا يوجد أمان (security). +إما أن يكون مستودع Git متاحاً للجميع للاستنساخ (clone)، أو لا يكون. +هذا يعني أنه لا يوجد عموماً دفع (pushing) عبر هذا البروتوكول. +يمكنك تمكين وصول الدفع (push access) ولكن، نظراً لعدم وجود مصادقة (lack of authentication)، يمكن لأي شخص على الإنترنت يجد عنوان URL الخاص بمشروعك الدفع (push) إلى هذا المشروع. +يكفي القول أن هذا أمر نادر الحدوث. + +===== The Pros (الإيجابيات) + +غالباً ما يكون بروتوكول Git أسرع بروتوكول نقل شبكة (network transfer protocol) متوفر. +إذا كنت تقدم (serving) الكثير من حركة المرور (traffic) لمشروع عام (public project) أو تخدم (serving) مشروعاً كبيراً جداً (very large project) لا يتطلب مصادقة (user authentication) للمستخدم للوصول للقراءة (read access)، فمن المحتمل (likely) أن ترغب في إعداد خادم خفي (Git daemon) لخدمة (serve) مشروعك. +إنه يستخدم نفس آلية نقل البيانات (data-transfer mechanism) مثل بروتوكول SSH ولكن بدون عبء التشفير (encryption) والمصادقة (authentication overhead). + +===== The Cons (السلبيات) + +بسبب الافتقار إلى (lack of) بروتوكول TLS أو غيره من وسائل التشفير (cryptography)، فإن الاستنساخ عبر (cloning over) `git://` قد يؤدي إلى ثغرة أمنية تسمح بتنفيذ تعليمات برمجية عشوائية (arbitrary code execution vulnerability)، ولذلك يجب تجنبه إلا إذا كنت تعرف ما تفعله. + +* إذا قمت بتشغيل `git clone git://example.com/project.git`، يمكن للمهاجم (attacker) الذي يتحكم في الموجه (router) الخاص بك تعديل المستودع الذي استنسخته للتو، وإدخال كود ضار (malicious code) فيه. + إذا قمت بعد ذلك بتجميع/تشغيل الكود الذي قمت باستنساخه للتو، فسوف تقوم بتنفيذ الكود الضار. + يجب تجنب تشغيل `git clone http://example.com/project.git` لنفس السبب. +* لا يعاني تشغيل `git clone https://example.com/project.git` من نفس المشكلة (إلا إذا تمكن المهاجم من توفير شهادة TLS لموقع example.com). + يعاني تشغيل `git clone git@example.com:project.git` من هذه المشكلة فقط إذا قبلت بصمة (fingerprint) مفتاح SSH خاطئة. + +كما أنه لا يحتوي على مصادقة (authentication)، أي يمكن لأي شخص استنساخ المستودع (على الرغم من أن هذا هو غالباً ما تريده بالضبط). +ربما يكون أيضاً أصعب بروتوكول في الإعداد. +يجب أن يدير الخادم الخفي (daemon) الخاص به، والذي يتطلب تكوين (configuration) `xinetd` أو `systemd` أو ما شابه ذلك، وهو ليس دائماً نزهة في الحديقة (walk in the park). +يتطلب أيضاً وصول جدار الحماية (firewall access) إلى المنفذ (port) 9418، وهو ليس منفذاً قياسياً تسمح به جدران حماية الشركات (corporate firewalls) دائماً. +خلف جدران حماية الشركات الكبيرة (big corporate firewalls)، غالباً ما يكون هذا المنفذ الغامض (obscure port) محظوراً (blocked). diff --git a/book/04-git-server/sections/setting-up-server.asc b/book/04-git-server/sections/setting-up-server.asc index bbb082956..667506512 100644 --- a/book/04-git-server/sections/setting-up-server.asc +++ b/book/04-git-server/sections/setting-up-server.asc @@ -1,16 +1,16 @@ [[_setting_up_server]] -=== Setting Up the Server +=== Setting Up the Server (إعداد الخادم) -Let's walk through setting up SSH access on the server side. -In this example, you'll use the `authorized_keys` method for authenticating your users. -We also assume you're running a standard Linux distribution like Ubuntu. +دعنا نستعرض إعداد وصول SSH (SSH access) على جانب الخادم (server side). +في هذا المثال، ستستخدم طريقة `authorized_keys` (المفاتيح المصرح بها) لمصادقة (authenticating) المستخدمين الخاصين بك. +نفترض أيضاً أنك تقوم بتشغيل توزيعة Linux (Linux distribution) قياسية مثل Ubuntu. [NOTE] ==== -A good deal of what is described here can be automated by using the `ssh-copy-id` command, rather than manually copying and installing public keys. +يمكن أتمتة (automated) جزء كبير مما هو موصوف هنا باستخدام الأمر (command) `ssh-copy-id`، بدلاً من نسخ وتثبيت المفاتيح العامة (public keys) يدوياً. ==== -First, you create a `git` user account and a `.ssh` directory for that user. +أولاً، تقوم بإنشاء حساب مستخدم (user account) `git` ودليل (directory) `.ssh` لذلك المستخدم. [source,console] ---- @@ -21,9 +21,9 @@ $ mkdir .ssh && chmod 700 .ssh $ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys ---- -Next, you need to add some developer SSH public keys to the `authorized_keys` file for the `git` user. -Let's assume you have some trusted public keys and have saved them to temporary files. -Again, the public keys look something like this: +بعد ذلك، تحتاج إلى إضافة بعض المفاتيح العامة لـ SSH (SSH public keys) الخاصة بالمطورين إلى ملف `authorized_keys` للمستخدم `git`. +لنفترض أن لديك بعض المفاتيح العامة (public keys) الموثوق بها وقمت بحفظها في ملفات مؤقتة (temporary files). +مرة أخرى، تبدو المفاتيح العامة (public keys) كالتالي: [source,console] ---- @@ -36,7 +36,7 @@ O7TCUSBdLQlgMVOFq1I2uPWQOkOWQAHukEOmfjy2jctxSDBQ220ymjaNsHT4kgtZg2AYYgPq dAv8JggJICUvax2T9va5 gsg-keypair ---- -You just append them to the `git` user's `authorized_keys` file in its `.ssh` directory: +ما عليك سوى إلحاقها (append them) بملف `authorized_keys` الخاص بالمستخدم `git` في دليله (directory) `.ssh`: [source,console] ---- @@ -45,7 +45,7 @@ $ cat /tmp/id_rsa.josie.pub >> ~/.ssh/authorized_keys $ cat /tmp/id_rsa.jessica.pub >> ~/.ssh/authorized_keys ---- -Now, you can set up an empty repository for them by running `git init` with the `--bare` option, which initializes the repository without a working directory:(((git commands, init, bare))) +الآن، يمكنك إعداد مستودع فارغ (empty repository) لهم عن طريق تشغيل `git init` مع الخيار `--bare`، والذي يقوم بتهيئة (initializes) المستودع (repository) بدون دليل عمل (working directory):(((git commands, init, bare))) [source,console] ---- @@ -56,10 +56,10 @@ $ git init --bare Initialized empty Git repository in /srv/git/project.git/ ---- -Then, John, Josie, or Jessica can push the first version of their project into that repository by adding it as a remote and pushing up a branch. -Note that someone must shell onto the machine and create a bare repository every time you want to add a project. -Let's use `gitserver` as the hostname of the server on which you've set up your `git` user and repository. -If you're running it internally, and you set up DNS for `gitserver` to point to that server, then you can use the commands pretty much as is (assuming that `myproject` is an existing project with files in it): +بعد ذلك، يمكن لـ John أو Josie أو Jessica دفع (push) الإصدار الأول (first version) من مشروعهم إلى ذلك المستودع عن طريق إضافته كجهاز تحكم عن بعد (remote) ودفع فرع (pushing up a branch). +لاحظ أنه يجب على شخص ما الدخول إلى القشرة (shell) على الجهاز وإنشاء مستودع مجرد (bare repository) في كل مرة تريد فيها إضافة مشروع. +لنستخدم `gitserver` كاسم مضيف (hostname) للخادم الذي أعددت عليه مستخدم (user) `git` والمستودع الخاص بك. +إذا كنت تقوم بتشغيله داخلياً، وقمت بإعداد DNS لـ `gitserver` للإشارة إلى ذلك الخادم، فيمكنك استخدام الأوامر (commands) كما هي تقريباً (بافتراض أن `myproject` هو مشروع موجود (existing project) به ملفات داخله): [source,console] ---- @@ -72,7 +72,7 @@ $ git remote add origin git@gitserver:/srv/git/project.git $ git push origin master ---- -At this point, the others can clone it down and push changes back up just as easily: +في هذه المرحلة، يمكن للآخرين استنساخه (clone it down) ودفع التغييرات (push changes) مرة أخرى لأعلى بنفس السهولة: [source,console] ---- @@ -83,15 +83,15 @@ $ git commit -am 'Fix for README file' $ git push origin master ---- -With this method, you can quickly get a read/write Git server up and running for a handful of developers. +باستخدام هذه الطريقة، يمكنك بسرعة إعداد وتشغيل خادم Git للقراءة/الكتابة (read/write Git server) لعدد قليل من المطورين (handful of developers). -You should note that currently all these users can also log into the server and get a shell as the `git` user. -If you want to restrict that, you will have to change the shell to something else in the `/etc/passwd` file. +يجب أن تلاحظ أنه في الوقت الحالي يمكن لجميع هؤلاء المستخدمين أيضاً تسجيل الدخول (log into) إلى الخادم والحصول على قشرة (shell) بصفتهم المستخدم `git`. +إذا كنت ترغب في تقييد (restrict) ذلك، فسيتعين عليك تغيير القشرة (shell) إلى شيء آخر في ملف `/etc/passwd`. -You can easily restrict the `git` user account to only Git-related activities with a limited shell tool called `git-shell` that comes with Git. -If you set this as the `git` user account's login shell, then that account can't have normal shell access to your server. -To use this, specify `git-shell` instead of `bash` or `csh` for that account's login shell. -To do so, you must first add the full pathname of the `git-shell` command to `/etc/shells` if it's not already there: +يمكنك بسهولة تقييد (restrict) حساب مستخدم `git` بالأنشطة المتعلقة بـ Git (Git-related activities) فقط باستخدام أداة قشرة محدودة (limited shell tool) تسمى `git-shell` تأتي مع Git. +إذا قمت بتعيين هذا كقشرة تسجيل دخول (login shell) حساب مستخدم `git`، فلن يتمكن ذلك الحساب من الحصول على وصول عادي للقشرة (normal shell access) إلى خادمك. +لاستخدام هذا، حدد (specify) `git-shell` بدلاً من `bash` أو `csh` لقشرة تسجيل دخول (login shell) ذلك الحساب. +للقيام بذلك، يجب عليك أولاً إضافة اسم المسار الكامل (full pathname) للأمر `git-shell` إلى `/etc/shells` إذا لم يكن موجوداً بالفعل: [source,console] ---- @@ -100,15 +100,15 @@ $ which git-shell # make sure git-shell is installed on your system. $ sudo -e /etc/shells # and add the path to git-shell from last command ---- -Now you can edit the shell for a user using `chsh -s `: +الآن يمكنك تحرير القشرة (edit the shell) لمستخدم باستخدام `chsh -s `: [source,console] ---- $ sudo chsh git -s $(which git-shell) ---- -Now, the `git` user can still use the SSH connection to push and pull Git repositories but can't shell onto the machine. -If you try, you'll see a login rejection like this: +الآن، لا يزال بإمكان المستخدم `git` استخدام اتصال SSH (SSH connection) لدفع وسحب مستودعات Git (push and pull Git repositories) ولكن لا يمكنه الدخول إلى القشرة (shell) على الجهاز. +إذا حاولت، سترى رفض تسجيل دخول (login rejection) كالتالي: [source,console] ---- @@ -118,15 +118,15 @@ hint: ~/git-shell-commands should exist and have read and execute access. Connection to gitserver closed. ---- -At this point, users are still able to use SSH port forwarding to access any host the git server is able to reach. -If you want to prevent that, you can edit the `authorized_keys` file and prepend the following options to each key you'd like to restrict: +في هذه المرحلة، لا يزال المستخدمون قادرين على استخدام إعادة توجيه منفذ SSH (SSH port forwarding) للوصول إلى أي مضيف (host) يمكن لخادم git الوصول إليه. +إذا كنت ترغب في منع (prevent) ذلك، يمكنك تحرير (edit) ملف `authorized_keys` وإلحاق (prepend) الخيارات (options) التالية في بداية كل مفتاح ترغب في تقييده: [source,console] ---- no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ---- -The result should look like this: +يجب أن تبدو النتيجة (result) كالتالي: [source,console] ---- @@ -143,7 +143,7 @@ no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEwENNMomTboYI+LJieaAY16qiXiH3wuvENhBG... ---- -Now Git network commands will still work just fine but the users won't be able to get a shell. -As the output states, you can also set up a directory in the `git` user's home directory that customizes the `git-shell` command a bit. -For instance, you can restrict the Git commands that the server will accept or you can customize the message that users see if they try to SSH in like that. -Run `git help shell` for more information on customizing the shell.(((git commands, help))) +الآن ستعمل أوامر شبكة Git (Git network commands) بشكل جيد تماماً ولكن لن يتمكن المستخدمون من الحصول على قشرة (shell). +كما ينص الإخراج (output)، يمكنك أيضاً إعداد دليل (directory) في الدليل الرئيسي (home directory) للمستخدم `git` يقوم بتخصيص (customizes) الأمر `git-shell` قليلاً. +على سبيل المثال، يمكنك تقييد (restrict) أوامر Git (Git commands) التي سيقبلها (accept) الخادم أو يمكنك تخصيص الرسالة (customize the message) التي يراها المستخدمون إذا حاولوا تسجيل الدخول عبر SSH بهذا الشكل. +قم بتشغيل `git help shell` لمزيد من المعلومات حول تخصيص القشرة (customizing the shell).(((git commands, help))) diff --git a/book/04-git-server/sections/smart-http.asc b/book/04-git-server/sections/smart-http.asc index 753d34cd5..1a6b1a4a3 100644 --- a/book/04-git-server/sections/smart-http.asc +++ b/book/04-git-server/sections/smart-http.asc @@ -1,14 +1,14 @@ -=== Smart HTTP +=== Smart HTTP (HTTP الذكي) (((serving repositories, HTTP))) -We now have authenticated access through SSH and unauthenticated access through `git://`, but there is also a protocol that can do both at the same time. -Setting up Smart HTTP is basically just enabling a CGI script that is provided with Git called `git-http-backend` on the server.(((git commands, "http-backend"))) -This CGI will read the path and headers sent by a `git fetch` or `git push` to an HTTP URL and determine if the client can communicate over HTTP (which is true for any client since version 1.6.6). -If the CGI sees that the client is smart, it will communicate smartly with it; otherwise it will fall back to the dumb behavior (so it is backward compatible for reads with older clients). +لدينا الآن وصول مصادق عليه (authenticated access) عبر SSH ووصول غير مصادق عليه (unauthenticated access) عبر `git://`، ولكن هناك أيضاً بروتوكول يمكنه القيام بالأمرين في نفس الوقت. +إعداد Smart HTTP (HTTP الذكي) هو في الأساس مجرد تمكين برنامج CGI نصي (CGI script) يتم توفيره مع Git يسمى `git-http-backend` على الخادم.(((git commands, "http-backend"))) +سيقوم CGI هذا بقراءة المسار (path) والرؤوس (headers) المرسلة بواسطة `git fetch` أو `git push` إلى عنوان URL لـ HTTP وتحديد ما إذا كان العميل (client) يمكنه الاتصال (communicate) عبر HTTP (وهو أمر صحيح لأي عميل منذ الإصدار 1.6.6). +إذا رأى CGI أن العميل ذكي (smart)، فسيتواصل معه بذكاء؛ وإلا فإنه سيرجع (fall back) إلى السلوك الغبي (dumb behavior) (لذلك فهو متوافق مع الإصدارات السابقة (backward compatible) للقراءة مع العملاء الأقدم). -Let's walk through a very basic setup. -We'll set this up with Apache as the CGI server. -If you don't have Apache setup, you can do so on a Linux box with something like this:(((Apache))) +دعنا نستعرض إعداداً أساسياً جداً (very basic setup). +سنقوم بإعداد هذا باستخدام Apache كخادم CGI (CGI server). +إذا لم يكن لديك إعداد Apache، فيمكنك القيام بذلك على جهاز Linux (Linux box) بشيء مثل هذا:(((Apache))) [source,console] ---- @@ -16,16 +16,16 @@ $ sudo apt-get install apache2 apache2-utils $ a2enmod cgi alias env ---- -This also enables the `mod_cgi`, `mod_alias`, and `mod_env` modules, which are all needed for this to work properly. +يتيح هذا أيضاً وحدات (modules) `mod_cgi` و `mod_alias` و `mod_env`، وكلها مطلوبة لكي يعمل هذا بشكل صحيح. -You'll also need to set the Unix user group of the `/srv/git` directories to `www-data` so your web server can read- and write-access the repositories, because the Apache instance running the CGI script will (by default) be running as that user: +ستحتاج أيضاً إلى تعيين مجموعة مستخدمي Unix (Unix user group) لأدلة `/srv/git` إلى `www-data` حتى يتمكن خادم الويب الخاص بك من الوصول للقراءة والكتابة (read- and write-access) إلى المستودعات (repositories)، لأن مثيل (instance) Apache الذي يقوم بتشغيل البرنامج النصي لـ CGI (CGI script) سيتم تشغيله (بشكل افتراضي) كـ ذلك المستخدم: [source,console] ---- $ chgrp -R www-data /srv/git ---- -Next we need to add some things to the Apache configuration to run the `git-http-backend` as the handler for anything coming into the `/git` path of your web server. +بعد ذلك نحتاج إلى إضافة بعض الأشياء إلى تكوين (configuration) Apache لتشغيل `git-http-backend` كمعالج (handler) لأي شيء وارد إلى المسار `/git` الخاص بخادم الويب الخاص بك. [source,console] ---- @@ -34,9 +34,9 @@ SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/lib/git-core/git-http-backend/ ---- -If you leave out `GIT_HTTP_EXPORT_ALL` environment variable, then Git will only serve to unauthenticated clients the repositories with the `git-daemon-export-ok` file in them, just like the Git daemon did. +إذا تركت متغير البيئة (environment variable) `GIT_HTTP_EXPORT_ALL`، فلن يقدم Git (serve) للعملاء غير المصادق عليهم (unauthenticated clients) سوى المستودعات التي تحتوي على ملف `git-daemon-export-ok` بداخلها، تماماً كما فعل الخادم الخفي لـ Git (Git daemon). -Finally you'll want to tell Apache to allow requests to `git-http-backend` and make writes be authenticated somehow, possibly with an Auth block like this: +أخيراً، سترغب في إخبار Apache بالسماح للطلبات (requests) بالوصول إلى `git-http-backend` وجعل عمليات الكتابة (writes) تتم مصادقتها (authenticated) بطريقة ما، ربما باستخدام كتلة `Auth` (Auth block) مثل هذه: [source,console] ---- @@ -49,24 +49,24 @@ Finally you'll want to tell Apache to allow requests to `git-http-backend` and m ---- -That will require you to create a `.htpasswd` file containing the passwords of all the valid users. -Here is an example of adding a "`schacon`" user to the file: +سيتطلب ذلك منك إنشاء ملف `.htpasswd` يحتوي على كلمات المرور (passwords) لجميع المستخدمين الصالحين (valid users). +فيما يلي مثال على إضافة مستخدم "`schacon`" إلى الملف: [source,console] ---- $ htpasswd -c /srv/git/.htpasswd schacon ---- -There are tons of ways to have Apache authenticate users, you'll have to choose and implement one of them. -This is just the simplest example we could come up with. -You'll also almost certainly want to set this up over SSL so all this data is encrypted. +هناك الكثير من الطرق لجعل Apache يصادق (authenticate) المستخدمين، وسيتعين عليك اختيار وتنفيذ إحداها. +هذا مجرد أبسط مثال يمكن أن نتوصل إليه. +سترغب أيضاً بشكل شبه مؤكد في إعداد هذا عبر SSL بحيث يتم تشفير (encrypted) كل هذه البيانات. -We don't want to go too far down the rabbit hole of Apache configuration specifics, since you could well be using a different server or have different authentication needs. -The idea is that Git comes with a CGI called `git-http-backend` that when invoked will do all the negotiation to send and receive data over HTTP. -It does not implement any authentication itself, but that can easily be controlled at the layer of the web server that invokes it. -You can do this with nearly any CGI-capable web server, so go with the one that you know best. +لا نريد التعمق كثيراً في تفاصيل تكوين (configuration) Apache، حيث يمكنك استخدام خادم مختلف (different server) أو لديك احتياجات مصادقة (authentication needs) مختلفة. +الفكرة هي أن Git يأتي مزوداً ببرنامج CGI يسمى `git-http-backend` والذي عند استدعائه (invoked) سيقوم بكل التفاوض (negotiation) لإرسال واستقبال البيانات (send and receive data) عبر HTTP. +إنه لا ينفذ (implement) أي مصادقة بنفسه، ولكن يمكن التحكم في ذلك بسهولة في طبقة (layer) خادم الويب (web server) الذي يستدعيه. +يمكنك القيام بذلك مع أي خادم ويب قادر على تشغيل CGI تقريباً، لذا استخدم الخادم الذي تعرفه بشكل أفضل. [NOTE] ==== -For more information on configuring authentication in Apache, check out the Apache docs here: https://httpd.apache.org/docs/current/howto/auth.html[^]. +لمزيد من المعلومات حول تكوين المصادقة (configuring authentication) في Apache، راجع مستندات (docs) Apache هنا: https://httpd.apache.org/docs/current/howto/auth.html[^]. ==== diff --git a/book/05-distributed-git/sections/contributing.asc b/book/05-distributed-git/sections/contributing.asc index 2c6b08516..c21755249 100644 --- a/book/05-distributed-git/sections/contributing.asc +++ b/book/05-distributed-git/sections/contributing.asc @@ -1,116 +1,116 @@ [[_contributing_project]] -=== Contributing to a Project +=== Contributing to a Project (المساهمة في مشروع) (((contributing))) -The main difficulty with describing how to contribute to a project are the numerous variations on how to do that. -Because Git is very flexible, people can and do work together in many ways, and it's problematic to describe how you should contribute -- every project is a bit different. -Some of the variables involved are active contributor count, chosen workflow, your commit access, and possibly the external contribution method. - -The first variable is active contributor count -- how many users are actively contributing code to this project, and how often? -In many instances, you'll have two or three developers with a few commits a day, or possibly less for somewhat dormant projects. -For larger companies or projects, the number of developers could be in the thousands, with hundreds or thousands of commits coming in each day. -This is important because with more and more developers, you run into more issues with making sure your code applies cleanly or can be easily merged. -Changes you submit may be rendered obsolete or severely broken by work that is merged in while you were working or while your changes were waiting to be approved or applied. -How can you keep your code consistently up to date and your commits valid? - -The next variable is the workflow in use for the project. -Is it centralized, with each developer having equal write access to the main codeline? -Does the project have a maintainer or integration manager who checks all the patches? -Are all the patches peer-reviewed and approved? -Are you involved in that process? -Is a lieutenant system in place, and do you have to submit your work to them first? - -The next variable is your commit access. -The workflow required in order to contribute to a project is much different if you have write access to the project than if you don't. -If you don't have write access, how does the project prefer to accept contributed work? -Does it even have a policy? -How much work are you contributing at a time? -How often do you contribute? - -All these questions can affect how you contribute effectively to a project and what workflows are preferred or available to you. -We'll cover aspects of each of these in a series of use cases, moving from simple to more complex; you should be able to construct the specific workflows you need in practice from these examples. +الصعوبة الرئيسية في وصف كيفية المساهمة (contribute) في مشروع هي الاختلافات (variations) العديدة في كيفية القيام بذلك. +نظراً لأن Git مرن للغاية، يمكن للأشخاص العمل معاً بطرق عديدة، ومن الصعب وصف كيفية مساهمتك (contribute) -- فكل مشروع يختلف قليلاً عن الآخر. +بعض المتغيرات (variables) المعنية هي عدد المساهمين النشطين (active contributor count)، وسير العمل (workflow) المختار، ووصول التأكيد (commit access) الخاص بك، وربما طريقة المساهمة الخارجية (external contribution method). + +المتغير الأول هو عدد المساهمين النشطين -- كم عدد المستخدمين الذين يساهمون بنشاط في كود (contributing code) هذا المشروع، وكم مرة؟ +في كثير من الحالات، سيكون لديك مطوران أو ثلاثة (developers) لديهم بضع عمليات تأكيد (commits) في اليوم، أو ربما أقل للمشاريع الخاملة (dormant projects) إلى حد ما. +بالنسبة للشركات أو المشاريع الكبيرة (larger companies or projects)، يمكن أن يكون عدد المطورين بالآلاف، مع ورود مئات أو آلاف عمليات التأكيد كل يوم. +هذا مهم لأنه مع تزايد عدد المطورين، تواجه المزيد من المشكلات للتأكد من تطبيق الكود الخاص بك بشكل نظيف (applies cleanly) أو يمكن دمجه بسهولة (easily merged). +قد تصبح التغييرات (Changes) التي ترسلها قديمة (obsolete) أو معطلة بشدة (severely broken) بسبب العمل الذي يتم دمجه أثناء عملك أو أثناء انتظار الموافقة على تغييراتك أو تطبيقها. +كيف يمكنك الحفاظ على الكود الخاص بك محدثاً (up to date) باستمرار وعمليات التأكيد الخاصة بك صالحة (valid)؟ + +المتغير التالي هو سير العمل (workflow) المستخدم للمشروع. +هل هو مركزي (centralized)، حيث يتمتع كل مطور بوصول كتابة (write access) متساوٍ إلى مسار الكود الرئيسي (main codeline)؟ +هل للمشروع مشرف (maintainer) أو مدير تكامل (integration manager) يتحقق من جميع التصحيحات (patches)؟ +هل تتم مراجعة جميع التصحيحات من قبل النظراء (peer-reviewed) والموافقة عليها (approved)؟ +هل أنت منخرط في تلك العملية (process)؟ +هل يوجد نظام ملازم (lieutenant system)، وهل يتعين عليك إرسال عملك (submit your work) إليهم أولاً؟ + +المتغير التالي هو وصول التأكيد (commit access) الخاص بك. +يختلف سير العمل المطلوب من أجل المساهمة في مشروع كثيراً إذا كان لديك وصول كتابة (write access) إلى المشروع عما إذا لم يكن لديك. +إذا لم يكن لديك وصول كتابة، فكيف يفضل المشروع قبول العمل المساهم (contributed work) به؟ +هل لديه سياسة (policy) أصلاً؟ +ما مقدار العمل الذي تساهم به في المرة الواحدة؟ +كم مرة تساهم؟ + +يمكن أن تؤثر كل هذه الأسئلة على كيفية مساهمتك بفعالية (contribute effectively) في مشروع وعلى مهام سير العمل (workflows) المفضلة أو المتاحة لك. +سنغطي جوانب كل منها في سلسلة من حالات الاستخدام (use cases)، من البسيط إلى الأكثر تعقيداً؛ يجب أن تكون قادراً على بناء مهام سير العمل المحددة التي تحتاجها في الممارسة العملية من هذه الأمثلة. [[_commit_guidelines]] -==== Commit Guidelines +==== Commit Guidelines (إرشادات التأكيد) -Before we start looking at the specific use cases, here's a quick note about commit messages. -Having a good guideline for creating commits and sticking to it makes working with Git and collaborating with others a lot easier. -The Git project provides a document that lays out a number of good tips for creating commits from which to submit patches -- you can read it in the Git source code in the `Documentation/SubmittingPatches` file. +قبل أن نبدأ في النظر إلى حالات الاستخدام المحددة (specific use cases)، إليك ملاحظة سريعة حول رسائل التأكيد (commit messages). +إن وجود مبدأ توجيهي (guideline) جيد لإنشاء عمليات التأكيد والالتزام به يجعل العمل مع Git والتعاون (collaborating) مع الآخرين أسهل بكثير. +يوفر مشروع Git مستنداً (document) يضع عدداً من النصائح الجيدة لإنشاء عمليات تأكيد لتقديم التصحيحات (submit patches) منها -- يمكنك قراءته في الكود المصدري (source code) لـ Git في ملف `Documentation/SubmittingPatches`. (((git commands, diff, check))) -First, your submissions should not contain any whitespace errors. -Git provides an easy way to check for this -- before you commit, run `git diff --check`, which identifies possible whitespace errors and lists them for you. +أولاً، يجب ألا تحتوي عمليات الإرسال الخاصة بك (submissions) على أي أخطاء مسافة بيضاء (whitespace errors). +يوفر Git طريقة سهلة للتحقق من ذلك -- قبل التأكيد (commit)، قم بتشغيل `git diff --check`، والذي يحدد أخطاء المسافات البيضاء المحتملة ويسردها لك. -.Output of `git diff --check` +.Output of `git diff --check` (مخرجات `git diff --check`) image::images/git-diff-check.png[Output of `git diff --check`] -If you run that command before committing, you can tell if you're about to commit whitespace issues that may annoy other developers. +إذا قمت بتشغيل هذا الأمر (command) قبل التأكيد (committing)، فيمكنك معرفة ما إذا كنت على وشك تأكيد مشكلات في المسافات البيضاء (whitespace issues) قد تزعج المطورين الآخرين. -Next, try to make each commit a logically separate changeset. -If you can, try to make your changes digestible -- don't code for a whole weekend on five different issues and then submit them all as one massive commit on Monday. -Even if you don't commit during the weekend, use the staging area on Monday to split your work into at least one commit per issue, with a useful message per commit. -If some of the changes modify the same file, try to use `git add --patch` to partially stage files (covered in detail in <>). -The project snapshot at the tip of the branch is identical whether you do one commit or five, as long as all the changes are added at some point, so try to make things easier on your fellow developers when they have to review your changes. +بعد ذلك، حاول أن تجعل كل عملية تأكيد (commit) مجموعة تغييرات (changeset) منفصلة منطقياً (logically separate). +إذا استطعت، فحاول جعل تغييراتك قابلة للاستيعاب (digestible) -- لا تكتب كوداً (code) لعطلة نهاية أسبوع كاملة بشأن خمس مشكلات (issues) مختلفة ثم تقدمها (submit) جميعاً كعملية تأكيد (commit) واحدة ضخمة (massive) يوم الاثنين. +حتى إذا لم تقم بالتأكيد (commit) خلال عطلة نهاية الأسبوع، فاستخدم منطقة التجهيز (staging area) يوم الاثنين لتقسيم (split) عملك إلى تأكيد واحد على الأقل لكل مشكلة، مع رسالة مفيدة (useful message) لكل تأكيد. +إذا قامت بعض التغييرات بتعديل نفس الملف (same file)، فحاول استخدام `git add --patch` لتجهيز الملفات جزئياً (partially stage files) (تمت تغطيته بالتفصيل في <>). +لقطة المشروع (project snapshot) في طرف الفرع (tip of the branch) متطابقة سواء قمت بتأكيد (commit) واحد أو خمسة، طالما تمت إضافة جميع التغييرات في مرحلة ما، لذا حاول تسهيل الأمور على زملائك المطورين عندما يضطرون إلى مراجعة تغييراتك (review your changes). -This approach also makes it easier to pull out or revert one of the changesets if you need to later. -<> describes a number of useful Git tricks for rewriting history and interactively staging files -- use these tools to help craft a clean and understandable history before sending the work to someone else. +هذا النهج (approach) يجعل من السهل أيضاً سحب (pull out) أو التراجع (revert) عن إحدى مجموعات التغييرات (changesets) إذا احتجت إلى ذلك لاحقاً. +يصف <> عدداً من حيل Git المفيدة (useful Git tricks) لإعادة كتابة السجل (rewriting history) وتجهيز الملفات بشكل تفاعلي (interactively staging files) -- استخدم هذه الأدوات للمساعدة في صياغة سجل (craft a clean and understandable history) نظيف ومفهوم قبل إرسال العمل إلى شخص آخر. -The last thing to keep in mind is the commit message. -Getting in the habit of creating quality commit messages makes using and collaborating with Git a lot easier. -As a general rule, your messages should start with a single line that's no more than about 50 characters and that describes the changeset concisely, followed by a blank line, followed by a more detailed explanation. -The Git project requires that the more detailed explanation include your motivation for the change and contrast its implementation with previous behavior -- this is a good guideline to follow. -Write your commit message in the imperative: "Fix bug" and not "Fixed bug" or "Fixes bug." -Here is a template you can follow, which we've lightly adapted from one https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[originally written by Tim Pope^]: +آخر شيء يجب أخذه في الاعتبار هو رسالة التأكيد (commit message). +إن التعود على إنشاء رسائل تأكيد عالية الجودة (quality commit messages) يجعل استخدام Git والتعاون (collaborating) معه أسهل بكثير. +كقاعدة عامة (general rule)، يجب أن تبدأ رسائلك بسطر واحد لا يتجاوز 50 حرفاً (characters) تقريباً ويصف مجموعة التغييرات (changeset) بإيجاز، يليه سطر فارغ (blank line)، يليه شرح أكثر تفصيلاً (more detailed explanation). +يتطلب مشروع Git أن يتضمن الشرح الأكثر تفصيلاً دافعك (motivation) للتغيير ومقارنة تنفيذه (implementation) بالسلوك السابق (previous behavior) -- وهذا مبدأ توجيهي (guideline) جيد يجب اتباعه. +اكتب رسالة التأكيد الخاصة بك بصيغة الأمر (imperative): "Fix bug" (أصلح الخطأ) وليس "Fixed bug" (أُصلح الخطأ) أو "Fixes bug" (يُصلح الخطأ). +إليك نموذج (template) يمكنك اتباعه، والذي قمنا بتكييفه قليلاً من نموذج https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[كُتب أصلاً بواسطة Tim Pope^]: [source,text] ---- -Capitalized, short (50 chars or less) summary +ملخص بأحرف كبيرة وقصير (50 حرفاً أو أقل) -More detailed explanatory text, if necessary. Wrap it to about 72 -characters or so. In some contexts, the first line is treated as the -subject of an email and the rest of the text as the body. The blank -line separating the summary from the body is critical (unless you omit -the body entirely); tools like rebase will confuse you if you run the -two together. +نص توضيحي أكثر تفصيلاً، إذا لزم الأمر. قم بلفه إلى حوالي 72 +حرفاً أو نحو ذلك. في بعض السياقات، يتم التعامل مع السطر الأول كـ +موضوع لبريد إلكتروني وبقية النص كجسم الرسالة. السطر الفارغ +الذي يفصل الملخص عن جسم الرسالة أمر بالغ الأهمية (ما لم تحذف +جسم الرسالة بالكامل)؛ أدوات مثل rebase سوف تربكك إذا قمت بتشغيل +الاثنين معاً. -Write your commit message in the imperative: "Fix bug" and not "Fixed bug" -or "Fixes bug." This convention matches up with commit messages generated -by commands like git merge and git revert. +اكتب رسالة التأكيد الخاصة بك بصيغة الأمر: "أصلح الخطأ" وليس "أُصلح الخطأ" +أو "يُصلح الخطأ". يتطابق هذا العرف مع رسائل التأكيد التي يتم إنشاؤها +بواسطة أوامر مثل git merge و git revert. -Further paragraphs come after blank lines. +تأتي الفقرات الإضافية بعد الأسطر الفارغة. -- Bullet points are okay, too +- النقاط النقطية مقبولة أيضاً -- Typically a hyphen or asterisk is used for the bullet, followed by a - single space, with blank lines in between, but conventions vary here +- عادةً ما يتم استخدام واصلة أو علامة نجمية للنقطة، تليها + مسافة واحدة، مع وجود أسطر فارغة بينهما، ولكن الأعراف تختلف هنا -- Use a hanging indent +- استخدم مسافة بادئة معلقة ---- -If all your commit messages follow this model, things will be much easier for you and the developers with whom you collaborate. -The Git project has well-formatted commit messages -- try running `git log --no-merges` there to see what a nicely-formatted project-commit history looks like. +إذا كانت جميع رسائل التأكيد (commit messages) الخاصة بك تتبع هذا النموذج (model)، فستكون الأمور أسهل بكثير بالنسبة لك وللمطورين (developers) الذين تتعاون معهم. +يحتوي مشروع Git على رسائل تأكيد منسقة جيداً (well-formatted commit messages) -- حاول تشغيل `git log --no-merges` هناك لمعرفة كيف يبدو سجل تأكيد المشروع (project-commit history) المنسق بشكل جميل. [NOTE] -.Do as we say, not as we do. +.Do as we say, not as we do. (افعل كما نقول، وليس كما نفعل.) ==== -For the sake of brevity, many of the examples in this book don't have nicely-formatted commit messages like this; instead, we simply use the `-m` option to `git commit`. +من أجل الإيجاز، فإن العديد من الأمثلة في هذا الكتاب لا تحتوي على رسائل تأكيد (commit messages) منسقة بشكل جيد مثل هذه؛ بدلاً من ذلك، نستخدم ببساطة الخيار `-m` للأمر `git commit`. -In short, do as we say, not as we do. +باختصار، افعل كما نقول، وليس كما نفعل. ==== [[_private_team]] -==== Private Small Team +==== Private Small Team (فريق صغير خاص) (((contributing, private small team))) -The simplest setup you're likely to encounter is a private project with one or two other developers. -"`Private,`" in this context, means closed-source -- not accessible to the outside world. -You and the other developers all have push access to the repository. +أبسط إعداد (setup) من المحتمل أن تواجهه هو مشروع خاص (private project) مع مطور (developer) أو مطورين آخرين. +يعني "`الخاص`" ("`Private`") في هذا السياق، مغلق المصدر (closed-source) -- لا يمكن الوصول إليه من قبل العالم الخارجي. +أنت والمطورون الآخرون لديكم جميعاً حق الوصول للدفع (push access) إلى المستودع (repository). -In this environment, you can follow a workflow similar to what you might do when using Subversion or another centralized system. -You still get the advantages of things like offline committing and vastly simpler branching and merging, but the workflow can be very similar; the main difference is that merges happen client-side rather than on the server at commit time. -Let's see what it might look like when two developers start to work together with a shared repository. -The first developer, John, clones the repository, makes a change, and commits locally. -The protocol messages have been replaced with `...` in these examples to shorten them somewhat. +في هذه البيئة (environment)، يمكنك اتباع سير عمل (workflow) مشابه لما قد تفعله عند استخدام Subversion أو نظام مركزي (centralized system) آخر. +لا تزال تحصل على مزايا أشياء مثل التأكيد دون اتصال بالإنترنت (offline committing) والتفريع والدمج (branching and merging) الأبسط بكثير، ولكن يمكن أن يكون سير العمل مشابهاً جداً؛ الاختلاف الرئيسي هو أن عمليات الدمج (merges) تحدث من جانب العميل (client-side) بدلاً من الخادم (server) في وقت التأكيد (commit time). +دعنا نرى كيف قد يبدو الأمر عندما يبدأ مطوران العمل معاً في مستودع مشترك (shared repository). +يقوم المطور الأول، John، باستنساخ (clones) المستودع، وإجراء تغيير (change)، والتأكيد محلياً (commits locally). +تم استبدال رسائل البروتوكول (protocol messages) بـ `...` في هذه الأمثلة لتقصيرها نوعاً ما. [source,console] ---- @@ -125,7 +125,7 @@ $ git commit -am 'Remove invalid default value' 1 files changed, 1 insertions(+), 1 deletions(-) ---- -The second developer, Jessica, does the same thing -- clones the repository and commits a change: +يقوم المطور الثاني، Jessica، بنفس الشيء -- استنساخ المستودع وتأكيد التغيير (commits a change): [source,console] ---- @@ -140,7 +140,7 @@ $ git commit -am 'Add reset task' 1 files changed, 1 insertions(+), 0 deletions(-) ---- -Now, Jessica pushes her work to the server, which works just fine: +الآن، تدفع (pushes) Jessica عملها إلى الخادم (server)، وهو ما يعمل بشكل جيد: [source,console] ---- @@ -151,12 +151,12 @@ To jessica@githost:simplegit.git 1edee6b..fbff5bc master -> master ---- -The last line of the output above shows a useful return message from the push operation. -The basic format is `.. fromref -> toref`, where `oldref` means the old reference, `newref` means the new reference, `fromref` is the name of the local reference being pushed, and `toref` is the name of the remote reference being updated. -You'll see similar output like this below in the discussions, so having a basic idea of the meaning will help in understanding the various states of the repositories. -More details are available in the documentation for https://git-scm.com/docs/git-push[git-push^]. +يعرض السطر الأخير من المخرجات (output) أعلاه رسالة إرجاع (return message) مفيدة من عملية الدفع (push operation). +التنسيق الأساسي (basic format) هو `.. fromref -> toref`، حيث يعني `oldref` المرجع القديم (old reference)، ويعني `newref` المرجع الجديد (new reference)، و `fromref` هو اسم المرجع المحلي (local reference) الذي يتم دفعه (being pushed)، و `toref` هو اسم المرجع البعيد (remote reference) الذي يتم تحديثه (being updated). +سترى مخرجات مشابهة مثل هذه أدناه في المناقشات، لذا فإن امتلاك فكرة أساسية عن المعنى سيساعد في فهم الحالات المختلفة (various states) للمستودعات. +تتوفر مزيد من التفاصيل في وثائق https://git-scm.com/docs/git-push[git-push^]. -Continuing with this example, shortly afterwards, John makes some changes, commits them to his local repository, and tries to push them to the same server: +بالاستمرار في هذا المثال، بعد فترة وجيزة، يقوم John بإجراء بعض التغييرات، وتأكيدها (commits them) في مستودعه المحلي (local repository)، ويحاول دفعها (push them) إلى نفس الخادم: [source,console] ---- @@ -167,12 +167,12 @@ To john@githost:simplegit.git error: failed to push some refs to 'john@githost:simplegit.git' ---- -In this case, John's push fails because of Jessica's earlier push of _her_ changes. -This is especially important to understand if you're used to Subversion, because you'll notice that the two developers didn't edit the same file. -Although Subversion automatically does such a merge on the server if different files are edited, with Git, you must _first_ merge the commits locally. -In other words, John must first fetch Jessica's upstream changes and merge them into his local repository before he will be allowed to push. +في هذه الحالة، يفشل (fails) دفع John بسبب دفع Jessica السابق (earlier push) لتغييراتها (_her_ changes). +هذا مهم بشكل خاص لفهمه إذا كنت معتاداً على Subversion، لأنك ستلاحظ أن المطورين لم يقوما بتحرير نفس الملف (same file). +على الرغم من أن Subversion يقوم تلقائياً بمثل هذا الدمج (merge) على الخادم إذا تم تحرير ملفات مختلفة، فمع Git، يجب عليك _أولاً_ دمج عمليات التأكيد (commits) محلياً. +بعبارة أخرى، يجب على John أولاً جلب (fetch) تغييرات Jessica الأولية (upstream changes) ودمجها (merge them) في مستودعه المحلي قبل السماح له بالدفع (push). -As a first step, John fetches Jessica's work (this only _fetches_ Jessica's upstream work, it does not yet merge it into John's work): +كخطوة أولى، يقوم John بجلب (fetches) عمل Jessica (يؤدي هذا فقط إلى _جلب_ عمل Jessica الأولي، ولا يدمجه (merge) بعد في عمل John): [source,console] ---- @@ -182,12 +182,12 @@ From john@githost:simplegit + 049d078...fbff5bc master -> origin/master ---- -At this point, John's local repository looks something like this: +في هذه المرحلة، يبدو مستودع John المحلي (local repository) كالتالي: -.John's divergent history +.John's divergent history (سجل John المتشعب) image::images/small-team-1.png[John's divergent history] -Now John can merge Jessica's work that he fetched into his own local work: +الآن يمكن لـ John دمج (merge) عمل Jessica الذي جلبه (fetched) في عمله المحلي (local work): [source,console] ---- @@ -197,12 +197,12 @@ Merge made by the 'recursive' strategy. 1 files changed, 1 insertions(+), 0 deletions(-) ---- -As long as that local merge goes smoothly, John's updated history will now look like this: +طالما أن هذا الدمج المحلي (local merge) يسير بسلاسة، فإن سجل John المحدث (updated history) سيبدو الآن هكذا: -.John's repository after merging `origin/master` +.John's repository after merging `origin/master` (مستودع John بعد دمج `origin/master`) image::images/small-team-2.png[John's repository after merging `origin/master`] -At this point, John might want to test this new code to make sure none of Jessica's work affects any of his and, as long as everything seems fine, he can finally push the new merged work up to the server: +في هذه المرحلة، قد يرغب John في اختبار هذا الكود الجديد (new code) للتأكد من أن أياً من عمل Jessica لا يؤثر على أي من عمله، وطالما أن كل شيء يبدو على ما يرام، فيمكنه أخيراً دفع (push) العمل المدمج الجديد (new merged work) إلى الخادم: [source,console] ---- @@ -212,18 +212,18 @@ To john@githost:simplegit.git fbff5bc..72bbc59 master -> master ---- -In the end, John's commit history will look like this: +في النهاية، سيبدو سجل تأكيد (commit history) John كالتالي: -.John's history after pushing to the `origin` server +.John's history after pushing to the `origin` server (سجل John بعد الدفع إلى الخادم `origin`) image::images/small-team-3.png[John's history after pushing to the `origin` server] -In the meantime, Jessica has created a new topic branch called `issue54`, and made three commits to that branch. -She hasn't fetched John's changes yet, so her commit history looks like this: +في غضون ذلك، أنشأت Jessica فرع موضوع (topic branch) جديداً يسمى `issue54`، وأجرت ثلاث عمليات تأكيد (commits) لذلك الفرع. +لم تجلب (fetched) تغييرات John بعد، لذلك يبدو سجل التأكيد الخاص بها هكذا: -.Jessica's topic branch +.Jessica's topic branch (فرع موضوع Jessica) image::images/small-team-4.png[Jessica's topic branch] -Suddenly, Jessica learns that John has pushed some new work to the server and she wants to take a look at it, so she can fetch all new content from the server that she does not yet have with: +فجأة، علمت Jessica أن John قد دفع (pushed) بعض العمل الجديد إلى الخادم وتريد إلقاء نظرة عليه، حتى تتمكن من جلب (fetch) جميع المحتويات الجديدة من الخادم التي لا تملكها بعد باستخدام: [source,console] ---- @@ -234,14 +234,14 @@ From jessica@githost:simplegit fbff5bc..72bbc59 master -> origin/master ---- -That pulls down the work John has pushed up in the meantime. -Jessica's history now looks like this: +يؤدي ذلك إلى سحب (pulls down) العمل الذي دفعه (pushed up) John في غضون ذلك. +سجل Jessica يبدو الآن هكذا: -.Jessica's history after fetching John's changes +.Jessica's history after fetching John's changes (سجل Jessica بعد جلب تغييرات John) image::images/small-team-5.png[Jessica's history after fetching John's changes] -Jessica thinks her topic branch is ready, but she wants to know what part of John's fetched work she has to merge into her work so that she can push. -She runs `git log` to find out: +تعتقد Jessica أن فرع موضوعها (topic branch) جاهز، لكنها تريد معرفة الجزء الذي يتعين عليها دمجه (merge) من عمل John الذي تم جلبه في عملها حتى تتمكن من الدفع (push). +تقوم بتشغيل `git log` لمعرفة ذلك: [source,console] ---- @@ -253,15 +253,15 @@ Date: Fri May 29 16:01:27 2009 -0700 Remove invalid default value ---- -The `issue54..origin/master` syntax is a log filter that asks Git to display only those commits that are on the latter branch (in this case `origin/master`) and that are not on the first branch (in this case `issue54`). -We'll go over this syntax in detail in <>. +بناء الجملة (syntax) `issue54..origin/master` هو مرشح سجل (log filter) يطلب من Git عرض عمليات التأكيد (commits) الموجودة على الفرع الأخير (في هذه الحالة `origin/master`) والتي ليست على الفرع الأول (في هذه الحالة `issue54`). +سنستعرض بناء الجملة هذا بالتفصيل في <>. -From the above output, we can see that there is a single commit that John has made that Jessica has not merged into her local work. -If she merges `origin/master`, that is the single commit that will modify her local work. +من المخرجات (output) أعلاه، يمكننا أن نرى أن هناك تأكيداً واحداً (single commit) قام به John ولم تدمجه Jessica في عملها المحلي (local work). +إذا قامت بدمج `origin/master`، فهذا هو التأكيد الوحيد الذي سيعدل عملها المحلي. -Now, Jessica can merge her topic work into her `master` branch, merge John's work (`origin/master`) into her `master` branch, and then push back to the server again. +الآن، يمكن لـ Jessica دمج (merge) عمل موضوعها (topic work) في فرع `master` الخاص بها، ودمج عمل John (`origin/master`) في فرع `master` الخاص بها، ثم الدفع (push) مرة أخرى إلى الخادم. -First (having committed all of the work on her `issue54` topic branch), Jessica switches back to her `master` branch in preparation for integrating all this work: +أولاً (بعد أن أكدت (committed) كل العمل على فرع موضوعها `issue54`)، تعود Jessica إلى فرع `master` الخاص بها استعداداً لدمج (integrating) كل هذا العمل: [source,console] ---- @@ -270,9 +270,9 @@ Switched to branch 'master' Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded. ---- -Jessica can merge either `origin/master` or `issue54` first -- they're both upstream, so the order doesn't matter. -The end snapshot should be identical no matter which order she chooses; only the history will be different. -She chooses to merge the `issue54` branch first: +يمكن لـ Jessica إما دمج `origin/master` أو `issue54` أولاً -- كلاهما أولي (upstream)، لذا لا يهم الترتيب. +يجب أن تكون اللقطة النهائية (end snapshot) متطابقة بغض النظر عن الترتيب الذي تختاره؛ سيكون السجل (history) فقط مختلفاً. +تختار دمج فرع `issue54` أولاً: [source,console] ---- @@ -284,8 +284,8 @@ Fast forward 2 files changed, 6 insertions(+), 1 deletions(-) ---- -No problems occur; as you can see it was a simple fast-forward merge. -Jessica now completes the local merging process by merging John's earlier fetched work that is sitting in the `origin/master` branch: +لا تحدث أي مشاكل؛ كما ترون كان عبارة عن دمج تقديم سريع (fast-forward merge) بسيط. +تكمل Jessica الآن عملية الدمج المحلي (local merging process) بدمج عمل John السابق الذي تم جلبه (fetched work) والموجود في فرع `origin/master`: [source,console] ---- @@ -296,12 +296,12 @@ Merge made by the 'recursive' strategy. 1 files changed, 1 insertions(+), 1 deletions(-) ---- -Everything merges cleanly, and Jessica's history now looks like this: +يتم دمج كل شيء بشكل نظيف (cleanly)، ويبدو سجل Jessica الآن هكذا: -.Jessica's history after merging John's changes +.Jessica's history after merging John's changes (سجل Jessica بعد دمج تغييرات John) image::images/small-team-6.png[Jessica's history after merging John's changes] -Now `origin/master` is reachable from Jessica's `master` branch, so she should be able to successfully push (assuming John hasn't pushed even more changes in the meantime): +الآن يمكن الوصول إلى `origin/master` من فرع `master` الخاص بـ Jessica، لذلك يجب أن تكون قادرة على الدفع (push) بنجاح (بافتراض أن John لم يدفع المزيد من التغييرات في غضون ذلك): [source,console] ---- @@ -311,32 +311,32 @@ To jessica@githost:simplegit.git 72bbc59..8059c15 master -> master ---- -Each developer has committed a few times and merged each other's work successfully. +قام كل مطور (developer) بالتأكيد (committed) عدة مرات ودمج (merged) عمل الآخر بنجاح. -.Jessica's history after pushing all changes back to the server +.Jessica's history after pushing all changes back to the server (سجل Jessica بعد دفع جميع التغييرات إلى الخادم) image::images/small-team-7.png[Jessica's history after pushing all changes back to the server] -That is one of the simplest workflows. -You work for a while (generally in a topic branch), and merge that work into your `master` branch when it's ready to be integrated. -When you want to share that work, you fetch and merge your `master` from `origin/master` if it has changed, and finally push to the `master` branch on the server. -The general sequence is something like this: +هذا أحد أبسط مهام سير العمل (workflows). +أنت تعمل لفترة من الوقت (عموماً في فرع موضوع (topic branch))، وتدمج (merge) هذا العمل في فرع `master` الخاص بك عندما يكون جاهزاً للدمج (integrated). +عندما ترغب في مشاركة (share) هذا العمل، تقوم بجلب ودمج (fetch and merge) `master` الخاص بك من `origin/master` إذا تغير، وتدفع (push) أخيراً إلى فرع `master` على الخادم. +التسلسل العام (general sequence) هو شيء من هذا القبيل: -.General sequence of events for a simple multiple-developer Git workflow +.General sequence of events for a simple multiple-developer Git workflow (التسلسل العام للأحداث لسير عمل Git بسيط لمتعدد المطورين) image::images/small-team-flow.png[General sequence of events for a simple multiple-developer Git workflow] -==== Private Managed Team +==== Private Managed Team (فريق مُدار خاص) (((contributing, private managed team))) -In this next scenario, you'll look at contributor roles in a larger private group. -You'll learn how to work in an environment where small groups collaborate on features, after which those team-based contributions are integrated by another party. +في هذا السيناريو التالي، ستنظر في أدوار المساهمين (contributor roles) في مجموعة خاصة أكبر (larger private group). +ستتعلم كيفية العمل في بيئة تتعاون (collaborate) فيها مجموعات صغيرة في ميزات (features)، وبعد ذلك يتم دمج (integrated) تلك المساهمات (contributions) المستندة إلى الفريق بواسطة طرف آخر. -Let's say that John and Jessica are working together on one feature (call this "`featureA`"), while Jessica and a third developer, Josie, are working on a second (say, "`featureB`"). -In this case, the company is using a type of integration-manager workflow where the work of the individual groups is integrated only by certain engineers, and the `master` branch of the main repo can be updated only by those engineers. -In this scenario, all work is done in team-based branches and pulled together by the integrators later. +لنفترض أن John و Jessica يعملان معاً على ميزة واحدة (نسميها "`featureA`")، بينما تعمل Jessica ومطور ثالث، Josie، على ميزة ثانية (لنفترض، "`featureB`"). +في هذه الحالة، تستخدم الشركة نوعاً من سير عمل مدير التكامل (integration-manager workflow) حيث يتم دمج عمل المجموعات الفردية بواسطة مهندسين معينين (certain engineers) فقط، ولا يمكن تحديث فرع `master` الخاص بالمستودع الرئيسي (main repo) إلا بواسطة هؤلاء المهندسين. +في هذا السيناريو، يتم تنفيذ كل العمل في فروع قائمة على الفريق (team-based branches) ويتم سحبها معاً (pulled together) بواسطة المدمجين (integrators) لاحقاً. -Let's follow Jessica's workflow as she works on her two features, collaborating in parallel with two different developers in this environment. -Assuming she already has her repository cloned, she decides to work on `featureA` first. -She creates a new branch for the feature and does some work on it there: +دعونا نتابع سير عمل (workflow) Jessica وهي تعمل على ميزتيها (two features)، متعاونة (collaborating) بالتوازي (in parallel) مع مطورين مختلفين في هذه البيئة. +بافتراض أنها استنسخت (cloned) مستودعها بالفعل، قررت العمل على `featureA` أولاً. +تنشئ فرعاً (branch) جديداً للميزة وتقوم ببعض العمل عليه هناك: [source,console] ---- @@ -349,8 +349,8 @@ $ git commit -am 'Add limit to log function' 1 files changed, 1 insertions(+), 1 deletions(-) ---- -At this point, she needs to share her work with John, so she pushes her `featureA` branch commits up to the server. -Jessica doesn't have push access to the `master` branch -- only the integrators do -- so she has to push to another branch in order to collaborate with John: +في هذه المرحلة، تحتاج إلى مشاركة (share) عملها مع John، لذلك تدفع (pushes) عمليات تأكيد فرع `featureA` الخاص بها إلى الخادم. +لا تمتلك Jessica حق الوصول للدفع (push access) إلى فرع `master` -- المدمجون (integrators) فقط هم من يملكونه -- لذلك يتعين عليها الدفع إلى فرع آخر من أجل التعاون مع John: [source,console] ---- @@ -360,9 +360,9 @@ To jessica@githost:simplegit.git * [new branch] featureA -> featureA ---- -Jessica emails John to tell him that she's pushed some work into a branch named `featureA` and he can look at it now. -While she waits for feedback from John, Jessica decides to start working on `featureB` with Josie. -To begin, she starts a new feature branch, basing it off the server's `master` branch: +ترسل Jessica رسالة بريد إلكتروني (emails) إلى John لتخبره أنها دفعت بعض العمل إلى فرع يسمى `featureA` ويمكنه إلقاء نظرة عليه الآن. +بينما تنتظر ملاحظات (feedback) من John، قررت Jessica بدء العمل على `featureB` مع Josie. +للبدء، تبدأ فرع ميزة (feature branch) جديداً، استناداً إلى فرع `master` الخاص بالخادم: [source,console] ---- @@ -372,7 +372,7 @@ $ git checkout -b featureB origin/master Switched to a new branch 'featureB' ---- -Now, Jessica makes a couple of commits on the `featureB` branch: +الآن، تجري Jessica بضع عمليات تأكيد (commits) على فرع `featureB`: [source,console] ---- @@ -386,14 +386,14 @@ $ git commit -am 'Add ls-files' 1 files changed, 5 insertions(+), 0 deletions(-) ---- -Jessica's repository now looks like this: +يبدو مستودع Jessica الآن هكذا: -.Jessica's initial commit history +.Jessica's initial commit history (سجل التأكيد الأولي لـ Jessica) image::images/managed-team-1.png[Jessica's initial commit history] -She's ready to push her work, but gets an email from Josie that a branch with some initial "`featureB`" work on it was already pushed to the server as the `featureBee` branch. -Jessica needs to merge those changes with her own before she can push her work to the server. -Jessica first fetches Josie's changes with `git fetch`: +إنها جاهزة لدفع (push) عملها، لكنها تتلقى بريداً إلكترونياً من Josie تفيد بأنه تم بالفعل دفع فرع يحتوي على بعض عمل "`featureB`" الأولي إلى الخادم كفرع `featureBee`. +تحتاج Jessica إلى دمج (merge) تلك التغييرات مع التغييرات الخاصة بها قبل أن تتمكن من دفع عملها إلى الخادم. +تقوم Jessica أولاً بجلب (fetches) تغييرات Josie باستخدام `git fetch`: [source,console] ---- @@ -403,7 +403,7 @@ From jessica@githost:simplegit * [new branch] featureBee -> origin/featureBee ---- -Assuming Jessica is still on her checked-out `featureB` branch, she can now merge Josie's work into that branch with `git merge`: +بافتراض أن Jessica لا تزال في فرع `featureB` الذي تم التحقق منه (checked-out)، يمكنها الآن دمج عمل Josie في ذلك الفرع باستخدام `git merge`: [source,console] ---- @@ -414,8 +414,8 @@ Merge made by the 'recursive' strategy. 1 files changed, 4 insertions(+), 0 deletions(-) ---- -At this point, Jessica wants to push all of this merged "`featureB`" work back to the server, but she doesn't want to simply push her own `featureB` branch. -Rather, since Josie has already started an upstream `featureBee` branch, Jessica wants to push to _that_ branch, which she does with: +في هذه المرحلة، ترغب Jessica في دفع (push) كل عمل "`featureB`" المدمج (merged) هذا إلى الخادم، لكنها لا تريد ببساطة دفع فرع `featureB` الخاص بها. +بدلاً من ذلك، نظراً لأن Josie قد بدأت بالفعل فرع `featureBee` الأولي (upstream branch)، فإن Jessica ترغب في الدفع إلى _ذلك_ الفرع، وهو ما تفعله باستخدام: [source,console] ---- @@ -425,12 +425,12 @@ To jessica@githost:simplegit.git fba9af8..cd685d1 featureB -> featureBee ---- -This is called a _refspec_. -See <> for a more detailed discussion of Git refspecs and different things you can do with them. -Also notice the `-u` flag; this is short for `--set-upstream`, which configures the branches for easier pushing and pulling later. +يُطلق على هذا اسم _مواصفات المرجع (refspec)_. +انظر <> لمناقشة أكثر تفصيلاً لمواصفات مراجع (refspecs) Git والأشياء المختلفة التي يمكنك القيام بها معها. +لاحظ أيضاً العلامة (flag) `-u`؛ وهي اختصار لـ `--set-upstream`، والتي تقوم بتكوين الفروع لتسهيل الدفع والسحب (pushing and pulling) لاحقاً. -Suddenly, Jessica gets email from John, who tells her he's pushed some changes to the `featureA` branch on which they are collaborating, and he asks Jessica to take a look at them. -Again, Jessica runs a simple `git fetch` to fetch _all_ new content from the server, including (of course) John's latest work: +فجأة، تتلقى Jessica بريداً إلكترونياً من John يخبرها بأنه دفع بعض التغييرات إلى فرع `featureA` الذي يتعاونان فيه، ويطلب منها إلقاء نظرة عليها. +مرة أخرى، تقوم Jessica بتشغيل أمر `git fetch` بسيط لجلب _جميع_ المحتويات الجديدة (new content) من الخادم، بما في ذلك (بالطبع) أحدث عمل (latest work) لـ John: [source,console] ---- @@ -440,7 +440,7 @@ From jessica@githost:simplegit 3300904..aad881d featureA -> origin/featureA ---- -Jessica can display the log of John's new work by comparing the content of the newly-fetched `featureA` branch with her local copy of the same branch: +يمكن لـ Jessica عرض سجل (log) العمل الجديد لـ John بمقارنة محتوى (content) فرع `featureA` الذي تم جلبه للتو بنسختها المحلية (local copy) من نفس الفرع: [source,console] ---- @@ -452,7 +452,7 @@ Date: Fri May 29 19:57:33 2009 -0700 Increase log output to 30 from 25 ---- -If Jessica likes what she sees, she can merge John's new work into her local `featureA` branch with: +إذا أعجب Jessica ما تراه، فيمكنها دمج (merge) عمل John الجديد في فرع `featureA` المحلي الخاص بها باستخدام: [source,console] ---- @@ -465,7 +465,7 @@ Fast forward 1 files changed, 9 insertions(+), 1 deletions(-) ---- -Finally, Jessica might want to make a couple minor changes to all that merged content, so she is free to make those changes, commit them to her local `featureA` branch, and push the end result back to the server: +أخيراً، قد ترغب Jessica في إجراء بضعة تغييرات طفيفة (minor changes) على كل هذا المحتوى المدمج (merged content)، لذلك فهي حرة في إجراء تلك التغييرات، وتأكيدها (commit them) في فرع `featureA` المحلي الخاص بها، ودفع (push) النتيجة النهائية إلى الخادم: [source,console] ---- @@ -478,36 +478,36 @@ To jessica@githost:simplegit.git 3300904..774b3ed featureA -> featureA ---- -Jessica's commit history now looks something like this: +يبدو سجل تأكيد Jessica الآن هكذا: -.Jessica's history after committing on a feature branch +.Jessica's history after committing on a feature branch (سجل Jessica بعد التأكيد على فرع الميزة) image::images/managed-team-2.png[Jessica's history after committing on a feature branch] -At some point, Jessica, Josie, and John inform the integrators that the `featureA` and `featureBee` branches on the server are ready for integration into the mainline. -After the integrators merge these branches into the mainline, a fetch will bring down the new merge commit, making the history look like this: +في مرحلة ما، تُعلم Jessica و Josie و John المدمجين (integrators) أن الفروع `featureA` و `featureBee` الموجودة على الخادم جاهزة للدمج (integration) في الخط الرئيسي (mainline). +بعد أن يدمج المدمجون هذه الفروع في الخط الرئيسي، سيؤدي الجلب (fetch) إلى جلب تأكيد الدمج (merge commit) الجديد، مما يجعل السجل يبدو هكذا: -.Jessica's history after merging both her topic branches +.Jessica's history after merging both her topic branches (سجل Jessica بعد دمج كلا فرعي موضوعها) image::images/managed-team-3.png[Jessica's history after merging both her topic branches] -Many groups switch to Git because of this ability to have multiple teams working in parallel, merging the different lines of work late in the process. -The ability of smaller subgroups of a team to collaborate via remote branches without necessarily having to involve or impede the entire team is a huge benefit of Git. -The sequence for the workflow you saw here is something like this: +تنتقل العديد من المجموعات إلى Git بسبب هذه القدرة على وجود فرق متعددة (multiple teams) تعمل بالتوازي (in parallel)، وتدمج خطوط العمل المختلفة في وقت متأخر من العملية. +تعد قدرة المجموعات الفرعية الأصغر (smaller subgroups) لفريق ما على التعاون عبر الفروع البعيدة (remote branches) دون الحاجة بالضرورة إلى إشراك أو إعاقة الفريق بأكمله فائدة كبيرة (huge benefit) لـ Git. +سيكون التسلسل (sequence) لسير العمل الذي رأيته هنا شيئاً من هذا القبيل: -.Basic sequence of this managed-team workflow +.Basic sequence of this managed-team workflow (التسلسل الأساسي لسير عمل الفريق المدار هذا) image::images/managed-team-flow.png[Basic sequence of this managed-team workflow] [[_public_project]] -==== Forked Public Project +==== Forked Public Project (مشروع عام منسوخ) (((contributing, public small project))) -Contributing to public projects is a bit different. -Because you don't have the permissions to directly update branches on the project, you have to get the work to the maintainers some other way. -This first example describes contributing via forking on Git hosts that support easy forking. -Many hosting sites support this (including GitHub, BitBucket, repo.or.cz, and others), and many project maintainers expect this style of contribution. -The next section deals with projects that prefer to accept contributed patches via email. +يختلف الإسهام (Contributing) في المشاريع العامة (public projects) قليلاً. +نظراً لأنك لا تمتلك الأذونات (permissions) لتحديث الفروع في المشروع مباشرة، فيجب عليك إيصال العمل (work) إلى المشرفين (maintainers) بطريقة أخرى. +يصف هذا المثال الأول المساهمة (contributing) عبر النسخ (forking) على مضيفي Git (Git hosts) الذين يدعمون النسخ السهل (easy forking). +تدعم العديد من مواقع الاستضافة (hosting sites) ذلك (بما في ذلك GitHub و BitBucket و repo.or.cz وغيرها)، ويتوقع العديد من مشرفي المشاريع أسلوب المساهمة هذا. +يتناول القسم التالي المشاريع التي تفضل قبول التصحيحات المساهمة (contributed patches) عبر البريد الإلكتروني. -First, you'll probably want to clone the main repository, create a topic branch for the patch or patch series you're planning to contribute, and do your work there. -The sequence looks basically like this: +أولاً، من المحتمل أن ترغب في استنساخ (clone) المستودع الرئيسي (main repository)، وإنشاء فرع موضوع (topic branch) للتصحيح أو سلسلة التصحيحات (patch series) التي تخطط للمساهمة بها، والقيام بعملك هناك. +يبدو التسلسل (sequence) بشكل أساسي كالتالي: [source,console] ---- @@ -522,23 +522,23 @@ $ git commit [NOTE] ==== -You may want to use `rebase -i` to squash your work down to a single commit, or rearrange the work in the commits to make the patch easier for the maintainer to review -- see <> for more information about interactive rebasing. +قد ترغب في استخدام `rebase -i` لضغط (squash) عملك في عملية تأكيد واحدة (single commit)، أو إعادة ترتيب (rearrange) العمل في عمليات التأكيد لجعل مراجعة التصحيح أسهل على المشرف -- انظر <> لمزيد من المعلومات حول إعادة البناء التفاعلية (interactive rebasing). ==== -When your branch work is finished and you're ready to contribute it back to the maintainers, go to the original project page and click the "`Fork`" button, creating your own writable fork of the project. -You then need to add this repository URL as a new remote of your local repository; in this example, let's call it `myfork`: +عندما ينتهي عمل فرعك وتكون مستعداً للمساهمة به للمشرفين، انتقل إلى صفحة المشروع الأصلية وانقر على زر "`Fork`" (نسخ)، لإنشاء نسختك (fork) القابلة للكتابة (writable) من المشروع. +تحتاج بعد ذلك إلى إضافة عنوان URL لهذا المستودع كجهاز تحكم عن بعد (remote) جديد لمستودعك المحلي؛ في هذا المثال، لنسميه `myfork`: [source,console] ---- $ git remote add myfork ---- -You then need to push your new work to this repository. -It's easiest to push the topic branch you're working on to your forked repository, rather than merging that work into your `master` branch and pushing that. -The reason is that if your work isn't accepted or is cherry-picked, you don't have to rewind your `master` branch (the Git `cherry-pick` operation is covered in more detail in <>). -If the maintainers `merge`, `rebase`, or `cherry-pick` your work, you'll eventually get it back via pulling from their repository anyhow. +تحتاج بعد ذلك إلى دفع عملك الجديد (new work) إلى هذا المستودع. +من الأسهل دفع فرع الموضوع (topic branch) الذي تعمل عليه إلى مستودعك المنسوخ (forked repository)، بدلاً من دمج هذا العمل في فرع `master` الخاص بك ودفع ذلك. +والسبب هو أنه إذا لم يتم قبول عملك (not accepted) أو تم انتقاؤه (cherry-picked)، فلن تضطر إلى إرجاع (rewind) فرع `master` الخاص بك (تتم تغطية عملية (operation) `cherry-pick` الخاصة بـ Git بمزيد من التفصيل في <>). +إذا قام المشرفون بـ `merge` أو `rebase` أو `cherry-pick` لعملك، فستستعيده في النهاية عبر السحب (pulling) من مستودعهم على أي حال. -In any event, you can push your work with: +في أي حال، يمكنك دفع (push) عملك باستخدام: [source,console] ---- @@ -546,11 +546,11 @@ $ git push -u myfork featureA ---- (((git commands, request-pull))) -Once your work has been pushed to your fork of the repository, you need to notify the maintainers of the original project that you have work you'd like them to merge. -This is often called a _pull request_, and you typically generate such a request either via the website -- GitHub has its own "`Pull Request`" mechanism that we'll go over in <> -- or you can run the `git request-pull` command and email the subsequent output to the project maintainer manually. +بمجرد دفع عملك إلى نسختك (fork) من المستودع، ستحتاج إلى إخطار (notify) مشرفي (maintainers) المشروع الأصلي بأن لديك عملاً ترغب في دمجهم إياه (merge). +يُطلق على هذا غالباً اسم _طلب السحب (pull request)_، وعادةً ما تقوم بإنشاء مثل هذا الطلب إما عبر موقع الويب -- يمتلك GitHub آلية "`Pull Request`" خاصة به والتي سنغطيها في <> -- أو يمكنك تشغيل الأمر (command) `git request-pull` وإرسال المخرجات اللاحقة بالبريد الإلكتروني (email) إلى مشرف المشروع (project maintainer) يدوياً. -The `git request-pull` command takes the base branch into which you want your topic branch pulled and the Git repository URL you want them to pull from, and produces a summary of all the changes you're asking to be pulled. -For instance, if Jessica wants to send John a pull request, and she's done two commits on the topic branch she just pushed, she can run this: +يأخذ الأمر `git request-pull` الفرع الأساسي (base branch) الذي تريد سحب فرع موضوعك إليه وعنوان URL لمستودع Git الذي تريد منهم السحب منه، وينتج ملخصاً (summary) لجميع التغييرات التي تطلب سحبها. +على سبيل المثال، إذا كانت Jessica تريد إرسال طلب سحب (pull request) إلى John، وقد قامت بعمليتي تأكيد (two commits) على فرع الموضوع (topic branch) الذي دفعته للتو، فيمكنها تشغيل هذا: [source,console] ---- @@ -571,11 +571,11 @@ Jessica Smith (2): 1 files changed, 9 insertions(+), 1 deletions(-) ---- -This output can be sent to the maintainer -- it tells them where the work was branched from, summarizes the commits, and identifies from where the new work is to be pulled. +يمكن إرسال هذه المخرجات (output) إلى المشرف (maintainer) -- فهي تخبره من أين تفرع (branched) العمل، وتلخص (summarizes) عمليات التأكيد (commits)، وتحدد من أين سيتم سحب العمل الجديد (new work). -On a project for which you're not the maintainer, it's generally easier to have a branch like `master` always track `origin/master` and to do your work in topic branches that you can easily discard if they're rejected. -Having work themes isolated into topic branches also makes it easier for you to rebase your work if the tip of the main repository has moved in the meantime and your commits no longer apply cleanly. -For example, if you want to submit a second topic of work to the project, don't continue working on the topic branch you just pushed up -- start over from the main repository's `master` branch: +في المشروع الذي لست مشرفاً (maintainer) عليه، من الأسهل عموماً أن يكون لديك فرع مثل `master` يتتبع (track) دائماً `origin/master` وأن تقوم بعملك في فروع المواضيع (topic branches) التي يمكنك التخلص منها (discard) بسهولة إذا تم رفضها. +كما أن عزل (isolated) موضوعات العمل (work themes) في فروع المواضيع (topic branches) يسهل عليك إعادة بناء (rebase) عملك إذا تحرك طرف (tip) المستودع الرئيسي في غضون ذلك ولم تعد عمليات التأكيد الخاصة بك تُطبق بشكل نظيف (apply cleanly). +على سبيل المثال، إذا كنت ترغب في إرسال موضوع عمل ثاني (second topic of work) إلى المشروع، فلا تستمر في العمل على فرع الموضوع الذي دفعته للتو -- ابدأ من جديد من فرع `master` الخاص بالمستودع الرئيسي: [source,console] ---- @@ -588,13 +588,13 @@ $ git request-pull origin/master myfork $ git fetch origin ---- -Now, each of your topics is contained within a silo -- similar to a patch queue -- that you can rewrite, rebase, and modify without the topics interfering or interdepending on each other, like so: +الآن، كل موضوع من مواضيعك (topics) موجود داخل صومعة (silo) -- على غرار قائمة انتظار التصحيح (patch queue) -- يمكنك إعادة كتابتها وإعادة بنائها وتعديلها دون أن تتداخل المواضيع أو تعتمد على بعضها البعض (interfering or interdepending)، هكذا: -.Initial commit history with `featureB` work +.Initial commit history with `featureB` work (سجل التأكيد الأولي مع عمل `featureB`) image::images/public-small-1.png[Initial commit history with `featureB` work] -Let's say the project maintainer has pulled in a bunch of other patches and tried your first branch, but it no longer cleanly merges. -In this case, you can try to rebase that branch on top of `origin/master`, resolve the conflicts for the maintainer, and then resubmit your changes: +لنفترض أن مشرف المشروع (project maintainer) قد سحب مجموعة من التصحيحات (patches) الأخرى وجرب فرعك الأول، لكنه لم يعد يدمج (merges) بشكل نظيف. +في هذه الحالة، يمكنك محاولة إعادة بناء (rebase) ذلك الفرع أعلى (on top of) `origin/master`، وحل التعارضات (resolve the conflicts) نيابة عن المشرف، ثم إعادة إرسال (resubmit) تغييراتك: [source,console] ---- @@ -603,18 +603,18 @@ $ git rebase origin/master $ git push -f myfork featureA ---- -This rewrites your history to now look like <>. +يؤدي هذا إلى إعادة كتابة سجلك (rewrites your history) ليبدو الآن مثل <>. [[psp_b]] -.Commit history after `featureA` work +.Commit history after `featureA` work (سجل التأكيد بعد عمل `featureA`) image::images/public-small-2.png[Commit history after `featureA` work] -Because you rebased the branch, you have to specify the `-f` to your push command in order to be able to replace the `featureA` branch on the server with a commit that isn't a descendant of it. -An alternative would be to push this new work to a different branch on the server (perhaps called `featureAv2`). +نظراً لأنك أعدت بناء (rebased) الفرع، يجب عليك تحديد `-f` لأمر الدفع (push command) الخاص بك لكي تتمكن من استبدال (replace) فرع `featureA` على الخادم (server) بعملية تأكيد (commit) ليست سليلة (descendant) له. +البديل (alternative) هو دفع هذا العمل الجديد (new work) إلى فرع مختلف على الخادم (ربما يسمى `featureAv2`). -Let's look at one more possible scenario: the maintainer has looked at work in your second branch and likes the concept but would like you to change an implementation detail. -You'll also take this opportunity to move the work to be based off the project's current `master` branch. -You start a new branch based off the current `origin/master` branch, squash the `featureB` changes there, resolve any conflicts, make the implementation change, and then push that as a new branch: +لنلق نظرة على سيناريو (scenario) محتمل آخر: لقد نظر المشرف (maintainer) في العمل في فرعك الثاني وأعجبه المفهوم (concept) ولكنه يود منك تغيير تفاصيل التنفيذ (implementation detail). +ستنتهز هذه الفرصة أيضاً لنقل العمل ليعتمد على فرع `master` الحالي للمشروع. +تبدأ فرعاً جديداً (new branch) استناداً إلى فرع `origin/master` الحالي، وتضغط (squash) تغييرات `featureB` هناك، وتحل أي تعارضات (conflicts)، وتقوم بتغيير التنفيذ، ثم تدفع (push) ذلك كفرع جديد: (((git commands, merge, squash))) [source,console] @@ -626,25 +626,25 @@ $ git commit $ git push myfork featureBv2 ---- -The `--squash` option takes all the work on the merged branch and squashes it into one changeset producing the repository state as if a real merge happened, without actually making a merge commit. -This means your future commit will have one parent only and allows you to introduce all the changes from another branch and then make more changes before recording the new commit. -Also the `--no-commit` option can be useful to delay the merge commit in case of the default merge process. +يأخذ الخيار `--squash` كل العمل في الفرع المدمج (merged branch) ويضغطه (squashes it) في مجموعة تغييرات واحدة (one changeset) تنتج حالة المستودع (repository state) كما لو حدث دمج حقيقي (real merge)، دون إجراء تأكيد دمج (merge commit) فعلي. +هذا يعني أن التأكيد المستقبلي (future commit) الخاص بك سيكون له أصل واحد (one parent) فقط ويسمح لك بإدخال جميع التغييرات من فرع آخر ثم إجراء المزيد من التغييرات قبل تسجيل التأكيد الجديد (new commit). +كما يمكن أن يكون الخيار `--no-commit` مفيداً لتأخير (delay) تأكيد الدمج (merge commit) في حالة عملية الدمج (merge process) الافتراضية. -At this point, you can notify the maintainer that you've made the requested changes, and that they can find those changes in your `featureBv2` branch. +في هذه المرحلة، يمكنك إخطار (notify) المشرف بأنك أجريت التغييرات المطلوبة، وأنه يمكنه العثور على تلك التغييرات في فرع `featureBv2` الخاص بك. -.Commit history after `featureBv2` work +.Commit history after `featureBv2` work (سجل التأكيد بعد عمل `featureBv2`) image::images/public-small-3.png[Commit history after `featureBv2` work] [[_project_over_email]] -==== Public Project over Email +==== Public Project over Email (مشروع عام عبر البريد الإلكتروني) (((contributing, public large project))) -Many projects have established procedures for accepting patches -- you'll need to check the specific rules for each project, because they will differ. -Since there are several older, larger projects which accept patches via a developer mailing list, we'll go over an example of that now. +أنشأت العديد من المشاريع إجراءات معمول بها لقبول التصحيحات (patches) -- ستحتاج إلى التحقق من القواعد المحددة لكل مشروع، لأنها ستختلف. +نظراً لوجود العديد من المشاريع القديمة والأكبر حجماً التي تقبل التصحيحات عبر القائمة البريدية للمطورين (developer mailing list)، سنستعرض مثالاً على ذلك الآن. -The workflow is similar to the previous use case -- you create topic branches for each patch series you work on. -The difference is how you submit them to the project. -Instead of forking the project and pushing to your own writable version, you generate email versions of each commit series and email them to the developer mailing list: +سير العمل مشابه لحالة الاستخدام السابقة -- تقوم بإنشاء فروع مواضيع (topic branches) لكل سلسلة تصحيحات (patch series) تعمل عليها. +الفرق (difference) هو كيفية إرسالها إلى المشروع. +بدلاً من نسخ (forking) المشروع والدفع (pushing) إلى نسختك القابلة للكتابة، تقوم بإنشاء إصدارات بريد إلكتروني (email versions) من كل سلسلة تأكيدات (commit series) وإرسالها بالبريد الإلكتروني إلى القائمة البريدية للمطورين (developer mailing list): [source,console] ---- @@ -656,9 +656,9 @@ $ git commit ---- (((git commands, format-patch))) -Now you have two commits that you want to send to the mailing list. -You use `git format-patch` to generate the mbox-formatted files that you can email to the list -- it turns each commit into an email message with the first line of the commit message as the subject and the rest of the message plus the patch that the commit introduces as the body. -The nice thing about this is that applying a patch from an email generated with `format-patch` preserves all the commit information properly. +الآن لديك عمليتا تأكيد (two commits) تريد إرسالهما إلى القائمة البريدية. +يمكنك استخدام `git format-patch` لإنشاء ملفات منسقة بصيغة mbox (mbox-formatted files) يمكنك إرسالها بالبريد الإلكتروني (email) إلى القائمة -- فهو يحول كل عملية تأكيد إلى رسالة بريد إلكتروني مع السطر الأول من رسالة التأكيد كموضوع (subject) وبقية الرسالة بالإضافة إلى التصحيح (patch) الذي يقدمه التأكيد كجسم الرسالة (body). +الشيء الجيد في هذا هو أن تطبيق التصحيح (applying a patch) من بريد إلكتروني تم إنشاؤه باستخدام `format-patch` يحافظ على جميع معلومات التأكيد (commit information) بشكل صحيح. [source,console] ---- @@ -667,9 +667,9 @@ $ git format-patch -M origin/master 0002-increase-log-output-to-30-from-25.patch ---- -The `format-patch` command prints out the names of the patch files it creates. -The `-M` switch tells Git to look for renames. -The files end up looking like this: +يطبع الأمر `format-patch` أسماء ملفات التصحيح (patch files) التي ينشئها. +يخبر المفتاح `-M` Git بالبحث عن عمليات إعادة التسمية (renames). +ينتهي الأمر بالملفات لتبدو هكذا: [source,console] ---- @@ -702,17 +702,17 @@ index 76f47bc..f9815f1 100644 2.1.0 ---- -You can also edit these patch files to add more information for the email list that you don't want to show up in the commit message. -If you add text between the `---` line and the beginning of the patch (the `diff --git` line), the developers can read it, but that content is ignored by the patching process. +يمكنك أيضاً تحرير ملفات التصحيح هذه (edit these patch files) لإضافة المزيد من المعلومات لقائمة البريد الإلكتروني التي لا تريد إظهارها في رسالة التأكيد (commit message). +إذا أضفت نصاً بين السطر `---` وبداية التصحيح (السطر `diff --git`)، يمكن للمطورين قراءته، ولكن يتم تجاهل ذلك المحتوى (ignored) بواسطة عملية التصحيح (patching process). -To email this to a mailing list, you can either paste the file into your email program or send it via a command-line program. -Pasting the text often causes formatting issues, especially with "`smarter`" clients that don't preserve newlines and other whitespace appropriately. -Luckily, Git provides a tool to help you send properly formatted patches via IMAP, which may be easier for you. -We'll demonstrate how to send a patch via Gmail, which happens to be the email agent we know best; you can read detailed instructions for a number of mail programs at the end of the aforementioned `Documentation/SubmittingPatches` file in the Git source code. +لإرسال هذا بالبريد الإلكتروني إلى قائمة بريدية (mailing list)، يمكنك إما لصق (paste) الملف في برنامج البريد الإلكتروني (email program) الخاص بك أو إرساله عبر برنامج سطر الأوامر (command-line program). +غالباً ما يتسبب لصق النص في حدوث مشكلات في التنسيق، خاصةً مع العملاء "`الأكثر ذكاءً`" ("`smarter`" clients) الذين لا يحافظون على الأسطر الجديدة (newlines) والمسافات البيضاء الأخرى بشكل مناسب. +لحسن الحظ، يوفر Git أداة لمساعدتك في إرسال التصحيحات المنسقة (formatted patches) بشكل صحيح عبر IMAP، والتي قد تكون أسهل بالنسبة لك. +سنوضح كيفية إرسال تصحيح (patch) عبر Gmail، والذي يصادف أنه وكيل البريد الإلكتروني (email agent) الذي نعرفه بشكل أفضل؛ يمكنك قراءة تعليمات تفصيلية لعدد من برامج البريد (mail programs) في نهاية ملف `Documentation/SubmittingPatches` المذكور أعلاه في الكود المصدري (source code) لـ Git. (((git commands, config)))(((email))) -First, you need to set up the imap section in your `~/.gitconfig` file. -You can set each value separately with a series of `git config` commands, or you can add them manually, but in the end your config file should look something like this: +أولاً، تحتاج إلى إعداد قسم `imap` في ملف `~/.gitconfig` الخاص بك. +يمكنك تعيين كل قيمة بشكل منفصل بسلسلة من أوامر `git config`، أو يمكنك إضافتها يدوياً، ولكن في النهاية يجب أن يبدو ملف التكوين (config file) الخاص بك كالتالي: [source,ini] ---- @@ -725,8 +725,8 @@ You can set each value separately with a series of `git config` commands, or you sslverify = false ---- -If your IMAP server doesn't use SSL, the last two lines probably aren't necessary, and the host value will be `imap://` instead of `imaps://`. -When that is set up, you can use `git imap-send` to place the patch series in the Drafts folder of the specified IMAP server: +إذا كان خادم IMAP الخاص بك لا يستخدم SSL، فربما لا يكون السطران الأخيران ضروريين، وستكون قيمة المضيف (host) `imap://` بدلاً من `imaps://`. +عند إعداد ذلك، يمكنك استخدام `git imap-send` لوضع سلسلة التصحيحات (patch series) في مجلد المسودات (Drafts folder) لخادم IMAP المحدد: [source,console] ---- @@ -738,10 +738,10 @@ sending 2 messages 100% (2/2) done ---- -At this point, you should be able to go to your Drafts folder, change the To field to the mailing list you're sending the patch to, possibly CC the maintainer or person responsible for that section, and send it off. +في هذه المرحلة، يجب أن تكون قادراً على الانتقال إلى مجلد المسودات الخاص بك، وتغيير الحقل "إلى" (To) إلى القائمة البريدية التي ترسل التصحيح إليها، وربما نسخة مخفية (CC) للمشرف (maintainer) أو الشخص المسؤول عن ذلك القسم، وإرساله. -You can also send the patches through an SMTP server. -As before, you can set each value separately with a series of `git config` commands, or you can add them manually in the sendemail section in your `~/.gitconfig` file: +يمكنك أيضاً إرسال التصحيحات عبر خادم SMTP. +كما كان من قبل، يمكنك تعيين كل قيمة بشكل منفصل بسلسلة من أوامر `git config`، أو يمكنك إضافتها يدوياً في قسم `sendemail` في ملف `~/.gitconfig` الخاص بك: [source,ini] ---- @@ -752,7 +752,7 @@ As before, you can set each value separately with a series of `git config` comma smtpserverport = 587 ---- -After this is done, you can use `git send-email` to send your patches: +بعد الانتهاء من ذلك، يمكنك استخدام `git send-email` لإرسال تصحيحاتك (patches): [source,console] ---- @@ -765,7 +765,7 @@ Who should the emails be sent to? jessica@example.com Message-ID to be used as In-Reply-To for the first email? y ---- -Then, Git spits out a bunch of log information looking something like this for each patch you're sending: +بعد ذلك، يُخرج (spits out) Git مجموعة من معلومات السجل (log information) التي تبدو هكذا لكل تصحيح ترسله: [source,text] ---- @@ -787,16 +787,16 @@ Result: OK [TIP] ==== -For help on configuring your system and email, more tips and tricks, and a sandbox to send a trial patch via email, go to https://git-send-email.io[git-send-email.io^]. +للحصول على مساعدة في تكوين نظامك (configuring your system) وبريدك الإلكتروني (email)، والمزيد من النصائح والحيل (tips and tricks)، وبيئة اختبار (sandbox) لإرسال تصحيح تجريبي (trial patch) عبر البريد الإلكتروني، انتقل إلى https://git-send-email.io[git-send-email.io^]. ==== -==== Summary +==== Summary (الملخص) -In this section, we covered multiple workflows, and talked about the differences between working as part of a small team on closed-source projects vs contributing to a big public project. -You know to check for white-space errors before committing, and can write a great commit message. -You learned how to format patches, and e-mail them to a developer mailing list. -Dealing with merges was also covered in the context of the different workflows. -You are now well prepared to collaborate on any project. +في هذا القسم، غطينا العديد من مهام سير العمل (workflows)، وتحدثنا عن الاختلافات (differences) بين العمل كجزء من فريق صغير (small team) في مشاريع مغلقة المصدر (closed-source projects) مقابل المساهمة (contributing) في مشروع عام (public project) كبير. +أنت تعرف الآن كيفية التحقق من أخطاء المسافات البيضاء (white-space errors) قبل التأكيد (committing)، ويمكنك كتابة رسالة تأكيد (commit message) رائعة. +لقد تعلمت كيفية تنسيق التصحيحات (format patches)، وإرسالها بالبريد الإلكتروني (e-mail them) إلى قائمة بريدية للمطورين (developer mailing list). +كما تمت تغطية التعامل مع عمليات الدمج (merges) في سياق مهام سير العمل المختلفة. +أنت الآن مستعد جيداً للتعاون (collaborate) في أي مشروع. -Next, you'll see how to work the other side of the coin: maintaining a Git project. -You'll learn how to be a benevolent dictator or integration manager. +بعد ذلك، سترى كيفية العمل على الوجه الآخر للعملة: الحفاظ (maintaining) على مشروع Git. +ستتعلم كيف تكون ديكتاتوراً خيراً (benevolent dictator) أو مدير تكامل (integration manager). diff --git a/book/05-distributed-git/sections/distributed-workflows.asc b/book/05-distributed-git/sections/distributed-workflows.asc index b61289dc1..13c6eb5fc 100644 --- a/book/05-distributed-git/sections/distributed-workflows.asc +++ b/book/05-distributed-git/sections/distributed-workflows.asc @@ -1,102 +1,102 @@ -=== Distributed Workflows +=== Distributed Workflows (سير العمل الموزع) (((workflows))) -In contrast with Centralized Version Control Systems (CVCSs), the distributed nature of Git allows you to be far more flexible in how developers collaborate on projects. -In centralized systems, every developer is a node working more or less equally with a central hub. -In Git, however, every developer is potentially both a node and a hub; that is, every developer can both contribute code to other repositories and maintain a public repository on which others can base their work and which they can contribute to. -This presents a vast range of workflow possibilities for your project and/or your team, so we'll cover a few common paradigms that take advantage of this flexibility. -We'll go over the strengths and possible weaknesses of each design; you can choose a single one to use, or you can mix and match features from each. +على النقيض من أنظمة التحكم في الإصدار المركزية (Centralized Version Control Systems - CVCSs)، تتيح لك الطبيعة الموزعة (distributed nature) لـ Git أن تكون أكثر مرونة (flexible) في كيفية تعاون المطورين (developers collaborate) في المشاريع. +في الأنظمة المركزية، يكون كل مطور عبارة عن عقدة (node) تعمل بشكل متساوٍ تقريباً مع مركز رئيسي (central hub). +ومع ذلك، في Git، من المحتمل أن يكون كل مطور عقدة (node) ومركزاً (hub) في نفس الوقت؛ أي أن كل مطور يمكنه المساهمة بالكود (contribute code) في مستودعات (repositories) أخرى والاحتفاظ بمستودع عام (maintain a public repository) يمكن للآخرين أن يبنوا عليه عملهم ويساهموا فيه. +يمثل هذا نطاقاً واسعاً من إمكانيات سير العمل (workflow possibilities) لمشروعك و/أو فريقك، لذلك سنغطي بعض النماذج (paradigms) الشائعة التي تستفيد من هذه المرونة. +سنستعرض نقاط القوة (strengths) ونقاط الضعف (weaknesses) المحتملة لكل تصميم؛ يمكنك اختيار واحد فقط لاستخدامه، أو يمكنك مزج الميزات (mix and match features) ومطابقتها من كل منها. -==== Centralized Workflow +==== Centralized Workflow (سير العمل المركزي) (((workflows, centralized))) -In centralized systems, there is generally a single collaboration model -- the centralized workflow. -One central hub, or _repository_, can accept code, and everyone synchronizes their work with it. -A number of developers are nodes -- consumers of that hub -- and synchronize with that centralized location. +في الأنظمة المركزية (centralized systems)، يوجد عموماً نموذج تعاون (collaboration model) واحد -- سير العمل المركزي (centralized workflow). +يمكن لمركز رئيسي واحد (central hub)، أو _مستودع (repository)_، قبول الكود (accept code)، ويقوم الجميع بمزامنة عملهم (synchronizes their work) معه. +عدد من المطورين عبارة عن عقد (nodes) -- مستهلكين (consumers) لذلك المركز -- ويتزامنون مع ذلك الموقع المركزي (centralized location). -.Centralized workflow +.Centralized workflow (سير العمل المركزي) image::images/centralized_workflow.png[Centralized workflow] -This means that if two developers clone from the hub and both make changes, the first developer to push their changes back up can do so with no problems. -The second developer must merge in the first one's work before pushing changes up, so as not to overwrite the first developer's changes. -This concept is as true in Git as it is in Subversion(((Subversion))) (or any CVCS), and this model works perfectly well in Git. +هذا يعني أنه إذا قام مطوران بالاستنساخ (clone) من المركز وقاما بإجراء تغييرات، فإن أول مطور يدفع تغييراته (push their changes) مرة أخرى يمكنه القيام بذلك دون أي مشاكل. +يجب على المطور الثاني دمج (merge) عمل المطور الأول قبل دفع التغييرات (pushing changes)، حتى لا يتم الكتابة فوق (overwrite) تغييرات المطور الأول. +هذا المفهوم (concept) صحيح في Git كما هو الحال في Subversion(((Subversion))) (أو أي CVCS)، وهذا النموذج (model) يعمل بشكل مثالي في Git. -If you are already comfortable with a centralized workflow in your company or team, you can easily continue using that workflow with Git. -Simply set up a single repository, and give everyone on your team push access; Git won't let users overwrite each other. +إذا كنت مرتاحاً بالفعل لسير العمل المركزي (centralized workflow) في شركتك أو فريقك، فيمكنك بسهولة الاستمرار في استخدام سير العمل هذا مع Git. +ما عليك سوى إعداد مستودع (repository) واحد، ومنح كل فرد في فريقك حق الوصول للدفع (push access)؛ لن يسمح Git للمستخدمين بالكتابة فوق بعضهم البعض. -Say John and Jessica both start working at the same time. -John finishes his change and pushes it to the server. -Then Jessica tries to push her changes, but the server rejects them. -She is told that she's trying to push non-fast-forward changes and that she won't be able to do so until she fetches and merges. -This workflow is attractive to a lot of people because it's a paradigm that many are familiar and comfortable with. +لنفترض أن John و Jessica يبدآن العمل في نفس الوقت. +ينهي John تغييره (change) ويدفعه (pushes it) إلى الخادم (server). +ثم تحاول Jessica دفع تغييراتها، لكن الخادم يرفضها (rejects them). +يُقال لها إنها تحاول دفع تغييرات ليست من نوع التقديم السريع (non-fast-forward changes) وأنها لن تتمكن من القيام بذلك حتى تقوم بالجلب والدمج (fetches and merges). +سير العمل هذا جذاب لكثير من الناس لأنه نموذج (paradigm) مألوف ومريح للعديد منهم. -This is also not limited to small teams. -With Git's branching model, it's possible for hundreds of developers to successfully work on a single project through dozens of branches simultaneously. +هذا لا يقتصر أيضاً على الفرق الصغيرة (small teams). +باستخدام نموذج تفريع (branching model) Git، من الممكن لمئات المطورين العمل بنجاح في مشروع واحد (single project) من خلال عشرات الفروع (branches) في وقت واحد. [[_integration_manager]] -==== Integration-Manager Workflow +==== Integration-Manager Workflow (سير عمل مدير التكامل) (((workflows, integration manager))) -Because Git allows you to have multiple remote repositories, it's possible to have a workflow where each developer has write access to their own public repository and read access to everyone else's. -This scenario often includes a canonical repository that represents the "`official`" project. -To contribute to that project, you create your own public clone of the project and push your changes to it. -Then, you can send a request to the maintainer of the main project to pull in your changes. -The maintainer can then add your repository as a remote, test your changes locally, merge them into their branch, and push back to their repository. -The process works as follows (see <>): - -1. The project maintainer pushes to their public repository. -2. A contributor clones that repository and makes changes. -3. The contributor pushes to their own public copy. -4. The contributor sends the maintainer an email asking them to pull changes. -5. The maintainer adds the contributor's repository as a remote and merges locally. -6. The maintainer pushes merged changes to the main repository. +نظراً لأن Git يسمح لك بامتلاك مستودعات بعيدة (remote repositories) متعددة، فمن الممكن أن يكون لديك سير عمل حيث يتمتع كل مطور (developer) بوصول كتابة (write access) إلى مستودعه العام (public repository) الخاص ووصول قراءة (read access) إلى مستودعات الجميع. +غالباً ما يتضمن هذا السيناريو مستودعاً أساسياً (canonical repository) يمثل المشروع "`الرسمي`" ("`official`"). +للمساهمة (contribute) في ذلك المشروع، تقوم بإنشاء نسختك العامة (public clone) الخاصة من المشروع ودفع تغييراتك (push your changes) إليها. +بعد ذلك، يمكنك إرسال طلب (request) إلى المشرف (maintainer) على المشروع الرئيسي لسحب (pull in) تغييراتك. +يمكن للمشرف بعد ذلك إضافة مستودعك كجهاز تحكم عن بعد (remote)، واختبار تغييراتك محلياً (locally)، ودمجها (merge them) في فرعهم، ودفعها (push) مرة أخرى إلى مستودعهم. +تعمل العملية (process) على النحو التالي (انظر <>): + +1. يقوم المشرف على المشروع (project maintainer) بالدفع (pushes) إلى مستودعه العام (public repository). +2. يقوم المساهم (contributor) باستنساخ (clones) ذلك المستودع وإجراء التغييرات. +3. يقوم المساهم بالدفع (pushes) إلى نسخته العامة الخاصة. +4. يرسل المساهم إلى المشرف بريداً إلكترونياً (email) يطلب منه سحب التغييرات (pull changes). +5. يضيف المشرف مستودع المساهم كجهاز تحكم عن بعد (remote) ويدمجه محلياً (merges locally). +6. يدفع (pushes) المشرف التغييرات المدمجة (merged changes) إلى المستودع الرئيسي (main repository). [[wfdiag_b]] -.Integration-manager workflow +.Integration-manager workflow (سير عمل مدير التكامل) image::images/integration-manager.png[Integration-manager workflow] (((forking))) -This is a very common workflow with hub-based tools like GitHub or GitLab, where it's easy to fork a project and push your changes into your fork for everyone to see. -One of the main advantages of this approach is that you can continue to work, and the maintainer of the main repository can pull in your changes at any time. -Contributors don't have to wait for the project to incorporate their changes -- each party can work at their own pace. +هذا سير عمل شائع جداً مع الأدوات القائمة على المركز (hub-based tools) مثل GitHub أو GitLab، حيث يكون من السهل نسخ (fork) مشروع ودفع تغييراتك (push your changes) إلى نسختك (fork) ليراها الجميع. +تتمثل إحدى المزايا الرئيسية (main advantages) لهذا النهج في أنه يمكنك الاستمرار في العمل، ويمكن لمشرف (maintainer) المستودع الرئيسي (main repository) سحب تغييراتك (pull in your changes) في أي وقت. +لا يتعين على المساهمين (Contributors) انتظار المشروع لدمج (incorporate) تغييراتهم -- يمكن لكل طرف العمل بالوتيرة التي تناسبه. -==== Dictator and Lieutenants Workflow +==== Dictator and Lieutenants Workflow (سير عمل الديكتاتور والملازمين) (((workflows, dictator and lieutenants))) -This is a variant of a multiple-repository workflow. -It's generally used by huge projects with hundreds of collaborators; one famous example is the Linux kernel. -Various integration managers are in charge of certain parts of the repository; they're called _lieutenants_. -All the lieutenants have one integration manager known as the benevolent dictator. -The benevolent dictator pushes from their directory to a reference repository from which all the collaborators need to pull. -The process works like this (see <>): - -1. Regular developers work on their topic branch and rebase their work on top of `master`. - The `master` branch is that of the reference repository to which the dictator pushes. -2. Lieutenants merge the developers' topic branches into their `master` branch. -3. The dictator merges the lieutenants' `master` branches into the dictator's `master` branch. -4. Finally, the dictator pushes that `master` branch to the reference repository so the other developers can rebase on it. +هذا متغير (variant) من سير عمل متعدد المستودعات (multiple-repository workflow). +يُستخدم عموماً في المشاريع الضخمة (huge projects) التي تضم مئات المتعاونين (collaborators)؛ أحد الأمثلة الشهيرة هو نواة Linux (Linux kernel). +يتولى مديرو تكامل (integration managers) مختلفون مسؤولية أجزاء معينة (certain parts) من المستودع (repository)؛ ويُطلق عليهم اسم _الملازمين (lieutenants)_. +جميع الملازمين لديهم مدير تكامل واحد (one integration manager) يُعرف باسم الديكتاتور الخيّر (benevolent dictator). +يدفع (pushes) الديكتاتور الخيّر من دليله (directory) إلى مستودع مرجعي (reference repository) يحتاج جميع المتعاونين إلى السحب (pull) منه. +تعمل العملية (process) على النحو التالي (انظر <>): + +1. يعمل المطورون العاديون (Regular developers) على فرع الموضوع (topic branch) الخاص بهم ويعيدون بناء عملهم (rebase their work) على قمة `master`. + الفرع (branch) `master` هو فرع المستودع المرجعي (reference repository) الذي يدفع (pushes) إليه الديكتاتور. +2. يدمج (merge) الملازمون فروع موضوع المطورين في فرع `master` الخاص بهم. +3. يدمج الديكتاتور فروع `master` الخاصة بالملازمين في فرع `master` الخاص بالديكتاتور. +4. أخيراً، يدفع (pushes) الديكتاتور فرع `master` ذلك إلى المستودع المرجعي حتى يتمكن المطورون الآخرون من إعادة البناء (rebase) عليه. [[wfdiag_c]] -.Benevolent dictator workflow +.Benevolent dictator workflow (سير عمل الديكتاتور الخيّر) image::images/benevolent-dictator.png[Benevolent dictator workflow] -This kind of workflow isn't common, but can be useful in very big projects, or in highly hierarchical environments. -It allows the project leader (the dictator) to delegate much of the work and collect large subsets of code at multiple points before integrating them. +هذا النوع من سير العمل (workflow) ليس شائعاً، ولكن يمكن أن يكون مفيداً في المشاريع الكبيرة جداً، أو في البيئات الهرمية (hierarchical environments) للغاية. +إنه يسمح لقائد المشروع (project leader) (الديكتاتور) بتفويض (delegate) جزء كبير من العمل وجمع مجموعات فرعية كبيرة (large subsets) من الكود في نقاط متعددة قبل دمجها (integrating them). [[_patterns_for_managing_source_code_branches]] -==== Patterns for Managing Source Code Branches +==== Patterns for Managing Source Code Branches (أنماط لإدارة فروع الكود المصدري) [NOTE] ==== -Martin Fowler has made a guide "Patterns for Managing Source Code Branches". -This guide covers all the common Git workflows, and explains how/when to use them. -There's also a section comparing high and low integration frequencies. +أعد Martin Fowler دليلاً بعنوان "أنماط إدارة فروع الكود المصدري" (Patterns for Managing Source Code Branches). +يغطي هذا الدليل جميع مهام سير عمل Git (Git workflows) الشائعة، ويشرح كيف/متى يجب استخدامها. +هناك أيضاً قسم يقارن (comparing) بين ترددات الدمج (integration frequencies) العالية والمنخفضة. https://martinfowler.com/articles/branching-patterns.html[^] ==== -==== Workflows Summary +==== Workflows Summary (ملخص سير العمل) -These are some commonly used workflows that are possible with a distributed system like Git, but you can see that many variations are possible to suit your particular real-world workflow. -Now that you can (hopefully) determine which workflow combination may work for you, we'll cover some more specific examples of how to accomplish the main roles that make up the different flows. -In the next section, you'll learn about a few common patterns for contributing to a project. +هذه بعض مهام سير العمل (workflows) الشائعة الاستخدام والممكنة باستخدام نظام موزع (distributed system) مثل Git، ولكن يمكنك أن ترى أن العديد من الاختلافات (variations) ممكنة لتناسب سير عملك الخاص في العالم الحقيقي. +الآن بعد أن أصبح بإمكانك (نأمل) تحديد مجموعة (combination) سير العمل التي قد تناسبك، سنغطي بعض الأمثلة (examples) الأكثر تحديداً لكيفية إنجاز الأدوار الرئيسية (main roles) التي تشكل التدفقات (flows) المختلفة. +في القسم التالي، ستتعرف على بعض الأنماط الشائعة (common patterns) للمساهمة (contributing) في مشروع. diff --git a/book/05-distributed-git/sections/maintaining.asc b/book/05-distributed-git/sections/maintaining.asc index c377bb68d..dcb64157c 100644 --- a/book/05-distributed-git/sections/maintaining.asc +++ b/book/05-distributed-git/sections/maintaining.asc @@ -1,59 +1,59 @@ -=== Maintaining a Project +=== Maintaining a Project (صيانة مشروع) (((maintaining a project))) -In addition to knowing how to contribute effectively to a project, you'll likely need to know how to maintain one. -This can consist of accepting and applying patches generated via `format-patch` and emailed to you, or integrating changes in remote branches for repositories you've added as remotes to your project. -Whether you maintain a canonical repository or want to help by verifying or approving patches, you need to know how to accept work in a way that is clearest for other contributors and sustainable by you over the long run. +بالإضافة إلى معرفة كيفية المساهمة (contribute) بفعالية في مشروع، ستحتاج على الأرجح إلى معرفة كيفية صيانة (maintain) أحدها. +يمكن أن يتكون هذا من قبول وتطبيق التصحيحات (patches) التي تم إنشاؤها عبر `format-patch` وإرسالها إليك بالبريد الإلكتروني (emailed)، أو دمج (integrating) التغييرات في الفروع البعيدة (remote branches) للمستودعات التي أضفتها كأجهزة تحكم عن بعد (remotes) إلى مشروعك. +سواء كنت تحتفظ بمستودع أساسي (canonical repository) أو ترغب في المساعدة من خلال التحقق من التصحيحات (verifying patches) أو الموافقة عليها (approving)، فأنت بحاجة إلى معرفة كيفية قبول العمل بطريقة تكون أكثر وضوحاً للمساهمين الآخرين (other contributors) ومستدامة (sustainable) بالنسبة لك على المدى الطويل. -==== Working in Topic Branches +==== Working in Topic Branches (العمل في فروع المواضيع) (((branches, topic))) -When you're thinking of integrating new work, it's generally a good idea to try it out in a _topic branch_ -- a temporary branch specifically made to try out that new work. -This way, it's easy to tweak a patch individually and leave it if it's not working until you have time to come back to it. -If you create a simple branch name based on the theme of the work you're going to try, such as `ruby_client` or something similarly descriptive, you can easily remember it if you have to abandon it for a while and come back later. -The maintainer of the Git project tends to namespace these branches as well -- such as `sc/ruby_client`, where `sc` is short for the person who contributed the work. -As you'll remember, you can create the branch based off your `master` branch like this: +عندما تفكر في دمج (integrating) عمل جديد، فمن الجيد عموماً تجربته في _فرع موضوع (topic branch)_ -- فرع مؤقت (temporary branch) مصمم خصيصاً لتجربة ذلك العمل الجديد. +بهذه الطريقة، من السهل تعديل تصحيح (tweak a patch) بشكل فردي وتركه إذا كان لا يعمل حتى يتوفر لك الوقت للعودة إليه. +إذا قمت بإنشاء اسم فرع بسيط استناداً إلى موضوع (theme) العمل الذي ستقوم بتجربته، مثل `ruby_client` أو شيء وصفي (descriptive) مشابه، يمكنك بسهولة تذكره إذا كان عليك التخلي عنه لفترة والعودة إليه لاحقاً. +يميل مشرف (maintainer) مشروع Git إلى وضع مساحة أسماء (namespace) لهذه الفروع أيضاً -- مثل `sc/ruby_client`، حيث `sc` هو اختصار للشخص الذي ساهم في العمل. +كما ستتذكر، يمكنك إنشاء الفرع استناداً إلى فرع `master` الخاص بك هكذا: [source,console] ---- $ git branch sc/ruby_client master ---- -Or, if you want to also switch to it immediately, you can use the `checkout -b` option: +أو، إذا كنت ترغب في التبديل (switch) إليه أيضاً على الفور، يمكنك استخدام الخيار `checkout -b`: [source,console] ---- $ git checkout -b sc/ruby_client master ---- -Now you're ready to add the contributed work that you received into this topic branch and determine if you want to merge it into your longer-term branches. +أنت الآن مستعد لإضافة العمل المساهم (contributed work) الذي تلقيته إلى فرع الموضوع هذا وتحديد ما إذا كنت تريد دمجه (merge) في فروعك طويلة المدى (longer-term branches). [[_patches_from_email]] -==== Applying Patches from Email +==== Applying Patches from Email (تطبيق التصحيحات من البريد الإلكتروني) (((email, applying patches from))) -If you receive a patch over email that you need to integrate into your project, you need to apply the patch in your topic branch to evaluate it. -There are two ways to apply an emailed patch: with `git apply` or with `git am`. +إذا تلقيت تصحيحاً (patch) عبر البريد الإلكتروني تحتاج إلى دمجه (integrate) في مشروعك، فأنت بحاجة إلى تطبيق التصحيح في فرع الموضوع (topic branch) الخاص بك لتقييمه. +هناك طريقتان لتطبيق تصحيح تم إرساله بالبريد الإلكتروني: باستخدام `git apply` أو باستخدام `git am`. -===== Applying a Patch with `apply` +===== Applying a Patch with `apply` (تطبيق تصحيح باستخدام `apply`) (((git commands, apply))) -If you received the patch from someone who generated it with `git diff` or some variation of the Unix `diff` command (which is not recommended; see the next section), you can apply it with the `git apply` command. -Assuming you saved the patch at `/tmp/patch-ruby-client.patch`, you can apply the patch like this: +إذا تلقيت التصحيح (patch) من شخص قام بإنشائه باستخدام `git diff` أو بعض الاختلافات (variation) في أمر (command) `diff` الخاص بـ Unix (والذي لا يُنصح به؛ راجع القسم التالي)، فيمكنك تطبيقه باستخدام الأمر `git apply`. +بافتراض أنك حفظت التصحيح في `/tmp/patch-ruby-client.patch`، يمكنك تطبيق التصحيح هكذا: [source,console] ---- $ git apply /tmp/patch-ruby-client.patch ---- -This modifies the files in your working directory. -It's almost identical to running a `patch -p1` command to apply the patch, although it's more paranoid and accepts fewer fuzzy matches than patch. -It also handles file adds, deletes, and renames if they're described in the `git diff` format, which `patch` won't do. -Finally, `git apply` is an "`apply all or abort all`" model where either everything is applied or nothing is, whereas `patch` can partially apply patchfiles, leaving your working directory in a weird state. -`git apply` is overall much more conservative than `patch`. -It won't create a commit for you -- after running it, you must stage and commit the changes introduced manually. +يؤدي هذا إلى تعديل الملفات (modifies the files) في دليل عملك (working directory). +إنه مطابق تقريباً (almost identical) لتشغيل أمر `patch -p1` لتطبيق التصحيح، على الرغم من أنه أكثر تشككاً (paranoid) ويقبل مطابقات غامضة (fuzzy matches) أقل من patch. +كما أنه يتعامل مع إضافات (adds) الملفات، وحذفها (deletes)، وإعادة تسميتها (renames) إذا كانت موصوفة بتنسيق `git diff`، وهو ما لن يفعله `patch`. +أخيراً، `git apply` هو نموذج (model) "`طبق الكل أو ألغِ الكل`" ("`apply all or abort all`") حيث يتم تطبيق كل شيء أو لا يتم تطبيق أي شيء، في حين أن `patch` يمكن أن يطبق ملفات التصحيح (patchfiles) جزئياً (partially)، تاركاً دليل عملك في حالة غريبة (weird state). +يعتبر `git apply` بشكل عام أكثر تحفظاً (conservative) بكثير من `patch`. +لن يقوم بإنشاء عملية تأكيد (commit) لك -- بعد تشغيله، يجب عليك تجهيز وتأكيد (stage and commit) التغييرات (changes) التي تم إدخالها يدوياً. -You can also use `git apply` to see if a patch applies cleanly before you try actually applying it -- you can run `git apply --check` with the patch: +يمكنك أيضاً استخدام `git apply` لمعرفة ما إذا كان التصحيح ينطبق بشكل نظيف (applies cleanly) قبل أن تحاول تطبيقه بالفعل -- يمكنك تشغيل `git apply --check` مع التصحيح: [source,console] ---- @@ -62,20 +62,20 @@ error: patch failed: ticgit.gemspec:1 error: ticgit.gemspec: patch does not apply ---- -If there is no output, then the patch should apply cleanly. -This command also exits with a non-zero status if the check fails, so you can use it in scripts if you want. +إذا لم تكن هناك مخرجات (output)، فيجب أن ينطبق التصحيح (patch) بشكل نظيف. +يخرج هذا الأمر (command) أيضاً بحالة غير صفرية (non-zero status) إذا فشل التحقق، لذا يمكنك استخدامه في البرامج النصية (scripts) إذا أردت. [[_git_am]] -===== Applying a Patch with `am` +===== Applying a Patch with `am` (تطبيق تصحيح باستخدام `am`) (((git commands, am))) -If the contributor is a Git user and was good enough to use the `format-patch` command to generate their patch, then your job is easier because the patch contains author information and a commit message for you. -If you can, encourage your contributors to use `format-patch` instead of `diff` to generate patches for you. -You should only have to use `git apply` for legacy patches and things like that. +إذا كان المساهم (contributor) أحد مستخدمي Git وكان جيداً بما يكفي لاستخدام الأمر (command) `format-patch` لإنشاء تصحيحه (patch)، فإن وظيفتك تكون أسهل لأن التصحيح يحتوي على معلومات المؤلف (author information) ورسالة تأكيد (commit message) لك. +إذا استطعت، شجع المساهمين (contributors) على استخدام `format-patch` بدلاً من `diff` لإنشاء تصحيحات لك. +يجب أن تضطر فقط إلى استخدام `git apply` للتصحيحات القديمة (legacy patches) وأشياء من هذا القبيل. -To apply a patch generated by `format-patch`, you use `git am` (the command is named `am` as it is used to "apply a series of patches from a mailbox"). -Technically, `git am` is built to read an mbox file, which is a simple, plain-text format for storing one or more email messages in one text file. -It looks something like this: +لتطبيق تصحيح تم إنشاؤه بواسطة `format-patch`، يمكنك استخدام `git am` (تمت تسمية الأمر بـ `am` لأنه يُستخدم لـ "تطبيق سلسلة من التصحيحات من صندوق بريد" - "apply a series of patches from a mailbox"). +من الناحية الفنية، تم تصميم `git am` لقراءة ملف mbox، وهو تنسيق نص عادي (plain-text format) بسيط لتخزين رسالة بريد إلكتروني (email messages) أو أكثر في ملف نصي (text file) واحد. +يبدو هكذا: [source,console] ---- @@ -87,11 +87,11 @@ Subject: [PATCH 1/2] Add limit to log function Limit log functionality to the first 20 ---- -This is the beginning of the output of the `git format-patch` command that you saw in the previous section; it also represents a valid mbox email format. -If someone has emailed you the patch properly using `git send-email`, and you download that into an mbox format, then you can point `git am` to that mbox file, and it will start applying all the patches it sees. -If you run a mail client that can save several emails out in mbox format, you can save entire patch series into a file and then use `git am` to apply them one at a time. +هذه هي بداية مخرجات الأمر `git format-patch` الذي رأيته في القسم السابق؛ وهو يمثل أيضاً تنسيق بريد إلكتروني (email format) صالح (valid) من نوع mbox. +إذا أرسل إليك شخص ما التصحيح (patch) بالبريد الإلكتروني (emailed) بشكل صحيح باستخدام `git send-email`، وقمت بتنزيل ذلك بتنسيق mbox، فيمكنك توجيه `git am` إلى ملف mbox ذلك، وسيبدأ في تطبيق جميع التصحيحات (patches) التي يراها. +إذا قمت بتشغيل عميل بريد (mail client) يمكنه حفظ (save) عدة رسائل بريد إلكتروني (emails) بتنسيق mbox، فيمكنك حفظ سلسلة التصحيحات (patch series) بأكملها في ملف (file) ثم استخدام `git am` لتطبيقها واحداً تلو الآخر (one at a time). -However, if someone uploaded a patch file generated via `git format-patch` to a ticketing system or something similar, you can save the file locally and then pass that file saved on your disk to `git am` to apply it: +ومع ذلك، إذا قام شخص ما بتحميل ملف تصحيح (patch file) تم إنشاؤه عبر `git format-patch` إلى نظام تذاكر (ticketing system) أو شيء مشابه، فيمكنك حفظ الملف محلياً (locally) ثم تمرير ذلك الملف المحفوظ على القرص الخاص بك إلى `git am` لتطبيقه: [source,console] ---- @@ -99,9 +99,9 @@ $ git am 0001-limit-log-function.patch Applying: Add limit to log function ---- -You can see that it applied cleanly and automatically created the new commit for you. -The author information is taken from the email's `From` and `Date` headers, and the message of the commit is taken from the `Subject` and body (before the patch) of the email. -For example, if this patch was applied from the mbox example above, the commit generated would look something like this: +يمكنك أن ترى أنه طُبق (applied) بشكل نظيف (cleanly) وأنشأ التأكيد الجديد (new commit) تلقائياً (automatically) لك. +يتم أخذ معلومات المؤلف من رؤوس `From` و `Date` للبريد الإلكتروني، ويتم أخذ رسالة التأكيد (message of the commit) من الـ `Subject` (الموضوع) وجسم الرسالة (body) (قبل التصحيح) للبريد الإلكتروني. +على سبيل المثال، إذا تم تطبيق هذا التصحيح (patch) من مثال mbox أعلاه، فستبدو عملية التأكيد (commit) الناتجة هكذا: [source,console] ---- @@ -117,12 +117,12 @@ CommitDate: Thu Apr 9 09:19:06 2009 -0700 Limit log functionality to the first 20 ---- -The `Commit` information indicates the person who applied the patch and the time it was applied. -The `Author` information is the individual who originally created the patch and when it was originally created. +تشير معلومات `Commit` إلى الشخص الذي طبق التصحيح والوقت الذي تم تطبيقه فيه. +معلومات `Author` هي الفرد الذي أنشأ التصحيح أصلاً ووقت إنشائه أصلاً. -But it's possible that the patch won't apply cleanly. -Perhaps your main branch has diverged too far from the branch the patch was built from, or the patch depends on another patch you haven't applied yet. -In that case, the `git am` process will fail and ask you what you want to do: +ولكن من الممكن ألا يتم تطبيق التصحيح (patch) بشكل نظيف. +ربما يكون فرعك الرئيسي (main branch) قد تباعد (diverged) كثيراً عن الفرع الذي تم بناء التصحيح منه، أو يعتمد التصحيح على تصحيح آخر لم تقم بتطبيقه بعد. +في هذه الحالة، ستفشل عملية (process) `git am` وتطلب منك ما تريد القيام به: [source,console] ---- @@ -136,8 +136,8 @@ If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". ---- -This command puts conflict markers in any files it has issues with, much like a conflicted merge or rebase operation. -You solve this issue much the same way -- edit the file to resolve the conflict, stage the new file, and then run `git am --resolved` to continue to the next patch: +يضع هذا الأمر (command) علامات تعارض (conflict markers) في أي ملفات (files) يواجه مشكلات معها، تماماً مثل عملية الدمج أو إعادة البناء المتعارضة (conflicted merge or rebase operation). +تقوم بحل (solve) هذه المشكلة بنفس الطريقة تقريباً -- قم بتحرير (edit) الملف لحل التعارض (resolve the conflict)، وقم بتجهيز (stage) الملف الجديد، ثم قم بتشغيل `git am --resolved` للمتابعة (continue) إلى التصحيح التالي: [source,console] ---- @@ -147,9 +147,9 @@ $ git am --resolved Applying: See if this helps the gem ---- -If you want Git to try a bit more intelligently to resolve the conflict, you can pass a `-3` option to it, which makes Git attempt a three-way merge. -This option isn't on by default because it doesn't work if the commit the patch says it was based on isn't in your repository. -If you do have that commit -- if the patch was based on a public commit -- then the `-3` option is generally much smarter about applying a conflicting patch: +إذا كنت تريد من Git المحاولة بذكاء أكبر (intelligently) لحل التعارض (resolve the conflict)، فيمكنك تمرير الخيار `-3` إليه، مما يجعل Git يحاول دمجاً ثلاثي الاتجاهات (three-way merge). +لا يتم تشغيل هذا الخيار افتراضياً لأنه لا يعمل إذا لم يكن التأكيد (commit) الذي يقول التصحيح (patch) إنه استند إليه موجوداً في مستودعك. +إذا كان لديك ذلك التأكيد -- إذا كان التصحيح (patch) يستند إلى تأكيد عام (public commit) -- فإن الخيار `-3` يكون عموماً أكثر ذكاءً (smarter) بكثير في تطبيق تصحيح متعارض (conflicting patch): [source,console] ---- @@ -162,10 +162,10 @@ Falling back to patching base and 3-way merge... No changes -- Patch already applied. ---- -In this case, without the `-3` option the patch would have been considered as a conflict. -Since the `-3` option was used the patch applied cleanly. +في هذه الحالة، بدون الخيار `-3`، كان من الممكن اعتبار التصحيح كتعارض (conflict). +نظراً لاستخدام الخيار `-3`، تم تطبيق التصحيح بشكل نظيف (cleanly). -If you're applying a number of patches from an mbox, you can also run the `am` command in interactive mode, which stops at each patch it finds and asks if you want to apply it: +إذا كنت تطبق عدداً من التصحيحات (patches) من mbox، يمكنك أيضاً تشغيل الأمر `am` في الوضع التفاعلي (interactive mode)، والذي يتوقف عند كل تصحيح يعثر عليه ويسأل عما إذا كنت تريد تطبيقه: [source,console] ---- @@ -177,17 +177,17 @@ See if this helps the gem Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all ---- -This is nice if you have a number of patches saved, because you can view the patch first if you don't remember what it is, or not apply the patch if you've already done so. +هذا أمر رائع إذا كان لديك عدد من التصحيحات المحفوظة، لأنه يمكنك عرض التصحيح (view the patch) أولاً إذا كنت لا تتذكر ماهيته، أو عدم تطبيق التصحيح إذا كنت قد قمت بذلك بالفعل. -When all the patches for your topic are applied and committed into your branch, you can choose whether and how to integrate them into a longer-running branch. +عندما يتم تطبيق (applied) وتأكيد (committed) جميع التصحيحات (patches) الخاصة بموضوعك في فرعك، يمكنك اختيار ما إذا كنت تريد دمجها (integrate them) في فرع طويل الأمد (longer-running branch) وكيفية القيام بذلك. [[_checking_out_remotes]] -==== Checking Out Remote Branches +==== Checking Out Remote Branches (التحقق من الفروع البعيدة) (((branches, remote))) -If your contribution came from a Git user who set up their own repository, pushed a number of changes into it, and then sent you the URL to the repository and the name of the remote branch the changes are in, you can add them as a remote and do merges locally. +إذا جاءت مساهمتك (contribution) من مستخدم Git الذي أعد مستودعه (repository) الخاص، ودفع عدداً من التغييرات (changes) إليه، ثم أرسل لك عنوان URL للمستودع واسم الفرع البعيد (remote branch) الموجودة فيه التغييرات، فيمكنك إضافتها كجهاز تحكم عن بعد (remote) والقيام بعمليات الدمج (merges) محلياً. -For instance, if Jessica sends you an email saying that she has a great new feature in the `ruby-client` branch of her repository, you can test it by adding the remote and checking out that branch locally: +على سبيل المثال، إذا أرسلت لك Jessica بريداً إلكترونياً (email) تخبرك فيه أن لديها ميزة (feature) جديدة رائعة في فرع `ruby-client` من مستودعها، فيمكنك اختبارها عن طريق إضافة جهاز التحكم عن بعد (adding the remote) والتحقق من (checking out) ذلك الفرع محلياً: [source,console] ---- @@ -196,18 +196,18 @@ $ git fetch jessica $ git checkout -b rubyclient jessica/ruby-client ---- -If she emails you again later with another branch containing another great feature, you could directly `fetch` and `checkout` because you already have the remote setup. +إذا أرسلت لك رسالة بريد إلكتروني (emails) مرة أخرى لاحقاً بفرع آخر يحتوي على ميزة أخرى (another feature)، يمكنك `fetch` (الجلب) و `checkout` (التحقق) مباشرة لأن لديك إعداد جهاز التحكم عن بعد (remote setup) بالفعل. -This is most useful if you're working with a person consistently. -If someone only has a single patch to contribute once in a while, then accepting it over email may be less time consuming than requiring everyone to run their own server and having to continually add and remove remotes to get a few patches. -You're also unlikely to want to have hundreds of remotes, each for someone who contributes only a patch or two. -However, scripts and hosted services may make this easier -- it depends largely on how you develop and how your contributors develop. +هذا أكثر فائدة إذا كنت تعمل مع شخص ما باستمرار. +إذا كان لدى شخص ما تصحيح (patch) واحد فقط للمساهمة به بين الحين والآخر، فقد يستغرق قبوله (accepting it) عبر البريد الإلكتروني (email) وقتاً أقل من مطالبة الجميع بتشغيل خادمهم (server) الخاص والاضطرار إلى إضافة الأجهزة البعيدة (remotes) وإزالتها (remove) باستمرار للحصول على بعض التصحيحات. +من غير المحتمل أيضاً أن ترغب في امتلاك مئات من الأجهزة البعيدة، كل منها لشخص يساهم بتصحيح أو اثنين فقط. +ومع ذلك، قد تجعل البرامج النصية (scripts) والخدمات المستضافة (hosted services) هذا الأمر أسهل -- فهذا يعتمد إلى حد كبير على كيفية تطويرك وكيفية تطوير المساهمين (contributors) معك. -The other advantage of this approach is that you get the history of the commits as well. -Although you may have legitimate merge issues, you know where in your history their work is based; a proper three-way merge is the default rather than having to supply a `-3` and hope the patch was generated off a public commit to which you have access. +الميزة الأخرى لهذا النهج (approach) هي أنك تحصل على سجل التأكيدات (history of the commits) أيضاً. +على الرغم من أنه قد يكون لديك مشكلات دمج (merge issues) مشروعة، إلا أنك تعرف أين يستند عملهم (work) في سجلك (history)؛ الدمج الثلاثي (three-way merge) المناسب هو الافتراضي بدلاً من الاضطرار إلى توفير `-3` والأمل في أن التصحيح قد تم إنشاؤه بناءً على تأكيد عام (public commit) يمكنك الوصول إليه. -If you aren't working with a person consistently but still want to pull from them in this way, you can provide the URL of the remote repository to the `git pull` command. -This does a one-time pull and doesn't save the URL as a remote reference: +إذا كنت لا تعمل مع شخص ما باستمرار ولكنك لا تزال تريد السحب منه (pull from) بهذه الطريقة، فيمكنك توفير عنوان URL للمستودع البعيد (remote repository) للأمر `git pull`. +يؤدي هذا إلى إجراء عملية سحب لمرة واحدة (one-time pull) ولا يحفظ عنوان URL كمرجع بعيد (remote reference): [source,console] ---- @@ -218,17 +218,17 @@ Merge made by the 'recursive' strategy. ---- [[_what_is_introduced]] -==== Determining What Is Introduced +==== Determining What Is Introduced (تحديد ما تم إدخاله) (((branches, diffing))) -Now you have a topic branch that contains contributed work. -At this point, you can determine what you'd like to do with it. -This section revisits a couple of commands so you can see how you can use them to review exactly what you'll be introducing if you merge this into your main branch. +الآن لديك فرع موضوع (topic branch) يحتوي على عمل مساهم (contributed work). +في هذه المرحلة، يمكنك تحديد ما ترغب في فعله به. +يعيد هذا القسم زيارة بضعة أوامر (commands) حتى تتمكن من معرفة كيف يمكنك استخدامها لمراجعة ما ستقدمه بالضبط إذا قمت بدمج (merge) هذا في فرعك الرئيسي (main branch). -It's often helpful to get a review of all the commits that are in this branch but that aren't in your `master` branch. -You can exclude commits in the `master` branch by adding the `--not` option before the branch name. -This does the same thing as the `master..contrib` format that we used earlier. -For example, if your contributor sends you two patches and you create a branch called `contrib` and applied those patches there, you can run this: +غالباً ما يكون من المفيد الحصول على مراجعة (review) لجميع عمليات التأكيد (commits) الموجودة في هذا الفرع ولكنها ليست موجودة في فرع `master` الخاص بك. +يمكنك استبعاد (exclude) عمليات التأكيد الموجودة في فرع `master` بإضافة الخيار `--not` قبل اسم الفرع. +يفعل هذا نفس الشيء الذي يفعله تنسيق `master..contrib` الذي استخدمناه سابقاً. +على سبيل المثال، إذا أرسل إليك المساهم (contributor) الخاص بك تصحيحين (two patches) وقمت بإنشاء فرع يسمى `contrib` وطبقت (applied) تلك التصحيحات هناك، فيمكنك تشغيل هذا: [source,console] ---- @@ -246,27 +246,27 @@ Date: Mon Oct 22 19:38:36 2008 -0700 Update gemspec to hopefully work better ---- -To see what changes each commit introduces, remember that you can pass the `-p` option to `git log` and it will append the diff introduced to each commit. +لمعرفة التغييرات (changes) التي تقدمها كل عملية تأكيد، تذكر أنه يمكنك تمرير الخيار `-p` إلى `git log` وسيقوم بإلحاق (append) الاختلاف (diff) المقدم لكل عملية تأكيد. -To see a full diff of what would happen if you were to merge this topic branch with another branch, you may have to use a weird trick to get the correct results. -You may think to run this: +لرؤية فرق كامل (full diff) لما سيحدث إذا قمت بدمج (merge) فرع الموضوع هذا مع فرع آخر، قد تضطر إلى استخدام خدعة غريبة (weird trick) للحصول على النتائج الصحيحة. +قد تفكر في تشغيل هذا: [source,console] ---- $ git diff master ---- -This command gives you a diff, but it may be misleading. -If your `master` branch has moved forward since you created the topic branch from it, then you'll get seemingly strange results. -This happens because Git directly compares the snapshots of the last commit of the topic branch you're on and the snapshot of the last commit on the `master` branch. -For example, if you've added a line in a file on the `master` branch, a direct comparison of the snapshots will look like the topic branch is going to remove that line. +يمنحك هذا الأمر (command) فرقاً (diff)، ولكنه قد يكون مضللاً (misleading). +إذا تقدم فرع `master` الخاص بك (moved forward) منذ أن أنشأت فرع الموضوع (topic branch) منه، فستحصل على نتائج غريبة على ما يبدو. +يحدث هذا لأن Git يقارن بشكل مباشر (directly compares) اللقطات (snapshots) الخاصة بآخر تأكيد لفرع الموضوع الذي أنت عليه ولقطة آخر تأكيد على فرع `master`. +على سبيل المثال، إذا أضفت سطراً (line) في ملف (file) على فرع `master`، فإن المقارنة المباشرة للقطات ستبدو وكأن فرع الموضوع سيقوم بإزالة ذلك السطر. -If `master` is a direct ancestor of your topic branch, this isn't a problem; but if the two histories have diverged, the diff will look like you're adding all the new stuff in your topic branch and removing everything unique to the `master` branch. +إذا كان `master` هو سلف مباشر (direct ancestor) لفرع الموضوع الخاص بك، فهذه ليست مشكلة؛ ولكن إذا تباعد السجلان (two histories have diverged)، فسيبدو الفرق (diff) وكأنك تضيف جميع الأشياء الجديدة (new stuff) في فرع الموضوع وتزيل كل شيء فريد (unique) لفرع `master`. -What you really want to see are the changes added to the topic branch -- the work you'll introduce if you merge this branch with `master`. -You do that by having Git compare the last commit on your topic branch with the first common ancestor it has with the `master` branch. +ما تريد رؤيته حقاً هو التغييرات (changes) المضافة إلى فرع الموضوع -- العمل (work) الذي ستقدمه إذا قمت بدمج هذا الفرع مع `master`. +يمكنك القيام بذلك عن طريق جعل Git يقارن آخر تأكيد (last commit) على فرع الموضوع الخاص بك مع أول سلف مشترك (first common ancestor) يمتلكه مع فرع `master`. -Technically, you can do that by explicitly figuring out the common ancestor and then running your diff on it: +من الناحية الفنية، يمكنك القيام بذلك عن طريق معرفة السلف المشترك (common ancestor) بشكل صريح (explicitly) ثم تشغيل فرقك (diff) عليه: [source,console] ---- @@ -275,116 +275,116 @@ $ git merge-base contrib master $ git diff 36c7db ---- -or, more concisely: +أو بشكل أكثر إيجازاً: [source,console] ---- $ git diff $(git merge-base contrib master) ---- -However, neither of those is particularly convenient, so Git provides another shorthand for doing the same thing: the triple-dot syntax. -In the context of the `git diff` command, you can put three periods after another branch to do a `diff` between the last commit of the branch you're on and its common ancestor with another branch: +ومع ذلك، لا يعتبر أي منهما مناسباً (convenient) بشكل خاص، لذلك يوفر Git اختصاراً (shorthand) آخر للقيام بنفس الشيء: بناء جملة النقاط الثلاث (triple-dot syntax). +في سياق الأمر `git diff`، يمكنك وضع ثلاث نقاط بعد فرع آخر لإجراء `diff` بين آخر تأكيد للفرع الذي أنت عليه وسلفه المشترك مع فرع آخر: [source,console] ---- $ git diff master...contrib ---- -This command shows you only the work your current topic branch has introduced since its common ancestor with `master`. -That is a very useful syntax to remember. +يُظهر لك هذا الأمر (command) فقط العمل (work) الذي قدمه فرع الموضوع الحالي (current topic branch) منذ سلفه المشترك (common ancestor) مع `master`. +تعتبر هذه الصياغة مفيدة جداً لتتذكرها. -==== Integrating Contributed Work +==== Integrating Contributed Work (دمج العمل المساهم) (((integrating work))) -When all the work in your topic branch is ready to be integrated into a more mainline branch, the question is how to do it. -Furthermore, what overall workflow do you want to use to maintain your project? -You have a number of choices, so we'll cover a few of them. +عندما يكون كل العمل (work) في فرع الموضوع (topic branch) الخاص بك جاهزاً للدمج (integrated) في فرع خط رئيسي (mainline branch) أكثر، يكون السؤال هو كيفية القيام بذلك. +علاوة على ذلك، ما هو سير العمل الإجمالي (overall workflow) الذي تريد استخدامه للحفاظ على (maintain) مشروعك؟ +لديك عدد من الخيارات، لذلك سنغطي بعضاً منها. -===== Merging Workflows +===== Merging Workflows (مهام سير عمل الدمج) (((workflows, merging))) -One basic workflow is to simply merge all that work directly into your `master` branch. -In this scenario, you have a `master` branch that contains basically stable code. -When you have work in a topic branch that you think you've completed, or work that someone else has contributed and you've verified, you merge it into your master branch, delete that just-merged topic branch, and repeat. +أحد مهام سير العمل (workflow) الأساسية هو ببساطة دمج (merge) كل ذلك العمل (work) مباشرة (directly) في فرع `master` الخاص بك. +في هذا السيناريو، لديك فرع `master` يحتوي بشكل أساسي على كود مستقر (stable code). +عندما يكون لديك عمل في فرع موضوع تعتقد أنك أكملته (completed)، أو عمل ساهم به شخص آخر وقمت بالتحقق منه (verified)، تقوم بدمجه (merge it) في فرع `master` الخاص بك، وحذف فرع الموضوع الذي تم دمجه للتو (just-merged topic branch)، والتكرار. -For instance, if we have a repository with work in two branches named `ruby_client` and `php_client` that looks like <>, and we merge `ruby_client` followed by `php_client`, your history will end up looking like <>. +على سبيل المثال، إذا كان لدينا مستودع (repository) به عمل في فرعين يُسَمَّيان `ruby_client` و `php_client` ويبدو مثل <>، وقمنا بدمج (merge) `ruby_client` متبوعاً بـ `php_client`، فسيبدو السجل (history) الخاص بك مثل <>. [[merwf_a]] -.History with several topic branches +.History with several topic branches (السجل مع عدة فروع مواضيع) image::images/merging-workflows-1.png[History with several topic branches] [[merwf_b]] -.After a topic branch merge +.After a topic branch merge (بعد دمج فرع موضوع) image::images/merging-workflows-2.png[After a topic branch merge] -That is probably the simplest workflow, but it can possibly be problematic if you're dealing with larger or more stable projects where you want to be really careful about what you introduce. +ربما يكون هذا هو أبسط سير عمل (workflow)، ولكنه قد يكون مشكلة (problematic) إذا كنت تتعامل مع مشاريع أكبر أو أكثر استقراراً حيث تريد أن تكون حذراً (careful) حقاً بشأن ما تقدمه. -If you have a more important project, you might want to use a two-phase merge cycle. -In this scenario, you have two long-running branches, `master` and `develop`, in which you determine that `master` is updated only when a very stable release is cut and all new code is integrated into the `develop` branch. -You regularly push both of these branches to the public repository. -Each time you have a new topic branch to merge in (<>), you merge it into `develop` (<>); then, when you tag a release, you fast-forward `master` to wherever the now-stable `develop` branch is (<>). +إذا كان لديك مشروع أكثر أهمية، فقد ترغب في استخدام دورة دمج من مرحلتين (two-phase merge cycle). +في هذا السيناريو، لديك فرعان طويلا الأمد (long-running branches)، `master` و `develop`، حيث تحدد أن `master` يتم تحديثه (updated) فقط عندما يتم قطع إصدار (release is cut) مستقر جداً ويتم دمج (integrated) جميع الأكواد الجديدة (new code) في فرع `develop`. +تقوم بانتظام بدفع (push) كلا الفرعين (branches) إلى المستودع العام (public repository). +في كل مرة يكون لديك فرع موضوع جديد لدمجه (<>)، تقوم بدمجه (merge it) في `develop` (<>)؛ ثم، عندما تضع علامة (tag) على إصدار (release)، تقوم بتقديم سريع (fast-forward) لـ `master` إلى حيثما كان فرع `develop` المستقر الآن (<>). [[merwf_c]] -.Before a topic branch merge +.Before a topic branch merge (قبل دمج فرع موضوع) image::images/merging-workflows-3.png[Before a topic branch merge] [[merwf_d]] -.After a topic branch merge +.After a topic branch merge (بعد دمج فرع موضوع) image::images/merging-workflows-4.png[After a topic branch merge] [[merwf_e]] -.After a project release +.After a project release (بعد إصدار المشروع) image::images/merging-workflows-5.png[After a project release] -This way, when people clone your project's repository, they can either check out `master` to build the latest stable version and keep up to date on that easily, or they can check out `develop`, which is the more cutting-edge content. -You can also extend this concept by having an `integrate` branch where all the work is merged together. -Then, when the codebase on that branch is stable and passes tests, you merge it into a `develop` branch; and when that has proven itself stable for a while, you fast-forward your `master` branch. +بهذه الطريقة، عندما يقوم الأشخاص باستنساخ (clone) مستودع مشروعك، يمكنهم إما التحقق (check out) من `master` لبناء أحدث إصدار مستقر (latest stable version) والبقاء على اطلاع (keep up to date) عليه بسهولة، أو يمكنهم التحقق من `develop`، وهو المحتوى (content) الأكثر حداثة (cutting-edge). +يمكنك أيضاً توسيع (extend) هذا المفهوم من خلال امتلاك فرع `integrate` (تكامل) حيث يتم دمج كل العمل معاً (merged together). +ثم، عندما تكون قاعدة التعليمات البرمجية (codebase) في ذلك الفرع مستقرة (stable) وتجتاز الاختبارات (passes tests)، تقوم بدمجها في فرع `develop`؛ وعندما يثبت (proven) استقراره لفترة من الوقت، تقوم بتقديم سريع (fast-forward) لفرع `master` الخاص بك. -===== Large-Merging Workflows +===== Large-Merging Workflows (مهام سير عمل الدمج الكبيرة) (((workflows, "merging (large)"))) -The Git project has four long-running branches: `master`, `next`, and `seen` (formerly 'pu' -- proposed updates) for new work, and `maint` for maintenance backports. -When new work is introduced by contributors, it's collected into topic branches in the maintainer's repository in a manner similar to what we've described (see <>). -At this point, the topics are evaluated to determine whether they're safe and ready for consumption or whether they need more work. -If they're safe, they're merged into `next`, and that branch is pushed up so everyone can try the topics integrated together. +يحتوي مشروع Git على أربعة فروع (branches) طويلة الأمد: `master` و `next` و `seen` (كان يسمى سابقاً 'pu' -- التحديثات المقترحة (proposed updates)) للعمل الجديد، و `maint` لعمليات الصيانة (maintenance backports). +عندما يتم تقديم عمل جديد (new work) من قبل المساهمين (contributors)، يتم جمعه في فروع المواضيع (topic branches) في مستودع المشرف (maintainer's repository) بطريقة مشابهة لما وصفناه (انظر <>). +في هذه المرحلة، يتم تقييم (evaluated) المواضيع لتحديد ما إذا كانت آمنة (safe) وجاهزة للاستهلاك (ready for consumption) أو ما إذا كانت بحاجة إلى مزيد من العمل (more work). +إذا كانت آمنة، يتم دمجها في `next`، ويتم دفع (pushed up) ذلك الفرع حتى يتمكن الجميع من تجربة (try) المواضيع مدمجة معاً. [[merwf_f]] -.Managing a complex series of parallel contributed topic branches +.Managing a complex series of parallel contributed topic branches (إدارة سلسلة معقدة من فروع المواضيع المساهمة المتوازية) image::images/large-merges-1.png[Managing a complex series of parallel contributed topic branches] -If the topics still need work, they're merged into `seen` instead. -When it's determined that they're totally stable, the topics are re-merged into `master`. -The `next` and `seen` branches are then rebuilt from the `master`. -This means `master` almost always moves forward, `next` is rebased occasionally, and `seen` is rebased even more often: +إذا كانت المواضيع (topics) لا تزال بحاجة إلى عمل (need work)، فيتم دمجها (merged) في `seen` بدلاً من ذلك. +عندما يتقرر أنها مستقرة (stable) تماماً، يُعاد دمج (re-merged) المواضيع في `master`. +ثم تتم إعادة بناء (rebuilt) الفروع `next` و `seen` من `master`. +هذا يعني أن `master` يتحرك للأمام (moves forward) دائماً تقريباً، وتتم إعادة بناء (rebased) `next` من حين لآخر، وتتم إعادة بناء `seen` في كثير من الأحيان (more often): -.Merging contributed topic branches into long-term integration branches +.Merging contributed topic branches into long-term integration branches (دمج فروع المواضيع المساهمة في فروع التكامل طويلة الأجل) image::images/large-merges-2.png[Merging contributed topic branches into long-term integration branches] -When a topic branch has finally been merged into `master`, it's removed from the repository. -The Git project also has a `maint` branch that is forked off from the last release to provide backported patches in case a maintenance release is required. -Thus, when you clone the Git repository, you have four branches that you can check out to evaluate the project in different stages of development, depending on how cutting edge you want to be or how you want to contribute; and the maintainer has a structured workflow to help them vet new contributions. -The Git project's workflow is specialized. -To clearly understand this you could check out the https://github.com/git/git/blob/master/Documentation/howto/maintain-git.txt[Git Maintainer's guide^]. +عندما يتم دمج (merged) فرع موضوع (topic branch) أخيراً في `master`، تتم إزالته من المستودع. +يحتوي مشروع Git أيضاً على فرع `maint` المنسوخ (forked off) من الإصدار (release) الأخير لتوفير تصحيحات منقولة (backported patches) في حالة طلب إصدار صيانة (maintenance release). +وبالتالي، عند استنساخ (clone) مستودع Git، يكون لديك أربعة فروع (branches) يمكنك التحقق منها (check out) لتقييم (evaluate) المشروع في مراحل مختلفة من التطوير (different stages of development)، اعتماداً على مدى حداثتك أو كيفية رغبتك في المساهمة (contribute)؛ ولدى المشرف (maintainer) سير عمل (workflow) منظم لمساعدته في فحص (vet) المساهمات الجديدة (new contributions). +سير عمل مشروع Git متخصص (specialized). +لفهم ذلك بوضوح، يمكنك التحقق من https://github.com/git/git/blob/master/Documentation/howto/maintain-git.txt[دليل مشرف Git (Git Maintainer's guide)^]. [[_rebase_cherry_pick]] -===== Rebasing and Cherry-Picking Workflows +===== Rebasing and Cherry-Picking Workflows (مهام سير عمل إعادة البناء والانتقاء) (((workflows, rebasing and cherry-picking))) -Other maintainers prefer to rebase or cherry-pick contributed work on top of their `master` branch, rather than merging it in, to keep a mostly linear history. -When you have work in a topic branch and have determined that you want to integrate it, you move to that branch and run the rebase command to rebuild the changes on top of your current `master` (or `develop`, and so on) branch. -If that works well, you can fast-forward your `master` branch, and you'll end up with a linear project history. +يفضل المشرفون (maintainers) الآخرون إعادة بناء (rebase) أو انتقاء (cherry-pick) العمل المساهم (contributed work) أعلى (on top of) فرع `master` الخاص بهم، بدلاً من دمجه (merging it in)، للحفاظ على سجل خطي (linear history) في الغالب. +عندما يكون لديك عمل (work) في فرع موضوع (topic branch) وحددت أنك تريد دمجه (integrate it)، فإنك تنتقل إلى ذلك الفرع وتقوم بتشغيل أمر rebase لإعادة بناء (rebuild) التغييرات أعلى فرع `master` (أو `develop`، وما إلى ذلك) الحالي. +إذا نجح ذلك جيداً، يمكنك التقديم السريع (fast-forward) لفرع `master` الخاص بك، وسينتهي بك الأمر بسجل مشروع خطي (linear project history). (((git commands, cherry-pick))) -The other way to move introduced work from one branch to another is to cherry-pick it. -A cherry-pick in Git is like a rebase for a single commit. -It takes the patch that was introduced in a commit and tries to reapply it on the branch you're currently on. -This is useful if you have a number of commits on a topic branch and you want to integrate only one of them, or if you only have one commit on a topic branch and you'd prefer to cherry-pick it rather than run rebase. -For example, suppose you have a project that looks like this: +الطريقة الأخرى لنقل العمل المُدخل (introduced work) من فرع (branch) إلى آخر هي انتقائه (cherry-pick it). +يشبه الانتقاء (cherry-pick) في Git إعادة البناء (rebase) لعملية تأكيد (commit) واحدة. +يأخذ التصحيح (patch) الذي تم إدخاله في عملية تأكيد ويحاول إعادة تطبيقه (reapply it) على الفرع الذي تتواجد عليه حالياً. +هذا مفيد إذا كان لديك عدد من عمليات التأكيد (commits) على فرع موضوع وتريد دمج (integrate) واحد منها فقط، أو إذا كان لديك تأكيد واحد فقط على فرع موضوع وتفضل انتقاءه (cherry-pick it) بدلاً من تشغيل إعادة البناء (rebase). +على سبيل المثال، لنفترض أن لديك مشروعاً يبدو هكذا: -.Example history before a cherry-pick +.Example history before a cherry-pick (مثال على السجل قبل الانتقاء) image::images/rebasing-1.png[Example history before a cherry-pick] -If you want to pull commit `e43a6` into your `master` branch, you can run: +إذا كنت تريد سحب (pull) التأكيد `e43a6` في فرع `master` الخاص بك، يمكنك تشغيل: [source,console] ---- @@ -394,44 +394,44 @@ Finished one cherry-pick. 3 files changed, 17 insertions(+), 3 deletions(-) ---- -This pulls the same change introduced in `e43a6`, but you get a new commit SHA-1 value, because the date applied is different. -Now your history looks like this: +يسحب (pulls) هذا نفس التغيير (change) الذي تم إدخاله في `e43a6`، ولكنك تحصل على قيمة SHA-1 جديدة لعملية التأكيد (commit)، لأن تاريخ التطبيق (date applied) مختلف. +الآن يبدو سجلك هكذا: -.History after cherry-picking a commit on a topic branch +.History after cherry-picking a commit on a topic branch (السجل بعد انتقاء عملية تأكيد على فرع موضوع) image::images/rebasing-2.png[History after cherry-picking a commit on a topic branch] -Now you can remove your topic branch and drop the commits you didn't want to pull in. +الآن يمكنك إزالة (remove) فرع الموضوع (topic branch) وإسقاط (drop) التأكيدات (commits) التي لم تكن ترغب في سحبها. -===== Rerere +===== Rerere (إعادة استخدام الحل المسجل) (((git commands, rerere)))(((rerere))) -If you're doing lots of merging and rebasing, or you're maintaining a long-lived topic branch, Git has a feature called "`rerere`" that can help. +إذا كنت تقوم بالكثير من عمليات الدمج وإعادة البناء (merging and rebasing)، أو كنت تحتفظ (maintaining) بفرع موضوع (topic branch) طويل العمر، فإن لدى Git ميزة تسمى "`rerere`" يمكن أن تساعد. -Rerere stands for "`reuse recorded resolution`" -- it's a way of shortcutting manual conflict resolution. -When rerere is enabled, Git will keep a set of pre- and post-images from successful merges, and if it notices that there's a conflict that looks exactly like one you've already fixed, it'll just use the fix from last time, without bothering you with it. +Rerere تعني "`reuse recorded resolution`" ("`إعادة استخدام الدقة المسجلة`") -- إنها طريقة لاختصار الحل اليدوي للتعارضات (manual conflict resolution). +عند تمكين rerere، سيحتفظ Git بمجموعة من الصور السابقة واللاحقة (pre- and post-images) من عمليات الدمج (merges) الناجحة، وإذا لاحظ وجود تعارض (conflict) يبدو تماماً مثل الذي قمت بإصلاحه بالفعل، فسيستخدم الإصلاح من المرة الأخيرة، دون إزعاجك به. -This feature comes in two parts: a configuration setting and a command. -The configuration setting is `rerere.enabled`, and it's handy enough to put in your global config: +تأتي هذه الميزة في جزأين: إعداد تكوين (configuration setting) وأمر (command). +إعداد التكوين هو `rerere.enabled`، وهو مفيد بما يكفي لوضعه في تكوينك العام (global config): [source,console] ---- $ git config --global rerere.enabled true ---- -Now, whenever you do a merge that resolves conflicts, the resolution will be recorded in the cache in case you need it in the future. +الآن، كلما قمت بدمج (merge) يحل التعارضات (resolves conflicts)، سيتم تسجيل الحل (resolution) في ذاكرة التخزين المؤقت (cache) في حالة احتياجك إليه في المستقبل. -If you need to, you can interact with the rerere cache using the `git rerere` command. -When it's invoked alone, Git checks its database of resolutions and tries to find a match with any current merge conflicts and resolve them (although this is done automatically if `rerere.enabled` is set to `true`). -There are also subcommands to see what will be recorded, to erase specific resolution from the cache, and to clear the entire cache. -We will cover rerere in more detail in <>. +إذا كنت بحاجة إلى ذلك، يمكنك التفاعل مع ذاكرة التخزين المؤقت (cache) لـ rerere باستخدام الأمر `git rerere`. +عندما يتم استدعاؤه وحده (invoked alone)، يتحقق Git من قاعدة بيانات الحلول (resolutions) الخاصة به ويحاول العثور على تطابق (match) مع أي تعارضات دمج حالية (current merge conflicts) ويحلها (resolves them) (على الرغم من أن هذا يتم تلقائياً إذا تم تعيين `rerere.enabled` إلى `true`). +هناك أيضاً أوامر فرعية (subcommands) لمعرفة ما سيتم تسجيله، ولمسح حل معين (erase specific resolution) من ذاكرة التخزين المؤقت، ولمسح ذاكرة التخزين المؤقت بأكملها (clear the entire cache). +سنغطي rerere بمزيد من التفصيل في <>. [[_tagging_releases]] -==== Tagging Your Releases +==== Tagging Your Releases (وضع علامات على إصداراتك) (((tags)))(((tags, signing))) -When you've decided to cut a release, you'll probably want to assign a tag so you can re-create that release at any point going forward. -You can create a new tag as discussed in <>. -If you decide to sign the tag as the maintainer, the tagging may look something like this: +عندما تقرر قطع إصدار (cut a release)، فمن المحتمل أن ترغب في تعيين علامة (assign a tag) بحيث يمكنك إعادة إنشاء (re-create) ذلك الإصدار في أي نقطة للمضي قدماً. +يمكنك إنشاء علامة جديدة (new tag) كما تمت مناقشته في <>. +إذا قررت توقيع العلامة (sign the tag) كمشرف (maintainer)، فقد يبدو وضع العلامات شيئاً من هذا القبيل: [source,console] ---- @@ -441,9 +441,9 @@ user: "Scott Chacon " 1024-bit DSA key, ID F721C45A, created 2009-02-09 ---- -If you do sign your tags, you may have the problem of distributing the public PGP key used to sign your tags. -The maintainer of the Git project has solved this issue by including their public key as a blob in the repository and then adding a tag that points directly to that content. -To do this, you can figure out which key you want by running `gpg --list-keys`: +إذا قمت بتوقيع علاماتك (sign your tags)، فقد تواجه مشكلة في توزيع مفتاح PGP العام (public PGP key) المستخدم لتوقيع علاماتك. +لقد حل مشرف مشروع Git هذه المشكلة من خلال تضمين مفتاحه العام ككائن نقطي (blob) في المستودع ثم إضافة علامة (tag) تشير مباشرة إلى ذلك المحتوى. +للقيام بذلك، يمكنك معرفة المفتاح الذي تريده عن طريق تشغيل `gpg --list-keys`: [source,console] ---- @@ -455,7 +455,7 @@ uid Scott Chacon sub 2048g/45D02282 2009-02-09 [expires: 2010-02-09] ---- -Then, you can directly import the key into the Git database by exporting it and piping that through `git hash-object`, which writes a new blob with those contents into Git and gives you back the SHA-1 of the blob: +بعد ذلك، يمكنك استيراد (import) المفتاح مباشرةً إلى قاعدة بيانات (database) Git بتصديره (exporting it) وتمريره (piping that) عبر `git hash-object`، والذي يكتب كائناً نقطياً جديداً (new blob) بتلك المحتويات في Git ويمنحك قيمة SHA-1 للكائن النقطي: [source,console] ---- @@ -463,30 +463,30 @@ $ gpg -a --export F721C45A | git hash-object -w --stdin 659ef797d181633c87ec71ac3f9ba29fe5775b92 ---- -Now that you have the contents of your key in Git, you can create a tag that points directly to it by specifying the new SHA-1 value that the `hash-object` command gave you: +الآن بعد أن أصبح لديك محتويات مفتاحك في Git، يمكنك إنشاء علامة (tag) تشير إليه مباشرةً بتحديد قيمة SHA-1 الجديدة التي منحك إياها الأمر `hash-object`: [source,console] ---- $ git tag -a maintainer-pgp-pub 659ef797d181633c87ec71ac3f9ba29fe5775b92 ---- -If you run `git push --tags`, the `maintainer-pgp-pub` tag will be shared with everyone. -If anyone wants to verify a tag, they can directly import your PGP key by pulling the blob directly out of the database and importing it into GPG: +إذا قمت بتشغيل `git push --tags`، فسيتم مشاركة علامة `maintainer-pgp-pub` مع الجميع. +إذا أراد أي شخص التحقق من علامة (verify a tag)، فيمكنه استيراد مفتاح PGP (PGP key) الخاص بك مباشرةً عن طريق سحب (pulling) الكائن النقطي (blob) مباشرةً من قاعدة البيانات واستيراده إلى GPG: [source,console] ---- $ git show maintainer-pgp-pub | gpg --import ---- -They can use that key to verify all your signed tags. -Also, if you include instructions in the tag message, running `git show ` will let you give the end user more specific instructions about tag verification. +يمكنهم استخدام ذلك المفتاح للتحقق من جميع علاماتك الموقعة (signed tags). +أيضاً، إذا قمت بتضمين الإرشادات في رسالة العلامة (tag message)، فإن تشغيل `git show ` سيتيح لك إعطاء المستخدم النهائي (end user) إرشادات أكثر تحديداً (more specific instructions) حول التحقق من العلامة. [[_build_number]] -==== Generating a Build Number +==== Generating a Build Number (توليد رقم بناء) (((build numbers)))(((git commands, describe))) -Because Git doesn't have monotonically increasing numbers like 'v123' or the equivalent to go with each commit, if you want to have a human-readable name to go with a commit, you can run `git describe` on that commit. -In response, Git generates a string consisting of the name of the most recent tag earlier than that commit, followed by the number of commits since that tag, followed finally by a partial SHA-1 value of the commit being described (prefixed with the letter "g" meaning Git): +نظراً لأن Git لا يحتوي على أرقام متزايدة بشكل رتيب (monotonically increasing numbers) مثل 'v123' أو ما يعادلها لتترافق مع كل تأكيد (commit)، إذا كنت ترغب في الحصول على اسم يمكن قراءته بواسطة الإنسان (human-readable name) ليترافق مع تأكيد، فيمكنك تشغيل `git describe` على ذلك التأكيد. +استجابة لذلك، يقوم Git بإنشاء سلسلة (string) تتكون من اسم أحدث علامة (tag) تسبق التأكيد، متبوعاً بعدد التأكيدات منذ تلك العلامة، متبوعاً أخيراً بقيمة SHA-1 جزئية للتأكيد الذي يتم وصفه (مسبوقة بالحرف "g" الذي يعني Git): [source,console] ---- @@ -494,21 +494,21 @@ $ git describe master v1.6.2-rc1-20-g8c5b85c ---- -This way, you can export a snapshot or build and name it something understandable to people. -In fact, if you build Git from source code cloned from the Git repository, `git --version` gives you something that looks like this. -If you're describing a commit that you have directly tagged, it gives you simply the tag name. +بهذه الطريقة، يمكنك تصدير (export) لقطة (snapshot) أو إصدار (build) وتسميته بشيء مفهوم للناس. +في الواقع، إذا قمت ببناء (build) Git من الكود المصدري (source code) المستنسخ من مستودع Git، يمنحك `git --version` شيئاً يشبه هذا. +إذا كنت تصف عملية تأكيد (commit) قمت بوضع علامة (tagged) عليها مباشرةً، فسيمنحك ببساطة اسم العلامة. -By default, the `git describe` command requires annotated tags (tags created with the `-a` or `-s` flag); if you want to take advantage of lightweight (non-annotated) tags as well, add the `--tags` option to the command. -You can also use this string as the target of a `git checkout` or `git show` command, although it relies on the abbreviated SHA-1 value at the end, so it may not be valid forever. -For instance, the Linux kernel recently jumped from 8 to 10 characters to ensure SHA-1 object uniqueness, so older `git describe` output names were invalidated. +بشكل افتراضي، يتطلب الأمر `git describe` علامات توضيحية (annotated tags) (العلامات التي تم إنشاؤها بالعلامة `-a` أو `-s`)؛ إذا كنت ترغب في الاستفادة من العلامات خفيفة الوزن (lightweight tags) (غير التوضيحية - non-annotated) أيضاً، فأضف الخيار `--tags` إلى الأمر. +يمكنك أيضاً استخدام هذه السلسلة كهدف (target) لأمر `git checkout` أو `git show`، على الرغم من أنها تعتمد على قيمة SHA-1 المختصرة في النهاية، لذا قد لا تكون صالحة (valid) إلى الأبد. +على سبيل المثال، قفزت نواة Linux مؤخراً من 8 إلى 10 أحرف لضمان تفرد (uniqueness) كائن SHA-1، لذلك تم إبطال (invalidated) أسماء مخرجات (output names) `git describe` الأقدم. [[_preparing_release]] -==== Preparing a Release +==== Preparing a Release (تجهيز إصدار) (((releasing)))(((git commands, archive))) -Now you want to release a build. -One of the things you'll want to do is create an archive of the latest snapshot of your code for those poor souls who don't use Git. -The command to do this is `git archive`: +أنت الآن تريد إطلاق (release) بنية (build). +من بين الأشياء التي سترغب في القيام بها إنشاء أرشيف (archive) لأحدث لقطة (latest snapshot) من الكود (code) الخاص بك لأولئك الذين لا يستخدمون Git. +الأمر الذي يجب القيام به هو `git archive`: [source,console] ---- @@ -517,23 +517,23 @@ $ ls *.tar.gz v1.6.2-rc1-20-g8c5b85c.tar.gz ---- -If someone opens that tarball, they get the latest snapshot of your project under a `project` directory. -You can also create a zip archive in much the same way, but by passing the `--format=zip` option to `git archive`: +إذا فتح شخص ما ملف الأرشيف (tarball) هذا، فسيحصل على أحدث لقطة (latest snapshot) لمشروعك ضمن دليل (directory) `project`. +يمكنك أيضاً إنشاء أرشيف مضغوط (zip archive) بنفس الطريقة تقريباً، ولكن عن طريق تمرير الخيار `--format=zip` إلى `git archive`: [source,console] ---- $ git archive master --prefix='project/' --format=zip > `git describe master`.zip ---- -You now have a nice tarball and a zip archive of your project release that you can upload to your website or email to people. +لديك الآن أرشيف (tarball) لطيف وأرشيف مضغوط (zip archive) لإصدار (release) مشروعك والذي يمكنك تحميله على موقع الويب الخاص بك أو إرساله بالبريد الإلكتروني إلى الأشخاص. [[_the_shortlog]] -==== The Shortlog +==== The Shortlog (السجل القصير) (((git commands, shortlog))) -It's time to email your mailing list of people who want to know what's happening in your project. -A nice way of quickly getting a sort of changelog of what has been added to your project since your last release or email is to use the `git shortlog` command. -It summarizes all the commits in the range you give it; for example, the following gives you a summary of all the commits since your last release, if your last release was named `v1.0.1`: +حان الوقت لإرسال بريد إلكتروني (email) إلى قائمتك البريدية (mailing list) للأشخاص الذين يريدون معرفة ما يحدث في مشروعك. +من الطرق الرائعة للحصول بسرعة على نوع من سجل التغييرات (changelog) لما تمت إضافته إلى مشروعك منذ آخر إصدار (release) أو بريد إلكتروني هو استخدام الأمر `git shortlog`. +يلخص جميع عمليات التأكيد (commits) في النطاق الذي تعطيه إياه؛ على سبيل المثال، يمنحك ما يلي ملخصاً لجميع عمليات التأكيد منذ إصدارك الأخير، إذا كان اسم إصدارك الأخير هو `v1.0.1`: [source,console] ---- @@ -553,4 +553,4 @@ Tom Preston-Werner (4): Regenerated gemspec for version 1.0.2 ---- -You get a clean summary of all the commits since `v1.0.1`, grouped by author, that you can email to your list. +تحصل على ملخص نظيف (clean summary) لجميع عمليات التأكيد (commits) منذ `v1.0.1`، مجمعة حسب المؤلف، والتي يمكنك إرسالها بالبريد الإلكتروني إلى قائمتك (list). diff --git a/book/06-github/sections/1-setting-up-account.asc b/book/06-github/sections/1-setting-up-account.asc index 2ab023ec0..855e9ef50 100644 --- a/book/06-github/sections/1-setting-up-account.asc +++ b/book/06-github/sections/1-setting-up-account.asc @@ -1,97 +1,97 @@ -=== Account Setup and Configuration +=== Account Setup and Configuration (إعداد الحساب والتكوين) (((GitHub, user accounts))) -The first thing you need to do is set up a free user account. -Simply visit https://github.com[^], choose a user name that isn't already taken, provide an email address and a password, and click the big green "`Sign up for GitHub`" button. +أول شيء عليك القيام به هو إعداد حساب مستخدم مجاني (free user account). +ما عليك سوى زيارة https://github.com[^]، واختيار اسم مستخدم (user name) غير مستخدم بالفعل، وتوفير عنوان بريد إلكتروني (email address) وكلمة مرور (password)، والنقر على الزر الأخضر الكبير "`Sign up for GitHub`" (التسجيل في GitHub). -.The GitHub sign-up form +.The GitHub sign-up form (نموذج التسجيل في GitHub) image::images/signup.png[The GitHub sign-up form] -The next thing you'll see is the pricing page for upgraded plans, but it's safe to ignore this for now. -GitHub will send you an email to verify the address you provided. -Go ahead and do this; it's pretty important (as we'll see later). +الشيء التالي الذي ستراه هو صفحة التسعير (pricing page) للخطط التي تمت ترقيتها (upgraded plans)، ولكن من الآمن تجاهل هذا في الوقت الحالي. +سيرسل لك GitHub بريداً إلكترونياً للتحقق من (verify) العنوان الذي قدمته. +امض قدماً وافعل ذلك؛ إنه أمر مهم جداً (كما سنرى لاحقاً). [NOTE] ==== -GitHub provides almost all of its functionality with free accounts, except some advanced features. +يوفر GitHub تقريباً جميع وظائفه (functionality) من خلال الحسابات المجانية (free accounts)، باستثناء بعض الميزات المتقدمة (advanced features). -GitHub's paid plans include advanced tools and features as well as increased limits for free services, but we won't be covering those in this book. -To get more information about available plans and their comparison, visit https://github.com/pricing[^]. +تتضمن خطط GitHub المدفوعة (paid plans) أدوات (tools) وميزات (features) متقدمة بالإضافة إلى زيادة الحدود (increased limits) للخدمات المجانية، ولكننا لن نغطيها في هذا الكتاب. +للحصول على مزيد من المعلومات حول الخطط المتاحة ومقارنتها، قم بزيارة https://github.com/pricing[^]. ==== -Clicking the Octocat logo at the top-left of the screen will take you to your dashboard page. -You're now ready to use GitHub. +سيأخذك النقر على شعار Octocat (Octocat logo) في أعلى يسار الشاشة إلى صفحة لوحة التحكم (dashboard page) الخاصة بك. +أنت الآن جاهز لاستخدام GitHub. -==== SSH Access +==== SSH Access (وصول SSH) (((SSH keys, with GitHub))) -As of right now, you're fully able to connect with Git repositories using the `https://` protocol, authenticating with the username and password you just set up. -However, to simply clone public projects, you don't even need to sign up - the account we just created comes into play when we fork projects and push to our forks a bit later. +اعتباراً من الآن، أنت قادر تماماً على الاتصال (connect) بمستودعات Git (Git repositories) باستخدام بروتوكول `https://`، والمصادقة (authenticating) باستخدام اسم المستخدم وكلمة المرور (username and password) اللذين قمت بإعدادهما للتو. +ومع ذلك، لنسخ (clone) المشاريع العامة (public projects) ببساطة، لا تحتاج حتى إلى التسجيل (sign up) - فالحساب الذي أنشأناه للتو يلعب دوراً عندما ننسخ (fork) المشاريع وندفع (push) إلى نسخنا (forks) لاحقاً بقليل. -If you'd like to use SSH remotes, you'll need to configure a public key. -If you don't already have one, see <>. -Open up your account settings using the link at the top-right of the window: +إذا كنت ترغب في استخدام أجهزة التحكم عن بعد لـ SSH (SSH remotes)، فستحتاج إلى تكوين مفتاح عام (configure a public key). +إذا لم يكن لديك واحد بالفعل، راجع <>. +افتح إعدادات حسابك (account settings) باستخدام الرابط الموجود في أعلى يمين النافذة: -.The "`Account settings`" link +.The "`Account settings`" link (رابط "`إعدادات الحساب`") image::images/account-settings.png[The “Account settings” link] -Then select the "`SSH keys`" section along the left-hand side. +ثم حدد قسم "`SSH keys`" (مفاتيح SSH) على طول الجانب الأيسر. -.The "`SSH keys`" link +.The "`SSH keys`" link (رابط "`مفاتيح SSH`") image::images/ssh-keys.png[The “SSH keys” link] -From there, click the "`Add an SSH key`" button, give your key a name, paste the contents of your `~/.ssh/id_rsa.pub` (or whatever you named it) public-key file into the text area, and click "`Add key`". +من هناك، انقر على زر "`Add an SSH key`" (إضافة مفتاح SSH)، وامنح مفتاحك اسماً، والصق محتويات ملف مفتاحك العام (public-key file) `~/.ssh/id_rsa.pub` (أو أياً كان ما أسميته) في منطقة النص (text area)، وانقر على "`Add key`" (إضافة مفتاح). [NOTE] ==== -Be sure to name your SSH key something you can remember. -You can name each of your keys (e.g. "My Laptop" or "Work Account") so that if you need to revoke a key later, you can easily tell which one you're looking for. +تأكد من تسمية مفتاح SSH الخاص بك بشيء يمكنك تذكره. +يمكنك تسمية كل مفتاح من مفاتيحك (على سبيل المثال "الكمبيوتر المحمول الخاص بي" أو "حساب العمل") بحيث إذا احتجت إلى إبطال (revoke) مفتاح لاحقاً، يمكنك بسهولة معرفة المفتاح الذي تبحث عنه. ==== [[_personal_avatar]] -==== Your Avatar +==== Your Avatar (صورتك الرمزية) -Next, if you wish, you can replace the avatar that is generated for you with an image of your choosing. -First go to the "`Profile`" tab (above the SSH Keys tab) and click "`Upload new picture`". +بعد ذلك، إذا كنت ترغب في ذلك، يمكنك استبدال الصورة الرمزية (avatar) التي تم إنشاؤها لك بصورة من اختيارك. +اذهب أولاً إلى علامة التبويب "`Profile`" (الملف الشخصي) (أعلى علامة التبويب SSH Keys) وانقر على "`Upload new picture`" (تحميل صورة جديدة). -.The "`Profile`" link +.The "`Profile`" link (رابط "`الملف الشخصي`") image::images/your-profile.png[The “Profile” link] -We'll choose a copy of the Git logo that is on our hard drive and then we get a chance to crop it. +سنختار نسخة من شعار Git (Git logo) الموجودة على قرصنا الصلب (hard drive) ثم نحصل على فرصة لاقتصاصها (crop it). -.Crop your uploaded avatar +.Crop your uploaded avatar (اقتصاص صورتك الرمزية المحملة) image::images/avatar-crop.png[Crop your uploaded avatar] -Now anywhere you interact on the site, people will see your avatar next to your username. +الآن في أي مكان تتفاعل (interact) فيه على الموقع، سيرى الأشخاص صورتك الرمزية (avatar) بجوار اسم المستخدم الخاص بك. -If you happen to have uploaded an avatar to the popular Gravatar service (often used for WordPress accounts), that avatar will be used by default and you don't need to do this step. +إذا تصادف أنك قمت بتحميل صورة رمزية إلى خدمة Gravatar الشهيرة (والتي تُستخدم غالباً لحسابات WordPress)، فسيتم استخدام تلك الصورة الرمزية بشكل افتراضي (by default) ولن تحتاج إلى القيام بهذه الخطوة. -==== Your Email Addresses +==== Your Email Addresses (عناوين بريدك الإلكتروني) -The way that GitHub maps your Git commits to your user is by email address. -If you use multiple email addresses in your commits and you want GitHub to link them up properly, you need to add all the email addresses you have used to the Emails section of the admin section. +الطريقة التي يربط بها GitHub عمليات تأكيد (commits) Git الخاصة بك بالمستخدم هي عن طريق عنوان البريد الإلكتروني. +إذا كنت تستخدم عناوين بريد إلكتروني (email addresses) متعددة في عمليات التأكيد الخاصة بك وتريد من GitHub ربطها (link them up) بشكل صحيح، فستحتاج إلى إضافة جميع عناوين البريد الإلكتروني التي استخدمتها إلى قسم Emails (رسائل البريد الإلكتروني) في قسم الإدارة (admin section). [[_add_email_addresses]] -.Add all your email addresses +.Add all your email addresses (أضف جميع عناوين بريدك الإلكتروني) image::images/email-settings.png[Add all your email addresses] -In <<_add_email_addresses>> we can see some of the different states that are possible. -The top address is verified and set as the primary address, meaning that is where you'll get any notifications and receipts. -The second address is verified and so can be set as the primary if you wish to switch them. -The final address is unverified, meaning that you can't make it your primary address. -If GitHub sees any of these in commit messages in any repository on the site, it will be linked to your user now. +في <<_add_email_addresses>> يمكننا رؤية بعض الحالات المختلفة (different states) الممكنة. +العنوان العلوي تم التحقق منه (verified) وتعيينه كعنوان أساسي (primary address)، مما يعني أن هذا هو المكان الذي ستتلقى فيه أي إشعارات (notifications) وإيصالات (receipts). +العنوان الثاني تم التحقق منه وبالتالي يمكن تعيينه كعنوان أساسي إذا كنت ترغب في التبديل (switch) بينهما. +العنوان الأخير لم يتم التحقق منه (unverified)، مما يعني أنه لا يمكنك جعله عنوانك الأساسي. +إذا رأى GitHub أياً من هذه العناوين في رسائل التأكيد (commit messages) في أي مستودع (repository) على الموقع، فسيتم ربطها (linked) بالمستخدم الخاص بك الآن. -==== Two Factor Authentication +==== Two Factor Authentication (المصادقة الثنائية) -Finally, for extra security, you should definitely set up Two-factor Authentication or "`2FA`". -Two-factor Authentication is an authentication mechanism that is becoming more and more popular recently to mitigate the risk of your account being compromised if your password is stolen somehow. -Turning it on will make GitHub ask you for two different methods of authentication, so that if one of them is compromised, an attacker will not be able to access your account. +أخيراً، لمزيد من الأمان (extra security)، يجب عليك بالتأكيد إعداد المصادقة الثنائية (Two-factor Authentication) أو "`2FA`". +المصادقة الثنائية هي آلية مصادقة (authentication mechanism) أصبحت شائعة (popular) بشكل متزايد مؤخراً للتخفيف من خطر اختراق حسابك (account being compromised) في حالة سرقة كلمة مرورك (password) بطريقة ما. +سيؤدي تشغيلها إلى مطالبة GitHub بطريقتين مختلفتين للمصادقة (authentication)، بحيث إذا تم اختراق إحداهما، فلن يتمكن المهاجم (attacker) من الوصول إلى حسابك. -You can find the Two-factor Authentication setup under the Security tab of your Account settings. +يمكنك العثور على إعداد المصادقة الثنائية (Two-factor Authentication setup) ضمن علامة التبويب Security (الأمان) في Account settings (إعدادات حسابك). -.2FA in the Security Tab +.2FA in the Security Tab (المصادقة الثنائية في علامة التبويب الأمان) image::images/2fa-1.png[2FA in the Security Tab] -If you click on the "`Set up two-factor authentication`" button, it will take you to a configuration page where you can choose to use a phone app to generate your secondary code (a "`time based one-time password`"), or you can have GitHub send you a code via SMS each time you need to log in. +إذا نقرت على زر "`Set up two-factor authentication`" (إعداد المصادقة الثنائية)، فسيأخذك ذلك إلى صفحة تكوين (configuration page) حيث يمكنك اختيار استخدام تطبيق هاتف لإنشاء الرمز الثانوي (secondary code) الخاص بك ("`كلمة مرور لمرة واحدة مستندة إلى الوقت`" - "`time based one-time password`")، أو يمكنك جعل GitHub يرسل لك رمزاً عبر رسالة نصية قصيرة (SMS) في كل مرة تحتاج فيها إلى تسجيل الدخول (log in). -After you choose which method you prefer and follow the instructions for setting up 2FA, your account will then be a little more secure and you will have to provide a code in addition to your password whenever you log into GitHub. +بعد اختيار الطريقة التي تفضلها واتباع الإرشادات (instructions) لإعداد المصادقة الثنائية (2FA)، سيكون حسابك حينئذ أكثر أماناً قليلاً (little more secure) وسيتعين عليك تقديم رمز بالإضافة إلى كلمة المرور (password) الخاصة بك كلما قمت بتسجيل الدخول (log into) إلى GitHub. diff --git a/book/06-github/sections/2-contributing.asc b/book/06-github/sections/2-contributing.asc index 1dffbd9a5..f3a9c080f 100644 --- a/book/06-github/sections/2-contributing.asc +++ b/book/06-github/sections/2-contributing.asc @@ -1,74 +1,74 @@ -=== Contributing to a Project +=== Contributing to a Project (المساهمة في مشروع) -Now that our account is set up, let's walk through some details that could be useful in helping you contribute to an existing project. +الآن بعد أن تم إعداد حسابنا، دعنا نستعرض بعض التفاصيل التي قد تكون مفيدة في مساعدتك على المساهمة (contribute) في مشروع موجود (existing project). -==== Forking Projects +==== Forking Projects (نسخ المشاريع) (((forking))) -If you want to contribute to an existing project to which you don't have push access, you can "`fork`" the project. -When you "`fork`" a project, GitHub will make a copy of the project that is entirely yours; it lives in your namespace, and you can push to it. +إذا كنت ترغب في المساهمة (contribute) في مشروع موجود (existing project) ليس لديك وصول دفع (push access) إليه، فيمكنك "`نسخ`" ("`fork`") المشروع. +عندما تقوم بـ "`نسخ`" ("`fork`") مشروع، سيقوم GitHub بعمل نسخة (copy) من المشروع خاصة بك تماماً؛ تعيش في مساحة الأسماء (namespace) الخاصة بك، ويمكنك الدفع (push) إليها. [NOTE] ==== -Historically, the term "`fork`" has been somewhat negative in context, meaning that someone took an open source project in a different direction, sometimes creating a competing project and splitting the contributors. -In GitHub, a "`fork`" is simply the same project in your own namespace, allowing you to make changes to a project publicly as a way to contribute in a more open manner. +تاريخياً، كان مصطلح "`fork`" (نسخ/تشعب) سلبياً (negative) إلى حد ما في السياق، مما يعني أن شخصاً ما أخذ مشروعاً مفتوح المصدر (open source project) في اتجاه مختلف (different direction)، وأحياناً أنشأ مشروعاً منافساً (competing project) وقسم المساهمين (splitting the contributors). +في GitHub، الـ "`fork`" (النسخة) هو ببساطة نفس المشروع في مساحة الأسماء (namespace) الخاصة بك، مما يسمح لك بإجراء تغييرات (make changes) على مشروع علناً (publicly) كوسيلة للمساهمة (contribute) بطريقة أكثر انفتاحاً. ==== -This way, projects don't have to worry about adding users as collaborators to give them push access. -People can fork a project, push to it, and contribute their changes back to the original repository by creating what's called a Pull Request, which we'll cover next. -This opens up a discussion thread with code review, and the owner and the contributor can then communicate about the change until the owner is happy with it, at which point the owner can merge it in. +بهذه الطريقة، لا يتعين على المشاريع القلق بشأن إضافة مستخدمين كمتعاونين (collaborators) لمنحهم وصول دفع (push access). +يمكن للأشخاص نسخ (fork) مشروع، والدفع (push) إليه، والمساهمة بتغييراتهم (contribute their changes) مرة أخرى إلى المستودع الأصلي (original repository) عن طريق إنشاء ما يسمى طلب سحب (Pull Request)، والذي سنغطيه تالياً. +يفتح هذا سلسلة مناقشة (discussion thread) مع مراجعة الكود (code review)، ويمكن للمالك (owner) والمساهم (contributor) بعد ذلك التواصل بشأن التغيير حتى يصبح المالك راضياً عنه، وعند هذه النقطة يمكن للمالك دمجه (merge it in). -To fork a project, visit the project page and click the "`Fork`" button at the top-right of the page. +لنسخ (fork) مشروع، قم بزيارة صفحة المشروع وانقر على زر "`Fork`" في أعلى يمين الصفحة. -.The "`Fork`" button +.The "`Fork`" button (زر "`Fork`") image::images/forkbutton.png[The “Fork” button] -After a few seconds, you'll be taken to your new project page, with your own writeable copy of the code. +بعد بضع ثوانٍ، سيتم نقلك إلى صفحة مشروعك الجديد، مع نسختك القابلة للكتابة (writeable copy) الخاصة بك من الكود (code). [[ch06-github_flow]] -==== The GitHub Flow +==== The GitHub Flow (سير عمل GitHub) (((GitHub, Flow))) -GitHub is designed around a particular collaboration workflow, centered on Pull Requests. -This flow works whether you're collaborating with a tightly-knit team in a single shared repository, or a globally-distributed company or network of strangers contributing to a project through dozens of forks. -It is centered on the <> workflow covered in <>. +تم تصميم GitHub حول سير عمل تعاوني (collaboration workflow) معين، يتمحور حول طلبات السحب (Pull Requests). +يعمل هذا التدفق (flow) سواء كنت تتعاون مع فريق متماسك (tightly-knit team) في مستودع مشترك (shared repository) واحد، أو شركة موزعة عالمياً (globally-distributed company) أو شبكة من الغرباء يساهمون (contributing) في مشروع من خلال عشرات النسخ (forks). +يتمحور حول سير عمل <> المغطى في <>. -Here's how it generally works: +إليك كيفية عمله بشكل عام: -1. Fork the project. -2. Create a topic branch from `master`. -3. Make some commits to improve the project. -4. Push this branch to your GitHub project. -5. Open a Pull Request on GitHub. -6. Discuss, and optionally continue committing. -7. The project owner merges or closes the Pull Request. -8. Sync the updated `master` back to your fork. +1. انسخ (Fork) المشروع. +2. أنشئ فرع موضوع (topic branch) من `master`. +3. قم ببعض عمليات التأكيد (commits) لتحسين المشروع. +4. ادفع (Push) هذا الفرع إلى مشروع GitHub الخاص بك. +5. افتح طلب سحب (Pull Request) على GitHub. +6. ناقش، واستمر في التأكيد (committing) اختيارياً. +7. يدمج (merges) مالك المشروع (project owner) طلب السحب أو يغلقه (closes). +8. قم بمزامنة (Sync) `master` المحدث (updated) مرة أخرى إلى نسختك (fork). -This is basically the Integration Manager workflow covered in <>, but instead of using email to communicate and review changes, teams use GitHub's web based tools. +هذا هو أساساً سير عمل مدير التكامل (Integration Manager workflow) المغطى في <>، ولكن بدلاً من استخدام البريد الإلكتروني (email) للتواصل ومراجعة التغييرات (review changes)، تستخدم الفرق أدوات GitHub المستندة إلى الويب (web based tools). -Let's walk through an example of proposing a change to an open source project hosted on GitHub using this flow. +دعنا نستعرض مثالاً لاقتراح تغيير (proposing a change) في مشروع مفتوح المصدر (open source project) مستضاف على GitHub باستخدام هذا التدفق. [TIP] ==== -You can use the official *GitHub CLI* tool instead of the GitHub web interface for most things. -The tool can be used on Windows, macOS, and Linux systems. -Go to the https://cli.github.com/[GitHub CLI homepage^] for installation instructions and the manual. +يمكنك استخدام أداة *GitHub CLI* الرسمية بدلاً من واجهة الويب الخاصة بـ GitHub لمعظم الأشياء. +يمكن استخدام الأداة على أنظمة Windows و macOS و Linux. +انتقل إلى https://cli.github.com/[الصفحة الرئيسية لـ GitHub CLI^] للحصول على إرشادات التثبيت (installation instructions) والدليل (manual). ==== -===== Creating a Pull Request +===== Creating a Pull Request (إنشاء طلب سحب) -Tony is looking for code to run on his Arduino programmable microcontroller and has found a great program file on GitHub at https://github.com/schacon/blink[^]. +يبحث Tony عن كود (code) لتشغيله على متحكمه الدقيق (microcontroller) القابل للبرمجة من نوع Arduino ووجد ملف برنامج (program file) رائعاً على GitHub في https://github.com/schacon/blink[^]. -.The project we want to contribute to +.The project we want to contribute to (المشروع الذي نريد المساهمة فيه) image::images/blink-01-start.png[The project we want to contribute to] -The only problem is that the blinking rate is too fast. -We think it's much nicer to wait 3 seconds instead of 1 in between each state change. -So let's improve the program and submit it back to the project as a proposed change. +المشكلة الوحيدة هي أن معدل الوميض (blinking rate) سريع جداً. +نعتقد أنه من الأفضل بكثير الانتظار 3 ثوانٍ بدلاً من 1 بين كل تغيير حالة (state change). +لذا دعونا نحسن البرنامج (improve the program) ونرسله مرة أخرى (submit it back) إلى المشروع كتغيير مقترح (proposed change). -First, we click the 'Fork' button as mentioned earlier to get our own copy of the project. -Our user name here is "`tonychacon`" so our copy of this project is at `https://github.com/tonychacon/blink` and that's where we can edit it. -We will clone it locally, create a topic branch, make the code change and finally push that change back up to GitHub. +أولاً، نضغط على زر 'Fork' كما ذكرنا سابقاً للحصول على نسختنا (our own copy) الخاصة من المشروع. +اسم المستخدم (user name) الخاص بنا هنا هو "`tonychacon`" لذا فإن نسختنا من هذا المشروع موجودة في `https://github.com/tonychacon/blink` وهذا هو المكان الذي يمكننا تحريره (edit it) فيه. +سنقوم باستنساخه (clone it) محلياً (locally)، وإنشاء فرع موضوع (topic branch)، وإجراء تغيير الكود (code change) وأخيراً دفع (push) ذلك التغيير مرة أخرى إلى GitHub. [source,console] ---- @@ -113,135 +113,135 @@ To https://github.com/tonychacon/blink * [new branch] slow-blink -> slow-blink ---- -<1> Clone our fork of the project locally. -<2> Create a descriptive topic branch. -<3> Make our change to the code. -<4> Check that the change is good. -<5> Commit our change to the topic branch. -<6> Push our new topic branch back up to our GitHub fork. +<1> استنسخ نسختنا من المشروع (fork of the project) محلياً. +<2> أنشئ فرع موضوع (topic branch) وصفياً. +<3> قم بإجراء تغييرنا على الكود. +<4> تحقق (Check) من أن التغيير جيد. +<5> أكد (Commit) تغييرنا لفرع الموضوع. +<6> ادفع (Push) فرع موضوعنا الجديد مرة أخرى إلى نسختنا (fork) على GitHub. -Now if we go back to our fork on GitHub, we can see that GitHub noticed that we pushed a new topic branch up and presents us with a big green button to check out our changes and open a Pull Request to the original project. +الآن إذا عدنا إلى نسختنا (fork) على GitHub، يمكننا أن نرى أن GitHub لاحظ أننا دفعنا (pushed) فرع موضوع (topic branch) جديداً ويقدم لنا زراً أخضر كبيراً للتحقق من تغييراتنا (check out our changes) وفتح طلب سحب (open a Pull Request) للمشروع الأصلي (original project). -You can alternatively go to the "`Branches`" page at `\https://github.com///branches` to locate your branch and open a new Pull Request from there. +بدلاً من ذلك، يمكنك الانتقال إلى صفحة "`Branches`" (الفروع) في `\https://github.com///branches` لتحديد موقع فرعك (locate your branch) وفتح طلب سحب (Pull Request) جديد من هناك. -.Pull Request button +.Pull Request button (زر طلب السحب) image::images/blink-02-pr.png[Pull Request button] (((GitHub, pull requests))) -If we click that green button, we'll see a screen that asks us to give our Pull Request a title and description. -It is almost always worthwhile to put some effort into this, since a good description helps the owner of the original project determine what you were trying to do, whether your proposed changes are correct, and whether accepting the changes would improve the original project. +إذا نقرنا على هذا الزر الأخضر، فسنرى شاشة تطلب منا إعطاء طلب السحب (Pull Request) عنواناً ووصفاً (title and description). +من الجدير بالاهتمام دائماً تقريباً بذل بعض الجهد (effort) في هذا، لأن الوصف الجيد يساعد مالك المشروع الأصلي (owner of the original project) على تحديد ما كنت تحاول القيام به، وما إذا كانت التغييرات المقترحة (proposed changes) صحيحة (correct)، وما إذا كان قبول التغييرات سيؤدي إلى تحسين المشروع الأصلي (improve the original project). -We also see a list of the commits in our topic branch that are "`ahead`" of the `master` branch (in this case, just the one) and a unified diff of all the changes that will be made should this branch get merged by the project owner. +نرى أيضاً قائمة بعمليات التأكيد (commits) في فرع الموضوع (topic branch) الخاص بنا والتي "`تسبق`" ("`ahead`") فرع `master` (في هذه الحالة، واحد فقط) وفرقاً موحداً (unified diff) لجميع التغييرات التي سيتم إجراؤها إذا تم دمج (merged) هذا الفرع بواسطة مالك المشروع. -.Pull Request creation page +.Pull Request creation page (صفحة إنشاء طلب السحب) image::images/blink-03-pull-request-open.png[Pull Request creation page] -When you hit the 'Create pull request' button on this screen, the owner of the project you forked will get a notification that someone is suggesting a change and will link to a page that has all of this information on it. +عندما تضغط على زر 'Create pull request' (إنشاء طلب سحب) في هذه الشاشة، سيتلقى مالك المشروع الذي نسخته (forked) إشعاراً (notification) بأن شخصاً ما يقترح تغييراً وسينقله إلى صفحة تحتوي على كل هذه المعلومات عليها. [NOTE] ==== -Though Pull Requests are used commonly for public projects like this when the contributor has a complete change ready to be made, it's also often used in internal projects _at the beginning_ of the development cycle. -Since you can keep pushing to the topic branch even *after* the Pull Request is opened, it's often opened early and used as a way to iterate on work as a team within a context, rather than opened at the very end of the process. +على الرغم من أن طلبات السحب (Pull Requests) تُستخدم بشكل شائع (commonly) في المشاريع العامة (public projects) مثل هذه عندما يكون لدى المساهم تغيير كامل (complete change) جاهز للإجراء، إلا أنه غالباً ما يُستخدم أيضاً في المشاريع الداخلية (internal projects) _في بداية_ دورة التطوير (development cycle). +نظراً لأنه يمكنك الاستمرار في الدفع (pushing) إلى فرع الموضوع حتى *بعد* فتح طلب السحب (Pull Request)، فغالباً ما يتم فتحه مبكراً ويستخدم كطريقة لتكرار (iterate) العمل كفريق (team) ضمن سياق (context)، بدلاً من فتحه في نهاية العملية (process) تماماً. ==== -===== Iterating on a Pull Request +===== Iterating on a Pull Request (التكرار على طلب السحب) -At this point, the project owner can look at the suggested change and merge it, reject it or comment on it. -Let's say that he likes the idea, but would prefer a slightly longer time for the light to be off than on. +في هذه المرحلة، يمكن لمالك المشروع (project owner) إلقاء نظرة على التغيير المقترح (suggested change) ودمجه (merge it) أو رفضه (reject it) أو التعليق عليه (comment on it). +لنفترض أنه معجب بالفكرة، ولكنه يفضل وقتاً أطول قليلاً ليكون الضوء مطفأً بدلاً من مضاءً. -Where this conversation may take place over email in the workflows presented in <>, on GitHub this happens online. -The project owner can review the unified diff and leave a comment by clicking on any of the lines. +في حين أن هذه المحادثة قد تتم عبر البريد الإلكتروني (email) في مهام سير العمل (workflows) المقدمة في <>، فإن هذا يحدث في GitHub عبر الإنترنت (online). +يمكن لمالك المشروع مراجعة (review) الفرق الموحد (unified diff) وترك تعليق (comment) بالنقر فوق أي من الأسطر (lines). -.Comment on a specific line of code in a Pull Request +.Comment on a specific line of code in a Pull Request (التعليق على سطر كود معين في طلب سحب) image::images/blink-04-pr-comment.png[Comment on a specific line of code in a Pull Request] -Once the maintainer makes this comment, the person who opened the Pull Request (and indeed, anyone else watching the repository) will get a notification. -We'll go over customizing this later, but if he had email notifications turned on, Tony would get an email like this: +بمجرد أن يقوم المشرف (maintainer) بإبداء هذا التعليق (comment)، سيتلقى الشخص الذي فتح طلب السحب (وبالفعل، أي شخص آخر يراقب المستودع - watching the repository) إشعاراً (notification). +سنستعرض تخصيص هذا (customizing this) لاحقاً، ولكن إذا كان قد قام بتشغيل إشعارات البريد الإلكتروني (email notifications)، فسيحصل Tony على بريد إلكتروني مثل هذا: [[_email_notification]] -.Comments sent as email notifications +.Comments sent as email notifications (إرسال التعليقات كإشعارات بريد إلكتروني) image::images/blink-04-email.png[Comments sent as email notifications] -Anyone can also leave general comments on the Pull Request. -In <<_pr_discussion>> we can see an example of the project owner both commenting on a line of code and then leaving a general comment in the discussion section. -You can see that the code comments are brought into the conversation as well. +يمكن لأي شخص أيضاً ترك تعليقات عامة (general comments) على طلب السحب (Pull Request). +في <<_pr_discussion>> يمكننا رؤية مثال (example) لمالك المشروع وهو يعلق على سطر من الكود ثم يترك تعليقاً عاماً (general comment) في قسم المناقشة (discussion section). +يمكنك أن ترى أنه تم إحضار تعليقات الكود (code comments) إلى المحادثة (conversation) أيضاً. [[_pr_discussion]] -.Pull Request discussion page +.Pull Request discussion page (صفحة مناقشة طلب السحب) image::images/blink-05-general-comment.png[Pull Request discussion page] -Now the contributor can see what they need to do in order to get their change accepted. -Luckily this is very straightforward. -Where over email you may have to re-roll your series and resubmit it to the mailing list, with GitHub you simply commit to the topic branch again and push, which will automatically update the Pull Request. -In <<_pr_final>> you can also see that the old code comment has been collapsed in the updated Pull Request, since it was made on a line that has since been changed. +الآن يمكن للمساهم (contributor) أن يرى ما يحتاجون إلى القيام به من أجل قبول تغييرهم (change accepted). +لحسن الحظ هذا واضح ومباشر (straightforward) للغاية. +حيث قد تضطر في رسالة بريد إلكتروني إلى إعادة إرسال سلسلتك (re-roll your series) وإعادة تقديمها (resubmit it) إلى القائمة البريدية (mailing list)، فمع GitHub يمكنك ببساطة التأكيد (commit) لفرع الموضوع (topic branch) مرة أخرى والدفع (push)، مما سيؤدي تلقائياً إلى تحديث طلب السحب (Pull Request). +في <<_pr_final>> يمكنك أيضاً أن ترى أن تعليق الكود القديم (old code comment) قد تم طيه (collapsed) في طلب السحب المحدث (updated Pull Request)، لأنه تم على سطر تم تغييره منذ ذلك الحين. -Adding commits to an existing Pull Request doesn't trigger a notification, so once Tony has pushed his corrections he decides to leave a comment to inform the project owner that he made the requested change. +إضافة عمليات تأكيد (commits) إلى طلب سحب (Pull Request) موجود لا يؤدي إلى تشغيل إشعار (trigger a notification)، لذلك بمجرد أن يدفع Tony تصحيحاته (corrections) يقرر ترك تعليق لإبلاغ مالك المشروع (inform the project owner) بأنه أجرى التغيير المطلوب. [[_pr_final]] -.Pull Request final +.Pull Request final (طلب السحب النهائي) image::images/blink-06-final.png[Pull Request final] -An interesting thing to notice is that if you click on the "`Files Changed`" tab on this Pull Request, you'll get the "`unified`" diff -- that is, the total aggregate difference that would be introduced to your main branch if this topic branch was merged in. -In `git diff` terms, it basically automatically shows you `git diff master...` for the branch this Pull Request is based on. -See <> for more about this type of diff. +من الأشياء المثيرة للاهتمام التي يجب ملاحظتها هو أنه إذا نقرت على علامة التبويب "`Files Changed`" (الملفات التي تم تغييرها) في طلب السحب هذا، فستحصل على الفرق "`الموحد`" ("`unified`" diff) -- أي الفرق الإجمالي (total aggregate difference) الذي سيتم إدخاله إلى فرعك الرئيسي (main branch) إذا تم دمج فرع الموضوع هذا. +بمصطلحات `git diff`، فإنه يُظهر لك بشكل أساسي تلقائياً (automatically) `git diff master...` للفرع الذي يستند إليه طلب السحب (Pull Request) هذا. +راجع <> لمزيد من المعلومات حول هذا النوع من الفرق (diff). -The other thing you'll notice is that GitHub checks to see if the Pull Request merges cleanly and provides a button to do the merge for you on the server. -This button only shows up if you have write access to the repository and a trivial merge is possible. -If you click it GitHub will perform a "`non-fast-forward`" merge, meaning that even if the merge *could* be a fast-forward, it will still create a merge commit. +الشيء الآخر الذي ستلاحظه هو أن GitHub يتحقق لمعرفة ما إذا كان طلب السحب (Pull Request) يندمج بشكل نظيف (merges cleanly) ويوفر زراً (button) للقيام بالدمج (merge) نيابة عنك على الخادم (server). +يظهر هذا الزر فقط إذا كان لديك وصول كتابة (write access) إلى المستودع (repository) وكان الدمج البسيط (trivial merge) ممكناً. +إذا نقرت عليه، فسيقوم GitHub بإجراء دمج "`غير سريع`" ("`non-fast-forward`" merge)، مما يعني أنه حتى إذا كان من الممكن أن يكون الدمج *سريعاً (fast-forward)*، فسيظل ينشئ تأكيد دمج (merge commit). -If you would prefer, you can simply pull the branch down and merge it locally. -If you merge this branch into the `master` branch and push it to GitHub, the Pull Request will automatically be closed. +إذا كنت تفضل ذلك، يمكنك ببساطة سحب الفرع لأسفل (pull the branch down) ودمجه محلياً (merge it locally). +إذا قمت بدمج هذا الفرع في فرع `master` ودفعته (push it) إلى GitHub، فسيتم إغلاق (closed) طلب السحب تلقائياً (automatically). -This is the basic workflow that most GitHub projects use. -Topic branches are created, Pull Requests are opened on them, a discussion ensues, possibly more work is done on the branch and eventually the request is either closed or merged. +هذا هو سير العمل الأساسي (basic workflow) الذي تستخدمه معظم مشاريع GitHub. +يتم إنشاء فروع المواضيع (Topic branches)، ويتم فتح طلبات السحب (Pull Requests) عليها، وتحدث مناقشة (discussion ensues)، وربما يتم إنجاز المزيد من العمل (more work) على الفرع وفي النهاية يتم إغلاق الطلب (request) أو دمجه (merged). [NOTE] -.Not Only Forks +.Not Only Forks (ليس للنسخ فقط) ==== -It's important to note that you can also open a Pull Request between two branches in the same repository. -If you're working on a feature with someone and you both have write access to the project, you can push a topic branch to the repository and open a Pull Request on it to the `master` branch of that same project to initiate the code review and discussion process. -No forking necessary. +من المهم ملاحظة أنه يمكنك أيضاً فتح طلب سحب (Pull Request) بين فرعين (two branches) في نفس المستودع (same repository). +إذا كنت تعمل على ميزة (feature) مع شخص ما وكلاكما لديه وصول كتابة (write access) إلى المشروع، فيمكنك دفع (push) فرع موضوع (topic branch) إلى المستودع وفتح طلب سحب (Pull Request) عليه إلى فرع `master` لنفس المشروع لبدء عملية مراجعة الكود والمناقشة (code review and discussion process). +لا حاجة للنسخ (forking). ==== -==== Advanced Pull Requests +==== Advanced Pull Requests (طلبات السحب المتقدمة) -Now that we've covered the basics of contributing to a project on GitHub, let's cover a few interesting tips and tricks about Pull Requests so you can be more effective in using them. +الآن بعد أن غطينا أساسيات (basics) المساهمة (contributing) في مشروع على GitHub، دعنا نغطي بعض النصائح والحيل (tips and tricks) المثيرة للاهتمام حول طلبات السحب (Pull Requests) حتى تتمكن من أن تكون أكثر فعالية (more effective) في استخدامها. -===== Pull Requests as Patches +===== Pull Requests as Patches (طلبات السحب كتصحيحات) -It's important to understand that many projects don't really think of Pull Requests as queues of perfect patches that should apply cleanly in order, as most mailing list-based projects think of patch series contributions. -Most GitHub projects think about Pull Request branches as iterative conversations around a proposed change, culminating in a unified diff that is applied by merging. +من المهم أن نفهم أن العديد من المشاريع لا تفكر حقاً في طلبات السحب (Pull Requests) كقوائم انتظار (queues) للتصحيحات المثالية (perfect patches) التي يجب تطبيقها بشكل نظيف بالترتيب (apply cleanly in order)، كما تفكر معظم المشاريع القائمة على القوائم البريدية (mailing list-based projects) في مساهمات سلسلة التصحيحات (patch series contributions). +تفكر معظم مشاريع GitHub في فروع طلب السحب (Pull Request branches) كمحادثات متكررة (iterative conversations) حول تغيير مقترح (proposed change)، تتوج بفرق موحد (unified diff) يتم تطبيقه عن طريق الدمج (merging). -This is an important distinction, because generally the change is suggested before the code is thought to be perfect, which is far more rare with mailing list based patch series contributions. -This enables an earlier conversation with the maintainers so that arriving at the proper solution is more of a community effort. -When code is proposed with a Pull Request and the maintainers or community suggest a change, the patch series is generally not re-rolled, but instead the difference is pushed as a new commit to the branch, moving the conversation forward with the context of the previous work intact. +هذا تمييز مهم (important distinction)، لأنه بشكل عام يتم اقتراح التغيير (change is suggested) قبل أن يُعتقد أن الكود (code) مثالي، وهو أمر نادر الحدوث بكثير مع مساهمات سلسلة التصحيحات المستندة إلى القائمة البريدية. +هذا يتيح محادثة مبكرة (earlier conversation) مع المشرفين (maintainers) بحيث يكون الوصول إلى الحل المناسب (proper solution) بمثابة جهد مجتمعي (community effort) أكبر. +عندما يتم اقتراح الكود من خلال طلب سحب (Pull Request) ويقترح المشرفون أو المجتمع تغييراً (suggest a change)، فإن سلسلة التصحيحات لا تتم إعادة إنشائها (re-rolled) بشكل عام، ولكن بدلاً من ذلك يتم دفع الفرق (difference is pushed) كتأكيد جديد (new commit) للفرع، مما يدفع المحادثة (conversation) إلى الأمام مع الحفاظ على سياق العمل السابق (context of the previous work) كما هو (intact). -For instance, if you go back and look again at <<_pr_final>>, you'll notice that the contributor did not rebase his commit and send another Pull Request. -Instead they added new commits and pushed them to the existing branch. -This way if you go back and look at this Pull Request in the future, you can easily find all of the context of why decisions were made. -Pushing the "`Merge`" button on the site purposefully creates a merge commit that references the Pull Request so that it's easy to go back and research the original conversation if necessary. +على سبيل المثال، إذا عدت ونظرت مرة أخرى إلى <<_pr_final>>، ستلاحظ أن المساهم (contributor) لم يقم بإعادة بناء (rebase) تأكيده ويرسل طلب سحب آخر (another Pull Request). +بدلاً من ذلك أضافوا تأكيدات جديدة (new commits) ودفعوها (pushed them) إلى الفرع الموجود (existing branch). +بهذه الطريقة إذا عدت ونظرت إلى طلب السحب هذا في المستقبل، يمكنك بسهولة العثور على جميع سياق (context) سبب اتخاذ القرارات (decisions). +يؤدي الضغط على زر "`Merge`" (دمج) في الموقع إلى إنشاء تأكيد دمج (merge commit) عن قصد يشير (references) إلى طلب السحب (Pull Request) بحيث يكون من السهل العودة والبحث في المحادثة الأصلية (original conversation) إذا لزم الأمر. -===== Keeping up with Upstream +===== Keeping up with Upstream (مواكبة المنبع) -If your Pull Request becomes out of date or otherwise doesn't merge cleanly, you will want to fix it so the maintainer can easily merge it. -GitHub will test this for you and let you know at the bottom of every Pull Request if the merge is trivial or not. +إذا أصبح طلب السحب (Pull Request) الخاص بك قديماً (out of date) أو لم يتم دمجه بشكل نظيف (merge cleanly)، فسترغب في إصلاحه (fix it) حتى يتمكن المشرف (maintainer) من دمجه بسهولة. +سيقوم GitHub باختبار (test) ذلك نيابة عنك وإعلامك (let you know) في أسفل كل طلب سحب (Pull Request) ما إذا كان الدمج بسيطاً (trivial merge) أم لا. [[_pr_fail]] -.Pull Request does not merge cleanly +.Pull Request does not merge cleanly (طلب السحب لا يندمج بشكل نظيف) image::images/pr-01-fail.png[Pull Request does not merge cleanly] -If you see something like <<_pr_fail>>, you'll want to fix your branch so that it turns green and the maintainer doesn't have to do extra work. +إذا رأيت شيئاً مثل <<_pr_fail>>، فسترغب في إصلاح فرعك (fix your branch) بحيث يتحول إلى اللون الأخضر (turns green) ولا يضطر المشرف إلى القيام بعمل إضافي (extra work). -You have two main options in order to do this. -You can either rebase your branch on top of whatever the target branch is (normally the `master` branch of the repository you forked), or you can merge the target branch into your branch. +لديك خياران رئيسيان (main options) من أجل القيام بذلك. +يمكنك إما إعادة بناء (rebase) فرعك أعلى (on top of) أياً كان الفرع الهدف (target branch) (عادةً فرع `master` للمستودع الذي نسخته - repository you forked)، أو يمكنك دمج الفرع الهدف في فرعك. -Most developers on GitHub will choose to do the latter, for the same reasons we just went over in the previous section. -What matters is the history and the final merge, so rebasing isn't getting you much other than a slightly cleaner history and in return is *far* more difficult and error prone. +سيختار معظم المطورين (developers) على GitHub القيام بالخيار الأخير، لنفس الأسباب التي استعرضناها للتو في القسم السابق. +ما يهم هو السجل (history) والدمج النهائي (final merge)، لذا فإن إعادة البناء (rebasing) لا تفيدك كثيراً بخلاف الحصول على سجل أنظف قليلاً (slightly cleaner history) وفي المقابل يكون الأمر أكثر صعوبة (difficult) وعرضة للأخطاء (error prone). -If you want to merge in the target branch to make your Pull Request mergeable, you would add the original repository as a new remote, fetch from it, merge the main branch of that repository into your topic branch, fix any issues and finally push it back up to the same branch you opened the Pull Request on. +إذا كنت تريد دمج (merge) الفرع الهدف لجعل طلب السحب الخاص بك قابلاً للدمج (mergeable)، فيجب عليك إضافة المستودع الأصلي (original repository) كجهاز تحكم عن بعد جديد (new remote)، وجلب (fetch) منه، ودمج الفرع الرئيسي (main branch) لذلك المستودع في فرع موضوعك (topic branch)، وإصلاح أي مشكلات (fix any issues) وأخيراً دفعه (push it) مرة أخرى إلى نفس الفرع الذي فتحت طلب السحب عليه. -For example, let's say that in the "`tonychacon`" example we were using before, the original author made a change that would create a conflict in the Pull Request. -Let's go through those steps. +على سبيل المثال، لنفترض أنه في مثال "`tonychacon`" الذي كنا نستخدمه من قبل، قام المؤلف الأصلي (original author) بإجراء تغيير قد يخلق تعارضاً (conflict) في طلب السحب (Pull Request). +دعنا نمر بهذه الخطوات. [source,console] ---- @@ -276,87 +276,87 @@ To https://github.com/tonychacon/blink ef4725c..3c8d735 slower-blink -> slow-blink ---- -<1> Add the original repository as a remote named `upstream`. -<2> Fetch the newest work from that remote. -<3> Merge the main branch of that repository into your topic branch. -<4> Fix the conflict that occurred. -<5> Push back up to the same topic branch. +<1> أضف المستودع الأصلي كجهاز تحكم عن بعد (remote) باسم `upstream`. +<2> اجلب (Fetch) أحدث الأعمال من جهاز التحكم عن بعد ذلك. +<3> ادمج (Merge) الفرع الرئيسي (main branch) لذلك المستودع في فرع موضوعك. +<4> أصلح التعارض (Fix the conflict) الذي حدث. +<5> ادفع (Push) مرة أخرى إلى نفس فرع الموضوع. -Once you do that, the Pull Request will be automatically updated and re-checked to see if it merges cleanly. +بمجرد القيام بذلك، سيتم تحديث (updated) طلب السحب (Pull Request) تلقائياً (automatically) وإعادة التحقق (re-checked) لمعرفة ما إذا كان يندمج بشكل نظيف. [[_pr_merge_fix]] -.Pull Request now merges cleanly +.Pull Request now merges cleanly (طلب السحب يندمج الآن بشكل نظيف) image::images/pr-02-merge-fix.png[Pull Request now merges cleanly] -One of the great things about Git is that you can do that continuously. -If you have a very long-running project, you can easily merge from the target branch over and over again and only have to deal with conflicts that have arisen since the last time that you merged, making the process very manageable. +أحد الأشياء الرائعة في Git هو أنه يمكنك القيام بذلك بشكل مستمر (continuously). +إذا كان لديك مشروع طويل المدى (long-running project) للغاية، فيمكنك الدمج من الفرع الهدف (target branch) مراراً وتكراراً بسهولة ولا يتعين عليك سوى التعامل مع التعارضات (conflicts) التي نشأت منذ آخر مرة قمت فيها بالدمج، مما يجعل العملية قابلة للإدارة للغاية. -If you absolutely wish to rebase the branch to clean it up, you can certainly do so, but it is highly encouraged to not force push over the branch that the Pull Request is already opened on. -If other people have pulled it down and done more work on it, you run into all of the issues outlined in <>. -Instead, push the rebased branch to a new branch on GitHub and open a brand new Pull Request referencing the old one, then close the original. +إذا كنت ترغب تماماً في إعادة بناء (rebase) الفرع لتنظيفه (clean it up)، فيمكنك بالتأكيد القيام بذلك، ولكن يُنصح بشدة (highly encouraged) بعدم الدفع بالقوة (force push) فوق الفرع الذي تم فتح طلب السحب (Pull Request) عليه بالفعل. +إذا قام أشخاص آخرون بسحبه لأسفل (pulled it down) وقاموا بمزيد من العمل عليه، فإنك تواجه جميع المشكلات الموضحة في <>. +بدلاً من ذلك، ادفع (push) الفرع المعاد بناؤه (rebased branch) إلى فرع جديد (new branch) على GitHub وافتح طلب سحب جديداً (brand new Pull Request) تماماً يشير إلى الطلب القديم، ثم أغلق الأصلي (close the original). -===== References +===== References (المراجع) -Your next question may be "`How do I reference the old Pull Request?`". -It turns out there are many, many ways to reference other things almost anywhere you can write in GitHub. +قد يكون سؤالك التالي هو "`How do I reference the old Pull Request?`" ("`كيف يمكنني الرجوع إلى طلب السحب القديم؟`"). +اتضح أن هناك العديد والعديد من الطرق للإشارة (reference) إلى أشياء أخرى في أي مكان يمكنك الكتابة فيه في GitHub تقريباً. -Let's start with how to cross-reference another Pull Request or an Issue. -All Pull Requests and Issues are assigned numbers and they are unique within the project. -For example, you can't have Pull Request +#3+ _and_ Issue +#3+. -If you want to reference any Pull Request or Issue from any other one, you can simply put `+#+` in any comment or description. -You can also be more specific if the Issue or Pull request lives somewhere else; write `username#` if you're referring to an Issue or Pull Request in a fork of the repository you're in, or `username/repo#` to reference something in another repository. +لنبدأ بكيفية الإسناد الترافقي (cross-reference) لطلب سحب (Pull Request) آخر أو مشكلة (Issue). +يتم تعيين أرقام (numbers) لجميع طلبات السحب والمشكلات وهي فريدة (unique) داخل المشروع. +على سبيل المثال، لا يمكن أن يكون لديك طلب سحب (Pull Request) `#3` _و_ مشكلة (Issue) `#3`. +إذا كنت ترغب في الرجوع إلى أي طلب سحب أو مشكلة من أي شيء آخر، يمكنك ببساطة وضع `#` في أي تعليق أو وصف (comment or description). +يمكنك أيضاً أن تكون أكثر تحديداً (specific) إذا كانت المشكلة (Issue) أو طلب السحب (Pull request) موجودين في مكان آخر؛ اكتب `username#` إذا كنت تشير (referring) إلى مشكلة أو طلب سحب في نسخة (fork) من المستودع (repository) الذي تتواجد فيه، أو `username/repo#` للإشارة (reference) إلى شيء ما في مستودع آخر. -Let's look at an example. -Say we rebased the branch in the previous example, created a new pull request for it, and now we want to reference the old pull request from the new one. -We also want to reference an issue in the fork of the repository and an issue in a completely different project. -We can fill out the description just like <<_pr_references>>. +لنلق نظرة على مثال. +لنفترض أننا أعدنا بناء الفرع (rebased the branch) في المثال السابق، وأنشأنا طلب سحب (pull request) جديداً له، والآن نريد الرجوع (reference) إلى طلب السحب القديم من الطلب الجديد. +نريد أيضاً الرجوع إلى مشكلة (issue) في نسخة (fork) المستودع ومشكلة في مشروع مختلف (different project) تماماً. +يمكننا ملء الوصف (description) تماماً مثل <<_pr_references>>. [[_pr_references]] -.Cross references in a Pull Request +.Cross references in a Pull Request (المراجع الترافقية في طلب سحب) image::images/mentions-01-syntax.png[Cross references in a Pull Request] -When we submit this pull request, we'll see all of that rendered like <<_pr_references_render>>. +عندما نرسل (submit) طلب السحب (pull request) هذا، سنرى كل ذلك معروضاً (rendered) مثل <<_pr_references_render>>. [[_pr_references_render]] -.Cross references rendered in a Pull Request +.Cross references rendered in a Pull Request (عرض المراجع الترافقية في طلب سحب) image::images/mentions-02-render.png[Cross references rendered in a Pull Request] -Notice that the full GitHub URL we put in there was shortened to just the information needed. +لاحظ أن عنوان URL الكامل (full URL) لـ GitHub الذي وضعناه هناك تم اختصاره (shortened) إلى المعلومات المطلوبة فقط. -Now if Tony goes back and closes out the original Pull Request, we can see that by mentioning it in the new one, GitHub has automatically created a trackback event in the Pull Request timeline. -This means that anyone who visits this Pull Request and sees that it is closed can easily link back to the one that superseded it. -The link will look something like <<_pr_closed>>. +الآن إذا عاد Tony وأغلق (closes out) طلب السحب الأصلي، يمكننا أن نرى أنه من خلال ذكره (mentioning it) في الطلب الجديد، قام GitHub تلقائياً بإنشاء حدث تتبع مسار (trackback event) في الجدول الزمني (timeline) لطلب السحب. +هذا يعني أن أي شخص يزور طلب السحب (Pull Request) هذا ويرى أنه مغلق يمكنه بسهولة الرجوع (link back) إلى الطلب الذي حله محله (superseded it). +سيبدو الرابط (link) كالتالي <<_pr_closed>>. [[_pr_closed]] -.Link back to the new Pull Request in the closed Pull Request timeline +.Link back to the new Pull Request in the closed Pull Request timeline (رابط العودة إلى طلب السحب الجديد في المخطط الزمني لطلب السحب المغلق) image::images/mentions-03-closed.png[Link back to the new Pull Request in the closed Pull Request timeline] -In addition to issue numbers, you can also reference a specific commit by SHA-1. -You have to specify a full 40 character SHA-1, but if GitHub sees that in a comment, it will link directly to the commit. -Again, you can reference commits in forks or other repositories in the same way you did with issues. +بالإضافة إلى أرقام المشكلات (issue numbers)، يمكنك أيضاً الرجوع (reference) إلى تأكيد معين (specific commit) بواسطة SHA-1. +يجب عليك تحديد 40 حرفاً (character) كاملة لـ SHA-1، ولكن إذا رأى GitHub ذلك في تعليق (comment)، فسيقوم بالربط (link) مباشرة إلى التأكيد. +مرة أخرى، يمكنك الرجوع (reference) إلى عمليات التأكيد (commits) في النسخ (forks) أو المستودعات (repositories) الأخرى بنفس الطريقة التي قمت بها مع المشكلات (issues). -==== GitHub Flavored Markdown +==== GitHub Flavored Markdown (تنسيق Markdown الخاص بـ GitHub) -Linking to other Issues is just the beginning of interesting things you can do with almost any text box on GitHub. -In Issue and Pull Request descriptions, comments, code comments and more, you can use what is called "`GitHub Flavored Markdown`". -Markdown is like writing in plain text but which is rendered richly. +الارتباط (Linking) بالمشكلات (Issues) الأخرى هو مجرد بداية للأشياء المثيرة للاهتمام التي يمكنك القيام بها باستخدام أي مربع نص (text box) تقريباً على GitHub. +في أوصاف (descriptions) المشكلات (Issue) وطلبات السحب (Pull Request)، والتعليقات (comments)، وتعليقات الكود (code comments) والمزيد، يمكنك استخدام ما يسمى "`GitHub Flavored Markdown`". +يشبه Markdown الكتابة بنص عادي (plain text) ولكن يتم عرضه بشكل غني (rendered richly). -See <<_example_markdown>> for an example of how comments or text can be written and then rendered using Markdown. +راجع <<_example_markdown>> للحصول على مثال لكيفية كتابة التعليقات أو النص (comments or text) ثم عرضها (rendered) باستخدام Markdown. [[_example_markdown]] -.An example of GitHub Flavored Markdown as written and as rendered +.An example of GitHub Flavored Markdown as written and as rendered (مثال على تنسيق Markdown الخاص بـ GitHub كما هو مكتوب وكما يتم عرضه) image::images/markdown-01-example.png[An example of GitHub Flavored Markdown as written and as rendered] -The GitHub flavor of Markdown adds more things you can do beyond the basic Markdown syntax. -These can all be really useful when creating useful Pull Request or Issue comments or descriptions. +يضيف نكهة GitHub لـ Markdown (GitHub flavor of Markdown) المزيد من الأشياء التي يمكنك القيام بها بخلاف بناء جملة Markdown الأساسي (basic Markdown syntax). +يمكن أن تكون جميعها مفيدة حقاً (really useful) عند إنشاء تعليقات أو أوصاف (comments or descriptions) مفيدة لطلب سحب (Pull Request) أو مشكلة (Issue). -===== Task Lists +===== Task Lists (قوائم المهام) -The first really useful GitHub specific Markdown feature, especially for use in Pull Requests, is the Task List. -A task list is a list of checkboxes of things you want to get done. -Putting them into an Issue or Pull Request normally indicates things that you want to get done before you consider the item complete. +أول ميزة Markdown خاصة (specific Markdown feature) بـ GitHub مفيدة حقاً، خاصة للاستخدام في طلبات السحب (Pull Requests)، هي قائمة المهام (Task List). +قائمة المهام هي قائمة بخانات اختيار (checkboxes) للأشياء التي تريد إنجازها. +عادةً ما يشير وضعها في مشكلة (Issue) أو طلب سحب (Pull Request) إلى الأشياء التي تريد إنجازها (get done) قبل أن تعتبر العنصر (item) مكتملاً. -You can create a task list like this: +يمكنك إنشاء قائمة مهام (task list) هكذا: [source,text] ---- @@ -365,33 +365,33 @@ You can create a task list like this: - [ ] Document the code ---- -If we include this in the description of our Pull Request or Issue, we'll see it rendered like <<_eg_task_lists>>. +إذا قمنا بتضمين (include) هذا في وصف (description) طلب السحب أو المشكلة (Pull Request or Issue) الخاص بنا، فسنرى أنه معروض (rendered) مثل <<_eg_task_lists>>. [[_eg_task_lists]] -.Task lists rendered in a Markdown comment +.Task lists rendered in a Markdown comment (عرض قوائم المهام في تعليق Markdown) image::images/markdown-02-tasks.png[Task lists rendered in a Markdown comment] -This is often used in Pull Requests to indicate what all you would like to get done on the branch before the Pull Request will be ready to merge. -The really cool part is that you can simply click the checkboxes to update the comment -- you don't have to edit the Markdown directly to check tasks off. +غالباً ما يتم استخدام هذا في طلبات السحب (Pull Requests) للإشارة إلى كل ما ترغب في إنجازه (get done) على الفرع قبل أن يكون طلب السحب جاهزاً للدمج (ready to merge). +الجزء الرائع (cool part) حقاً هو أنه يمكنك ببساطة النقر فوق خانات الاختيار (checkboxes) لتحديث التعليق (update the comment) -- لست مضطراً إلى تعديل (edit) Markdown مباشرة للتحقق من (check off) المهام. -What's more, GitHub will look for task lists in your Issues and Pull Requests and show them as metadata on the pages that list them out. -For example, if you have a Pull Request with tasks and you look at the overview page of all Pull Requests, you can see how far done it is. -This helps people break down Pull Requests into subtasks and helps other people track the progress of the branch. -You can see an example of this in <<_task_list_progress>>. +ما هو أكثر من ذلك، سيبحث GitHub عن قوائم المهام (task lists) في المشكلات (Issues) وطلبات السحب (Pull Requests) ويعرضها كبيانات وصفية (metadata) على الصفحات التي تسردها. +على سبيل المثال، إذا كان لديك طلب سحب (Pull Request) بمهام ونظرت إلى صفحة النظرة العامة (overview page) لجميع طلبات السحب، فيمكنك معرفة مدى الإنجاز. +يساعد هذا الأشخاص على تقسيم (break down) طلبات السحب إلى مهام فرعية (subtasks) ويساعد الأشخاص الآخرين على تتبع تقدم الفرع (track the progress of the branch). +يمكنك رؤية مثال (example) على ذلك في <<_task_list_progress>>. [[_task_list_progress]] -.Task list summary in the Pull Request list +.Task list summary in the Pull Request list (ملخص قائمة المهام في قائمة طلبات السحب) image::images/markdown-03-task-summary.png[Task list summary in the Pull Request list] -These are incredibly useful when you open a Pull Request early and use it to track your progress through the implementation of the feature. +تكون هذه الميزات مفيدة (useful) بشكل لا يصدق (incredibly) عندما تفتح طلب سحب مبكراً (early) وتستخدمه لتتبع تقدمك (track your progress) خلال تنفيذ (implementation) الميزة (feature). -===== Code Snippets +===== Code Snippets (مقتطفات التعليمات البرمجية) -You can also add code snippets to comments. -This is especially useful if you want to present something that you _could_ try to do before actually implementing it as a commit on your branch. -This is also often used to add example code of what is not working or what this Pull Request could implement. +يمكنك أيضاً إضافة مقتطفات من التعليمات البرمجية (code snippets) إلى التعليقات (comments). +هذا مفيد بشكل خاص إذا كنت تريد تقديم شيء _يمكنك (could)_ محاولة القيام به قبل تنفيذه فعلياً (actually implementing it) كتأكيد (commit) على فرعك. +غالباً ما يُستخدم هذا أيضاً لإضافة أمثلة تعليمات برمجية (example code) لما لا يعمل أو ما يمكن أن ينفذه (implement) طلب السحب (Pull Request) هذا. -To add a snippet of code you have to "`fence`" it in backticks. +لإضافة مقتطف من الكود (snippet of code) يجب عليك "`تسييجه`" ("`fence`") بعلامات اقتباس خلفية (backticks). [source,text] ---- @@ -403,20 +403,20 @@ for(int i=0 ; i < 5 ; i++) ``` ---- -If you add a language name like we did there with 'java', GitHub will also try to syntax highlight the snippet. -In the case of the above example, it would end up rendering like <<_md_code>>. +إذا أضفت اسم لغة (language name) كما فعلنا هناك مع 'java'، فسيحاول GitHub أيضاً تمييز بناء جملة (syntax highlight) المقتطف. +في حالة المثال أعلاه، سينتهي الأمر بعرضه (rendering) مثل <<_md_code>>. [[_md_code]] -.Rendered fenced code example +.Rendered fenced code example (مثال على كود مسيج معروض) image::images/markdown-04-fenced-code.png[Rendered fenced code example] -===== Quoting +===== Quoting (الاقتباس) -If you're responding to a small part of a long comment, you can selectively quote out of the other comment by preceding the lines with the `>` character. -In fact, this is so common and so useful that there is a keyboard shortcut for it. -If you highlight text in a comment that you want to directly reply to and hit the `r` key, it will quote that text in the comment box for you. +إذا كنت ترد (responding) على جزء صغير (small part) من تعليق طويل (long comment)، فيمكنك الاقتباس (quote) بشكل انتقائي (selectively) من التعليق الآخر (other comment) بسبق (preceding) الأسطر بالحرف `>`. +في الواقع، هذا أمر شائع جداً ومفيد جداً لدرجة أن هناك اختصاراً للوحة المفاتيح (keyboard shortcut) لذلك. +إذا قمت بتمييز (highlight) نص في تعليق (comment) تريد الرد عليه (reply to) مباشرة واضغط على المفتاح `r`، فسيقتبس (quote) ذلك النص في مربع التعليق نيابة عنك. -The quotes look something like this: +تبدو الاقتباسات (quotes) شيئاً من هذا القبيل: [source,text] ---- @@ -426,25 +426,25 @@ The quotes look something like this: How big are these slings and in particular, these arrows? ---- -Once rendered, the comment will look like <<_md_quote>>. +بمجرد عرضه (rendered)، سيبدو التعليق مثل <<_md_quote>>. [[_md_quote]] -.Rendered quoting example +.Rendered quoting example (مثال على اقتباس معروض) image::images/markdown-05-quote.png[Rendered quoting example] -===== Emoji +===== Emoji (الرموز التعبيرية) -Finally, you can also use emoji in your comments. -This is actually used quite extensively in comments you see on many GitHub Issues and Pull Requests. -There is even an emoji helper in GitHub. -If you are typing a comment and you start with a `:` character, an autocompleter will help you find what you're looking for. +أخيراً، يمكنك أيضاً استخدام الرموز التعبيرية (emoji) في تعليقاتك (comments). +في الواقع يُستخدم هذا بشكل مكثف (extensively) في التعليقات التي تراها في العديد من مشكلات (Issues) وطلبات سحب (Pull Requests) GitHub. +يوجد حتى مساعد الرموز التعبيرية (emoji helper) في GitHub. +إذا كنت تكتب تعليقاً وبدأت بحرف `:`، فسيساعدك المكمل التلقائي (autocompleter) في العثور على ما تبحث عنه. [[_md_emoji_auto]] -.Emoji autocompleter in action +.Emoji autocompleter in action (المكمل التلقائي للرموز التعبيرية قيد العمل) image::images/markdown-06-emoji-complete.png[Emoji autocompleter in action] -Emojis take the form of `::` anywhere in the comment. -For instance, you could write something like this: +تأخذ الرموز التعبيرية (Emojis) شكل `::` في أي مكان في التعليق. +على سبيل المثال، يمكنك كتابة شيء كهذا: [source,text] ---- @@ -457,50 +457,50 @@ I :eyes: that :bug: and I :cold_sweat:. :clap::tada::panda_face: ---- -When rendered, it would look something like <<_md_emoji>>. +عندما يتم عرضه (rendered)، سيبدو شيئاً مثل <<_md_emoji>>. [[_md_emoji]] -.Heavy emoji commenting +.Heavy emoji commenting (التعليق المكثف بالرموز التعبيرية) image::images/markdown-07-emoji.png[Heavy emoji commenting] -Not that this is incredibly useful, but it does add an element of fun and emotion to a medium that is otherwise hard to convey emotion in. +ليس هذا مفيداً بشكل لا يصدق، ولكنه يضيف عنصر المرح والعاطفة (fun and emotion) إلى وسيط (medium) يصعب نقل العاطفة (convey emotion) فيه. [NOTE] ==== -There are actually quite a number of web services that make use of emoji characters these days. -A great cheat sheet to reference to find emoji that expresses what you want to say can be found at: +يوجد في الواقع عدد غير قليل من خدمات الويب (web services) التي تستفيد من أحرف الرموز التعبيرية (emoji characters) هذه الأيام. +يمكن العثور على ورقة غش (cheat sheet) رائعة للرجوع إليها (reference) للعثور على رموز تعبيرية تعبر عما تريد قوله على: https://www.webfx.com/tools/emoji-cheat-sheet/[^] ==== -===== Images +===== Images (الصور) -This isn't technically GitHub Flavored Markdown, but it is incredibly useful. -In addition to adding Markdown image links to comments, which can be difficult to find and embed URLs for, GitHub allows you to drag and drop images into text areas to embed them. +هذا ليس من الناحية الفنية (technically) نكهة GitHub الخاصة بـ Markdown (GitHub Flavored Markdown)، ولكنه مفيد بشكل لا يصدق (incredibly useful). +بالإضافة إلى إضافة روابط صور (image links) Markdown إلى التعليقات (comments)، والتي قد يكون من الصعب العثور على عناوين URL الخاصة بها وتضمينها (embed URLs)، يتيح لك GitHub سحب الصور وإفلاتها (drag and drop images) في مناطق النص (text areas) لتضمينها (embed them). [[_md_drag]] -.Drag and drop images to upload them and auto-embed them +.Drag and drop images to upload them and auto-embed them (اسحب الصور وأفلتها لتحميلها وتضمينها تلقائياً) image::images/markdown-08-drag-drop.png[Drag and drop images to upload them and auto-embed them] -If you look at <<_md_drag>>, you can see a small "`Parsed as Markdown`" hint above the text area. -Clicking on that will give you a full cheat sheet of everything you can do with Markdown on GitHub. +إذا نظرت إلى <<_md_drag>>، يمكنك رؤية تلميح (hint) صغير "`تم تحليله كـ Markdown`" ("`Parsed as Markdown`") فوق منطقة النص. +النقر على ذلك سيعطيك ورقة غش (cheat sheet) كاملة لكل ما يمكنك القيام به باستخدام Markdown على GitHub. [[_fetch_and_push_on_different_repositories]] -==== Keep your GitHub public repository up-to-date +==== Keep your GitHub public repository up-to-date (حافظ على تحديث مستودع GitHub العام الخاص بك) -Once you've forked a GitHub repository, your repository (your "fork") exists independently from the original. -In particular, when the original repository has new commits, GitHub informs you by a message like: +بمجرد نسخ (forked) مستودع (repository) GitHub، فإن مستودعك (نسختك - your "fork") موجود بشكل مستقل (independently) عن الأصل (original). +على وجه الخصوص، عندما يكون للمستودع الأصلي عمليات تأكيد (commits) جديدة، يعلمك (informs) GitHub برسالة (message) مثل: [source,text] ---- This branch is 5 commits behind progit:master. ---- -But your GitHub repository will never be automatically updated by GitHub; this is something that you must do yourself. -Fortunately, this is very easy to do. +لكن مستودع GitHub الخاص بك لن يتم تحديثه (updated) تلقائياً (automatically) بواسطة GitHub أبداً؛ هذا شيء يجب أن تفعله بنفسك. +لحسن الحظ، هذا سهل جداً للقيام به. -One possibility to do this requires no configuration. -For example, if you forked from `https://github.com/progit/progit2.git`, you can keep your `master` branch up-to-date like this: +أحد الاحتمالات (possibility) للقيام بذلك لا يتطلب أي تكوين (configuration). +على سبيل المثال، إذا نسخت (forked) من `https://github.com/progit/progit2.git`، يمكنك إبقاء فرع `master` الخاص بك محدثاً (up-to-date) هكذا: [source,console] ---- @@ -509,12 +509,12 @@ $ git pull https://github.com/progit/progit2.git <2> $ git push origin master <3> ---- -<1> If you were on another branch, return to `master`. -<2> Fetch changes from `https://github.com/progit/progit2.git` and merge them into `master`. -<3> Push your `master` branch to `origin`. +<1> إذا كنت على فرع آخر (another branch)، ارجع إلى `master`. +<2> اجلب التغييرات (Fetch changes) من `https://github.com/progit/progit2.git` وادمجها (merge them) في `master`. +<3> ادفع (Push) فرع `master` الخاص بك إلى `origin`. -This works, but it is a little tedious having to spell out the fetch URL every time. -You can automate this work with a bit of configuration: +هذا يعمل، ولكنه ممل (tedious) بعض الشيء أن تضطر إلى كتابة عنوان URL (spell out the fetch URL) للجلب في كل مرة. +يمكنك أتمتة (automate) هذا العمل بقليل من التكوين (configuration): [source,console] ---- @@ -524,13 +524,13 @@ $ git branch --set-upstream-to=progit/master master <3> $ git config --local remote.pushDefault origin <4> ---- -<1> Add the source repository and give it a name. - Here, I have chosen to call it `progit`. -<2> Get a reference on progit's branches, in particular `master`. -<3> Set your `master` branch to fetch from the `progit` remote. -<4> Define the default push repository to `origin`. +<1> أضف المستودع المصدر (source repository) وقم بتسميته. + هنا، اخترت أن أسميه `progit`. +<2> احصل على مرجع (reference) على فروع progit، لا سيما `master`. +<3> عيّن (Set) فرع `master` الخاص بك للجلب من جهاز `progit` البعيد (remote). +<4> حدد مستودع الدفع الافتراضي (default push repository) إلى `origin`. -Once this is done, the workflow becomes much simpler: +بمجرد الانتهاء من ذلك، يصبح سير العمل (workflow) أبسط بكثير: [source,console] ---- @@ -539,10 +539,10 @@ $ git pull <2> $ git push <3> ---- -<1> If you were on another branch, return to `master`. -<2> Fetch changes from `progit` and merge changes into `master`. -<3> Push your `master` branch to `origin`. +<1> إذا كنت على فرع آخر، ارجع إلى `master`. +<2> اجلب (Fetch) التغييرات من `progit` وادمج التغييرات (merge changes) في `master`. +<3> ادفع (Push) فرع `master` الخاص بك إلى `origin`. -This approach can be useful, but it's not without downsides. -Git will happily do this work for you silently, but it won't warn you if you make a commit to `master`, pull from `progit`, then push to `origin` -- all of those operations are valid with this setup. -So you'll have to take care never to commit directly to `master`, since that branch effectively belongs to the upstream repository. +يمكن أن يكون هذا النهج (approach) مفيداً، ولكنه لا يخلو من الجوانب السلبية (downsides). +سيقوم Git بهذا العمل نيابة عنك بصمت (silently)، ولكنه لن يحذرك إذا قمت بإجراء تأكيد (commit) لـ `master`، وسحبت (pull) من `progit`، ثم دفعت (push) إلى `origin` -- كل هذه العمليات (operations) صالحة (valid) مع هذا الإعداد (setup). +لذلك سيتعين عليك توخي الحذر (take care) لعدم التأكيد المباشر (commit directly) إلى `master` أبداً، لأن ذلك الفرع ينتمي فعلياً إلى مستودع المنبع (upstream repository). diff --git a/book/06-github/sections/3-maintaining.asc b/book/06-github/sections/3-maintaining.asc index 2505e86a6..a4365807f 100644 --- a/book/06-github/sections/3-maintaining.asc +++ b/book/06-github/sections/3-maintaining.asc @@ -1,134 +1,134 @@ [[_maintaining_gh_project]] -=== Maintaining a Project +=== Maintaining a Project (صيانة مشروع) -Now that we're comfortable contributing to a project, let's look at the other side: creating, maintaining and administering your own project. +الآن بعد أن أصبحنا مرتاحين (comfortable) للمساهمة (contributing) في مشروع، لنلقِ نظرة على الجانب الآخر: إنشاء مشروعك الخاص وصيانته وإدارته (creating, maintaining and administering). -==== Creating a New Repository +==== Creating a New Repository (إنشاء مستودع جديد) -Let's create a new repository to share our project code with. -Start by clicking the "`New repository`" button on the right-hand side of the dashboard, or from the `+` button in the top toolbar next to your username as seen in <<_new_repo_dropdown>>. +دعنا ننشئ مستودعاً (repository) جديداً لمشاركة كود (code) مشروعنا معه. +ابدأ بالنقر على زر "`New repository`" (مستودع جديد) على الجانب الأيمن من لوحة التحكم (dashboard)، أو من الزر `+` في شريط الأدوات (toolbar) العلوي بجوار اسم المستخدم (username) الخاص بك كما يظهر في <<_new_repo_dropdown>>. -.The "`Your repositories`" area +.The "`Your repositories`" area (منطقة "`مستودعاتك`") image::images/newrepo.png[The “Your repositories” area] [[_new_repo_dropdown]] -.The "`New repository`" dropdown +.The "`New repository`" dropdown (القائمة المنسدلة "`مستودع جديد`") image::images/new-repo.png[The “New repository” dropdown] -This takes you to the "`new repository`" form: +يأخذك هذا إلى نموذج (form) "`new repository`" (مستودع جديد): -.The "`new repository`" form +.The "`new repository`" form (نموذج "`مستودع جديد`") image::images/newrepoform.png[The “new repository” form] -All you really have to do here is provide a project name; the rest of the fields are completely optional. -For now, just click the "`Create Repository`" button, and boom -- you have a new repository on GitHub, named `/`. +كل ما عليك فعله هنا حقاً هو توفير اسم للمشروع (project name)؛ بقية الحقول اختيارية (optional) تماماً. +في الوقت الحالي، ما عليك سوى النقر فوق الزر "`Create Repository`" (إنشاء مستودع)، وبوم -- لديك مستودع جديد على GitHub، باسم `/`. -Since you have no code there yet, GitHub will show you instructions for how to create a brand-new Git repository, or connect an existing Git project. -We won't belabor this here; if you need a refresher, check out <>. +نظراً لعدم وجود كود (code) لديك هناك بعد، سيعرض لك GitHub إرشادات (instructions) حول كيفية إنشاء مستودع Git (Git repository) جديد تماماً، أو توصيل (connect) مشروع Git موجود (existing Git project). +لن نطيل (belabor) في هذا هنا؛ إذا كنت بحاجة إلى تنشيط ذاكرتك (refresher)، فراجع <>. -Now that your project is hosted on GitHub, you can give the URL to anyone you want to share your project with. -Every project on GitHub is accessible over HTTPS as `\https://github.com//`, and over SSH as `\git@github.com:/`. -Git can fetch from and push to both of these URLs, but they are access-controlled based on the credentials of the user connecting to them. +الآن وقد تمت استضافة (hosted) مشروعك على GitHub، يمكنك إعطاء عنوان URL لأي شخص تريد مشاركة (share) مشروعك معه. +يمكن الوصول إلى كل مشروع على GitHub عبر HTTPS كـ `\https://github.com//`، وعبر SSH كـ `\git@github.com:/`. +يمكن لـ Git الجلب من (fetch from) كلا عنواني URL هذين والدفع إليهما (push to)، ولكن يتم التحكم في الوصول إليهما (access-controlled) بناءً على بيانات اعتماد (credentials) المستخدم الذي يتصل بهما. [NOTE] ==== -It is often preferable to share the HTTPS based URL for a public project, since the user does not have to have a GitHub account to access it for cloning. -Users will have to have an account and an uploaded SSH key to access your project if you give them the SSH URL. -The HTTPS one is also exactly the same URL they would paste into a browser to view the project there. +غالباً ما يكون من الأفضل مشاركة (share) عنوان URL المستند إلى HTTPS لمشروع عام (public project)، نظراً لأن المستخدم لا يحتاج إلى حساب GitHub للوصول إليه للاستنساخ (cloning). +سيتعين على المستخدمين امتلاك حساب ومفتاح SSH (SSH key) محمل للوصول إلى مشروعك إذا أعطيتهم عنوان URL لـ SSH. +عنوان HTTPS هو أيضاً نفس عنوان URL الذي سيلصقونه (paste) في متصفح (browser) لعرض المشروع هناك. ==== -==== Adding Collaborators +==== Adding Collaborators (إضافة متعاونين) -If you're working with other people who you want to give commit access to, you need to add them as "`collaborators`". -If Ben, Jeff, and Louise all sign up for accounts on GitHub, and you want to give them push access to your repository, you can add them to your project. -Doing so will give them "`push`" access, which means they have both read and write access to the project and Git repository. +إذا كنت تعمل مع أشخاص آخرين تريد منحهم وصول تأكيد (commit access)، فأنت بحاجة إلى إضافتهم كـ "`متعاونين`" ("`collaborators`"). +إذا قام كل من Ben و Jeff و Louise بالتسجيل للحصول على حسابات (accounts) على GitHub، وكنت تريد منحهم وصول دفع (push access) إلى مستودعك، فيمكنك إضافتهم إلى مشروعك. +سيؤدي القيام بذلك إلى منحهم وصول "`دفع`" ("`push`" access)، مما يعني أن لديهم وصول قراءة وكتابة (read and write access) إلى المشروع ومستودع Git (Git repository). -Click the "`Settings`" link at the bottom of the right-hand sidebar. +انقر على رابط "`Settings`" (الإعدادات) في أسفل الشريط الجانبي (sidebar) الأيمن. -.The repository settings link +.The repository settings link (رابط إعدادات المستودع) image::images/reposettingslink.png[The repository settings link] -Then select "`Collaborators`" from the menu on the left-hand side. -Then, just type a username into the box, and click "`Add collaborator.`" -You can repeat this as many times as you like to grant access to everyone you like. -If you need to revoke access, just click the "`X`" on the right-hand side of their row. +ثم حدد "`Collaborators`" (المتعاونون) من القائمة الموجودة على الجانب الأيسر. +بعد ذلك، ما عليك سوى كتابة اسم مستخدم (username) في المربع، والنقر على "`Add collaborator.`" (إضافة متعاون). +يمكنك تكرار ذلك عدة مرات كما تريد لمنح الوصول (grant access) لكل من تريد. +إذا كنت بحاجة إلى إبطال الوصول (revoke access)، فما عليك سوى النقر على "`X`" على الجانب الأيمن من صفهم (row). -.The repository collaborators box +.The repository collaborators box (مربع متعاوني المستودع) image::images/collaborators.png[The repository collaborators box] -==== Managing Pull Requests +==== Managing Pull Requests (إدارة طلبات السحب) -Now that you have a project with some code in it and maybe even a few collaborators who also have push access, let's go over what to do when you get a Pull Request yourself. +الآن بعد أن أصبح لديك مشروع يحتوي على بعض التعليمات البرمجية (code) فيه وربما حتى عدد قليل من المتعاونين (collaborators) الذين لديهم أيضاً وصول دفع (push access)، دعنا نستعرض ما يجب فعله عندما تتلقى طلب سحب (Pull Request) بنفسك. -Pull Requests can either come from a branch in a fork of your repository or they can come from another branch in the same repository. -The only difference is that the ones in a fork are often from people where you can't push to their branch and they can't push to yours, whereas with internal Pull Requests generally both parties can access the branch. +يمكن أن تأتي طلبات السحب (Pull Requests) إما من فرع في نسخة (fork) من مستودعك (repository) أو يمكن أن تأتي من فرع آخر في نفس المستودع. +الفرق (difference) الوحيد هو أن تلك الموجودة في نسخة (fork) غالباً ما تكون من أشخاص لا يمكنك الدفع (push) إلى فرعهم ولا يمكنهم الدفع إلى فرعك، في حين أنه مع طلبات السحب الداخلية (internal Pull Requests) يمكن لكلا الطرفين (both parties) الوصول إلى الفرع بشكل عام. -For these examples, let's assume you are "`tonychacon`" and you've created a new Arduino code project named "`fade`". +بالنسبة لهذه الأمثلة، لنفترض أنك "`tonychacon`" وأنك أنشأت مشروع كود Arduino (Arduino code project) جديداً يسمى "`fade`". [[_email_notifications]] -===== Email Notifications +===== Email Notifications (إشعارات البريد الإلكتروني) -Someone comes along and makes a change to your code and sends you a Pull Request. -You should get an email notifying you about the new Pull Request and it should look something like <<_email_pr>>. +يأتي شخص ما ويجري تغييراً (change) على الكود الخاص بك ويرسل لك طلب سحب (Pull Request). +يجب أن تتلقى رسالة بريد إلكتروني (email) تعلمك (notifying) بطلب السحب الجديد ويجب أن تبدو مثل <<_email_pr>>. [[_email_pr]] -.Email notification of a new Pull Request +.Email notification of a new Pull Request (إشعار بريد إلكتروني بطلب سحب جديد) image::images/maint-01-email.png[Email notification of a new Pull Request] -There are a few things to notice about this email. -It will give you a small diffstat -- a list of files that have changed in the Pull Request and by how much. -It gives you a link to the Pull Request on GitHub. -It also gives you a few URLs that you can use from the command line. +هناك بعض الأشياء التي يجب ملاحظتها (notice) حول هذا البريد الإلكتروني. +سيعطيك إحصائية فرق (diffstat) صغيرة -- قائمة بالملفات (files) التي تغيرت (changed) في طلب السحب ومقدار التغيير. +يمنحك رابطاً (link) إلى طلب السحب (Pull Request) على GitHub. +كما يوفر لك بعض عناوين URL التي يمكنك استخدامها من سطر الأوامر (command line). -If you notice the line that says `git pull patch-1`, this is a simple way to merge in a remote branch without having to add a remote. -We went over this quickly in <>. -If you wish, you can create and switch to a topic branch and then run this command to merge in the Pull Request changes. +إذا لاحظت السطر الذي يقول `git pull patch-1`، فهذه طريقة بسيطة لدمج (merge) فرع بعيد (remote branch) دون الحاجة إلى إضافة جهاز تحكم عن بعد (remote). +لقد مررنا بهذا بسرعة في <>. +إذا كنت ترغب في ذلك، يمكنك إنشاء فرع موضوع (topic branch) والتبديل إليه ثم تشغيل هذا الأمر لدمج تغييرات طلب السحب (Pull Request changes). -The other interesting URLs are the `.diff` and `.patch` URLs, which as you may guess, provide unified diff and patch versions of the Pull Request. -You could technically merge in the Pull Request work with something like this: +عناوين URL الأخرى المثيرة للاهتمام هي عناوين URL لـ `.diff` و `.patch`، والتي كما قد تخمن، توفر إصدارات (versions) فرق موحد (unified diff) وتصحيح (patch) من طلب السحب. +يمكنك من الناحية الفنية (technically) دمج عمل طلب السحب (Pull Request work) بشيء من هذا القبيل: [source,console] ---- $ curl https://github.com/tonychacon/fade/pull/1.patch | git am ---- -===== Collaborating on the Pull Request +===== Collaborating on the Pull Request (التعاون في طلب السحب) -As we covered in <>, you can now have a conversation with the person who opened the Pull Request. -You can comment on specific lines of code, comment on whole commits or comment on the entire Pull Request itself, using GitHub Flavored Markdown everywhere. +كما غطينا في <>، يمكنك الآن إجراء محادثة (conversation) مع الشخص الذي فتح طلب السحب (Pull Request). +يمكنك التعليق (comment) على أسطر معينة من الكود، أو التعليق على عمليات تأكيد (commits) كاملة أو التعليق على طلب السحب بأكمله نفسه، باستخدام نكهة GitHub لـ Markdown (GitHub Flavored Markdown) في كل مكان. -Every time someone else comments on the Pull Request you will continue to get email notifications so you know there is activity happening. -They will each have a link to the Pull Request where the activity is happening and you can also directly respond to the email to comment on the Pull Request thread. +في كل مرة يعلق فيها شخص آخر على طلب السحب، ستستمر في تلقي إشعارات عبر البريد الإلكتروني (email notifications) حتى تعرف أن هناك نشاطاً (activity) يحدث. +سيحتوي كل منها على رابط إلى طلب السحب حيث يحدث النشاط ويمكنك أيضاً الرد مباشرة (directly respond) على البريد الإلكتروني للتعليق على سلسلة (thread) طلب السحب. -.Responses to emails are included in the thread +.Responses to emails are included in the thread (يتم تضمين الردود على رسائل البريد الإلكتروني في السلسلة) image::images/maint-03-email-resp.png[Responses to emails are included in the thread] -Once the code is in a place you like and want to merge it in, you can either pull the code down and merge it locally, either with the `git pull ` syntax we saw earlier, or by adding the fork as a remote and fetching and merging. +بمجرد أن يصبح الكود (code) في مكان يعجبك وتريد دمجه (merge it in)، يمكنك إما سحب الكود لأسفل (pull the code down) ودمجه محلياً (merge it locally)، إما باستخدام بناء الجملة (syntax) `git pull ` الذي رأيناه سابقاً، أو عن طريق إضافة النسخة (fork) كجهاز تحكم عن بعد (remote) والجلب والدمج (fetching and merging). -If the merge is trivial, you can also just hit the "`Merge`" button on the GitHub site. -This will do a "`non-fast-forward`" merge, creating a merge commit even if a fast-forward merge was possible. -This means that no matter what, every time you hit the merge button, a merge commit is created. -As you can see in <<_merge_button>>, GitHub gives you all of this information if you click the hint link. +إذا كان الدمج بسيطاً (trivial)، فيمكنك أيضاً الضغط على زر "`Merge`" (دمج) على موقع GitHub. +سيؤدي هذا إلى إجراء دمج "`غير سريع`" ("`non-fast-forward`" merge)، مما يؤدي إلى إنشاء تأكيد دمج (merge commit) حتى لو كان الدمج السريع (fast-forward merge) ممكناً. +هذا يعني أنه بغض النظر عن أي شيء، في كل مرة تضغط فيها على زر الدمج (merge button)، يتم إنشاء تأكيد دمج (merge commit). +كما ترى في <<_merge_button>>، يمنحك GitHub كل هذه المعلومات إذا نقرت على رابط التلميح (hint link). [[_merge_button]] -.Merge button and instructions for merging a Pull Request manually +.Merge button and instructions for merging a Pull Request manually (زر الدمج وإرشادات دمج طلب سحب يدوياً) image::images/maint-02-merge.png[Merge button and instructions for merging a Pull Request manually] -If you decide you don't want to merge it, you can also just close the Pull Request and the person who opened it will be notified. +إذا قررت أنك لا تريد دمجه (merge it)، يمكنك أيضاً إغلاق (close) طلب السحب (Pull Request) وسيتم إعلام الشخص الذي فتحه. [[_pr_refs]] -===== Pull Request Refs +===== Pull Request Refs (مراجع طلب السحب) -If you're dealing with a *lot* of Pull Requests and don't want to add a bunch of remotes or do one time pulls every time, there is a neat trick that GitHub allows you to do. -This is a bit of an advanced trick and we'll go over the details of this a bit more in <>, but it can be pretty useful. +إذا كنت تتعامل مع *الكثير* من طلبات السحب (Pull Requests) ولا ترغب في إضافة مجموعة من الأجهزة البعيدة (remotes) أو القيام بعمليات سحب لمرة واحدة (one time pulls) في كل مرة، فهناك حيلة (trick) أنيقة يسمح لك GitHub بالقيام بها. +هذه خدعة متقدمة (advanced trick) بعض الشيء وسنستعرض تفاصيل هذا أكثر قليلاً في <>، لكنها قد تكون مفيدة جداً. -GitHub actually advertises the Pull Request branches for a repository as sort of pseudo-branches on the server. -By default you don't get them when you clone, but they are there in an obscured way and you can access them pretty easily. +يعلن (advertises) GitHub في الواقع عن فروع طلب السحب (Pull Request branches) لمستودع كنوع من الفروع الوهمية (pseudo-branches) على الخادم (server). +افتراضياً (By default) لا تحصل عليها عند الاستنساخ (clone)، لكنها موجودة بطريقة غامضة (obscured way) ويمكنك الوصول إليها بسهولة تامة. -To demonstrate this, we're going to use a low-level command (often referred to as a "`plumbing`" command, which we'll read about more in <>) called `ls-remote`. -This command is generally not used in day-to-day Git operations but it's useful to show us what references are present on the server. +لإثبات ذلك، سنستخدم أمراً منخفض المستوى (low-level command) (يشار إليه غالباً باسم أمر "`سباكة`" ("`plumbing`" command)، والذي سنقرأ عنه المزيد في <>) يسمى `ls-remote`. +لا يُستخدم هذا الأمر (command) بشكل عام في عمليات Git اليومية ولكنه مفيد لتوضيح المراجع (references) الموجودة على الخادم (server). -If we run this command against the "`blink`" repository we were using earlier, we will get a list of all the branches and tags and other references in the repository. +إذا قمنا بتشغيل هذا الأمر ضد مستودع "`blink`" الذي كنا نستخدمه سابقاً، فسنحصل على قائمة بجميع الفروع (branches) والعلامات (tags) والمراجع الأخرى في المستودع (repository). [source,console] ---- @@ -143,16 +143,16 @@ a5a7751a33b7e86c5e9bb07b26001bb17d775d1a refs/pull/4/head 31a45fc257e8433c8d8804e3e848cf61c9d3166c refs/pull/4/merge ---- -Of course, if you're in your repository and you run `git ls-remote origin` or whatever remote you want to check, it will show you something similar to this. +بالطبع، إذا كنت في مستودعك وقمت بتشغيل `git ls-remote origin` أو أي جهاز تحكم عن بعد (remote) تريد التحقق منه، فسيظهر لك شيء مشابه لهذا. -If the repository is on GitHub and you have any Pull Requests that have been opened, you'll get these references that are prefixed with `refs/pull/`. -These are basically branches, but since they're not under `refs/heads/` you don't get them normally when you clone or fetch from the server -- the process of fetching ignores them normally. +إذا كان المستودع موجوداً على GitHub وكان لديك أي طلبات سحب (Pull Requests) تم فتحها، فستحصل على هذه المراجع المسبوقة (prefixed) بـ `refs/pull/`. +هذه في الأساس فروع (branches)، ولكن نظراً لأنها ليست تحت `refs/heads/` فلن تحصل عليها بشكل طبيعي عند الاستنساخ (clone) أو الجلب (fetch) من الخادم -- عملية الجلب تتجاهلها عادةً. -There are two references per Pull Request - the one that ends in `/head` points to exactly the same commit as the last commit in the Pull Request branch. -So if someone opens a Pull Request in our repository and their branch is named `bug-fix` and it points to commit `a5a775`, then in *our* repository we will not have a `bug-fix` branch (since that's in their fork), but we _will_ have `pull//head` that points to `a5a775`. -This means that we can pretty easily pull down every Pull Request branch in one go without having to add a bunch of remotes. +هناك مرجعان لكل طلب سحب - المرجع الذي ينتهي بـ `/head` يشير إلى نفس التأكيد (commit) تماماً مثل التأكيد الأخير في فرع طلب السحب. +لذلك إذا فتح شخص ما طلب سحب في مستودعنا وكان اسم فرعه هو `bug-fix` ويشير إلى التأكيد `a5a775`، فلن يكون لدينا فرع `bug-fix` في مستودعنا (نظراً لأن ذلك موجود في نسخته (fork) الخاصة به)، ولكن _سيكون_ لدينا `pull//head` يشير إلى `a5a775`. +هذا يعني أنه يمكننا سحب كل فرع من فروع طلب السحب بسهولة تامة دفعة واحدة (in one go) دون الحاجة إلى إضافة مجموعة من الأجهزة البعيدة (remotes). -Now, you could do something like fetching the reference directly. +الآن، يمكنك القيام بشيء مثل جلب المرجع (fetching the reference) مباشرة (directly). [source,console] ---- @@ -161,14 +161,14 @@ From https://github.com/libgit2/libgit2 * branch refs/pull/958/head -> FETCH_HEAD ---- -This tells Git, "`Connect to the `origin` remote, and download the ref named `refs/pull/958/head`.`" -Git happily obeys, and downloads everything you need to construct that ref, and puts a pointer to the commit you want under `.git/FETCH_HEAD`. -You can follow that up with `git merge FETCH_HEAD` into a branch you want to test it in, but that merge commit message looks a bit weird. -Also, if you're reviewing a *lot* of pull requests, this gets tedious. +يخبر هذا Git، "`اتصل بجهاز التحكم عن بعد (remote)`origin`، وقم بتنزيل المرجع (ref) المسمى`refs/pull/958/head`.`" +يطيع Git بسعادة، ويقوم بتنزيل (downloads) كل ما تحتاجه لبناء ذلك المرجع (construct that ref)، ويضع مؤشراً (pointer) إلى التأكيد الذي تريده تحت `.git/FETCH_HEAD`. +يمكنك متابعة ذلك باستخدام `git merge FETCH_HEAD` في فرع تريد اختباره فيه، ولكن رسالة تأكيد الدمج (merge commit message) هذه تبدو غريبة بعض الشيء. +أيضاً، إذا كنت تراجع (reviewing) *الكثير* من طلبات السحب، فسيصبح هذا مملاً (tedious). -There's also a way to fetch _all_ of the pull requests, and keep them up to date whenever you connect to the remote. -Open up `.git/config` in your favorite editor, and look for the `origin` remote. -It should look a bit like this: +هناك أيضاً طريقة لجلب (fetch) _جميع_ طلبات السحب، وإبقائها محدثة (up to date) كلما اتصلت بجهاز التحكم عن بعد (remote). +افتح `.git/config` في محررك المفضل (favorite editor)، وابحث عن جهاز التحكم عن بعد `origin`. +يجب أن يبدو هكذا تقريباً: [source,ini] ---- @@ -177,10 +177,10 @@ It should look a bit like this: fetch = +refs/heads/*:refs/remotes/origin/* ---- -That line that begins with `fetch =` is a "`refspec.`" -It's a way of mapping names on the remote with names in your local `.git` directory. -This particular one tells Git, "the things on the remote that are under `refs/heads` should go in my local repository under `refs/remotes/origin`." -You can modify this section to add another refspec: +السطر الذي يبدأ بـ `fetch =` هو "`مواصفات مرجع`" ("`refspec`"). +إنها طريقة لتعيين (mapping) الأسماء الموجودة على جهاز التحكم عن بعد بالأسماء الموجودة في دليلك المحلي (local `.git` directory) `.git`. +يخبر هذا الجهاز تحديداً Git، "الأشياء الموجودة على جهاز التحكم عن بعد والموجودة ضمن `refs/heads` يجب أن تذهب إلى مستودعي المحلي ضمن `refs/remotes/origin`." +يمكنك تعديل هذا القسم (modify this section) لإضافة مواصفات مرجع (refspec) أخرى: [source,ini] ---- @@ -190,8 +190,8 @@ You can modify this section to add another refspec: fetch = +refs/pull/*/head:refs/remotes/origin/pr/* ---- -That last line tells Git, "`All the refs that look like `refs/pull/123/head` should be stored locally like `refs/remotes/origin/pr/123`.`" -Now, if you save that file, and do a `git fetch`: +يخبر السطر الأخير Git، "`يجب تخزين جميع المراجع (refs) التي تشبه `refs/pull/123/head` محلياً مثل `refs/remotes/origin/pr/123`.`" +الآن، إذا قمت بحفظ هذا الملف، وقمت بـ `git fetch`: [source,console] ---- @@ -203,8 +203,8 @@ $ git fetch # … ---- -Now all of the remote pull requests are represented locally with refs that act much like tracking branches; they're read-only, and they update when you do a fetch. -This makes it super easy to try the code from a pull request locally: +يتم الآن تمثيل (represented) جميع طلبات السحب عن بعد (remote pull requests) محلياً من خلال مراجع (refs) تعمل مثل فروع التتبع (tracking branches) إلى حد كبير؛ فهي للقراءة فقط (read-only)، ويتم تحديثها عندما تقوم بالجلب (fetch). +هذا يجعل من السهل جداً تجربة الكود (try the code) من طلب سحب محلياً: [source,console] ---- @@ -214,85 +214,85 @@ Branch pr/2 set up to track remote branch pr/2 from origin. Switched to a new branch 'pr/2' ---- -The eagle-eyed among you would note the `head` on the end of the remote portion of the refspec. -There's also a `refs/pull/#/merge` ref on the GitHub side, which represents the commit that would result if you push the "`merge`" button on the site. -This can allow you to test the merge before even hitting the button. +سيلاحظ أصحاب النظرة الثاقبة منكم الـ `head` في نهاية الجزء البعيد من مواصفات المرجع (refspec). +هناك أيضاً مرجع `refs/pull/#/merge` على جانب GitHub، والذي يمثل التأكيد (commit) الذي سينتج إذا ضغطت على زر "`merge`" (دمج) في الموقع. +يمكن أن يسمح لك هذا باختبار (test) الدمج قبل الضغط على الزر. -===== Pull Requests on Pull Requests +===== Pull Requests on Pull Requests (طلبات سحب على طلبات سحب) -Not only can you open Pull Requests that target the main or `master` branch, you can actually open a Pull Request targeting any branch in the network. -In fact, you can even target another Pull Request. +لا يقتصر الأمر على إمكانية فتح طلبات سحب (Pull Requests) تستهدف الفرع الرئيسي أو `master`، بل يمكنك في الواقع فتح طلب سحب يستهدف أي فرع (any branch) في الشبكة. +في الواقع، يمكنك حتى استهداف طلب سحب آخر. -If you see a Pull Request that is moving in the right direction and you have an idea for a change that depends on it or you're not sure is a good idea, or you just don't have push access to the target branch, you can open a Pull Request directly to it. +إذا رأيت طلب سحب يسير في الاتجاه الصحيح وكانت لديك فكرة لتغيير يعتمد عليه أو لم تكن متأكداً من أنها فكرة جيدة، أو لم يكن لديك ببساطة وصول دفع (push access) إلى الفرع الهدف (target branch)، يمكنك فتح طلب سحب (Pull Request) إليه مباشرة. -When you go to open a Pull Request, there is a box at the top of the page that specifies which branch you're requesting to pull to and which you're requesting to pull from. -If you hit the "`Edit`" button at the right of that box you can change not only the branches but also which fork. +عندما تذهب لفتح طلب سحب، يوجد مربع (box) في أعلى الصفحة يحدد الفرع الذي تطلب السحب إليه والفرع الذي تطلب السحب منه. +إذا ضغطت على زر "`Edit`" (تحرير) على يمين ذلك المربع، فلن تتمكن من تغيير الفروع فحسب، بل وأيضاً أي نسخة (fork). [[_pr_targets]] -.Manually change the Pull Request target fork and branch +.Manually change the Pull Request target fork and branch (تغيير النسخة الهدف لطلب السحب والفرع يدوياً) image::images/maint-04-target.png[Manually change the Pull Request target fork and branch] -Here you can fairly easily specify to merge your new branch into another Pull Request or another fork of the project. +هنا يمكنك بسهولة تحديد دمج فرعك الجديد (new branch) في طلب سحب آخر أو نسخة (fork) أخرى من المشروع. -==== Mentions and Notifications +==== Mentions and Notifications (الإشارات والإشعارات) -GitHub also has a pretty nice notifications system built in that can come in handy when you have questions or need feedback from specific individuals or teams. +يحتوي GitHub أيضاً على نظام إشعارات (notifications system) رائع مدمج يمكن أن يكون مفيداً عندما تكون لديك أسئلة (questions) أو تحتاج إلى تعليقات (feedback) من أفراد (individuals) أو فرق معينة. -In any comment you can start typing a `@` character and it will begin to autocomplete with the names and usernames of people who are collaborators or contributors in the project. +في أي تعليق (comment) يمكنك البدء في كتابة الحرف `@` وسيبدأ في الإكمال التلقائي (autocomplete) بأسماء (names) وأسماء مستخدمين (usernames) الأشخاص المتعاونين (collaborators) أو المساهمين (contributors) في المشروع. -.Start typing @ to mention someone +.Start typing @ to mention someone (ابدأ بكتابة @ للإشارة إلى شخص ما) image::images/maint-05-mentions.png[Start typing @ to mention someone] -You can also mention a user who is not in that dropdown, but often the autocompleter can make it faster. +يمكنك أيضاً الإشارة (mention) إلى مستخدم غير موجود في تلك القائمة المنسدلة (dropdown)، ولكن غالباً ما يمكن للمكمل التلقائي (autocompleter) جعله أسرع. -Once you post a comment with a user mention, that user will be notified. -This means that this can be a really effective way of pulling people into conversations rather than making them poll. -Very often in Pull Requests on GitHub people will pull in other people on their teams or in their company to review an Issue or Pull Request. +بمجرد نشر تعليق (post a comment) يحتوي على إشارة إلى مستخدم (user mention)، سيتم إشعار (notified) ذلك المستخدم. +هذا يعني أن هذه يمكن أن تكون طريقة فعالة جداً لجذب الأشخاص (pulling people) إلى المحادثات (conversations) بدلاً من جعلهم يبحثون. +في كثير من الأحيان في طلبات السحب (Pull Requests) على GitHub، يقوم الأشخاص بجذب أشخاص آخرين في فرقهم أو في شركتهم لمراجعة (review) مشكلة (Issue) أو طلب سحب. -If someone gets mentioned on a Pull Request or Issue, they will be "`subscribed`" to it and will continue getting notifications any time some activity occurs on it. -You will also be subscribed to something if you opened it, if you're watching the repository or if you comment on something. -If you no longer wish to receive notifications, there is an "`Unsubscribe`" button on the page you can click to stop receiving updates on it. +إذا تم ذكر شخص ما (mentioned) في طلب سحب (Pull Request) أو مشكلة (Issue)، فسيتم "`الاشتراك`" ("`subscribed`") فيه وسيستمر في تلقي الإشعارات (notifications) في أي وقت يحدث فيه بعض النشاط (activity) عليه. +سيتم اشتراكك (subscribed) أيضاً في شيء ما إذا قمت بفتحه، أو إذا كنت تراقب المستودع (watching the repository) أو إذا قمت بالتعليق (comment) على شيء ما. +إذا لم تعد ترغب في تلقي الإشعارات، فهناك زر "`Unsubscribe`" (إلغاء الاشتراك) في الصفحة يمكنك النقر عليه للتوقف عن تلقي التحديثات بشأنه. -.Unsubscribe from an Issue or Pull Request +.Unsubscribe from an Issue or Pull Request (إلغاء الاشتراك من مشكلة أو طلب سحب) image::images/maint-06-unsubscribe.png[Unsubscribe from an Issue or Pull Request] -===== The Notifications Page +===== The Notifications Page (صفحة الإشعارات) -When we mention "`notifications`" here with respect to GitHub, we mean a specific way that GitHub tries to get in touch with you when events happen and there are a few different ways you can configure them. -If you go to the "`Notification center`" tab from the settings page, you can see some of the options you have. +عندما نذكر "`الإشعارات`" ("`notifications`") هنا فيما يتعلق بـ GitHub، فإننا نعني طريقة معينة يحاول GitHub من خلالها التواصل معك عند وقوع أحداث (events) وهناك عدة طرق مختلفة يمكنك من خلالها تكوينها (configure them). +إذا ذهبت إلى علامة التبويب "`Notification center`" (مركز الإشعارات) من صفحة الإعدادات (settings page)، يمكنك رؤية بعض الخيارات المتاحة لك. -.Notification center options +.Notification center options (خيارات مركز الإشعارات) image::images/maint-07-notifications.png[Notification center options] -The two choices are to get notifications over "`Email`" and over "`Web`" and you can choose either, neither or both for when you actively participate in things and for activity on repositories you are watching. +الخياران (choices) هما الحصول على إشعارات (notifications) عبر البريد الإلكتروني "`Email`" وعبر الويب "`Web`" ويمكنك اختيار إما، أو لا شيء، أو كليهما عندما تشارك بنشاط (actively participate) في أشياء والنشاط على المستودعات (repositories) التي تراقبها (watching). -====== Web Notifications +====== Web Notifications (إشعارات الويب) -Web notifications only exist on GitHub and you can only check them on GitHub. -If you have this option selected in your preferences and a notification is triggered for you, you will see a small blue dot over your notifications icon at the top of your screen as seen in <<_not_center>>. +إشعارات الويب (Web notifications) موجودة فقط على GitHub ولا يمكنك التحقق منها إلا على GitHub. +إذا حددت هذا الخيار في تفضيلاتك (preferences) وتم تشغيل إشعار لك، فسترى نقطة زرقاء (blue dot) صغيرة فوق أيقونة الإشعارات أعلى شاشتك كما يظهر في <<_not_center>>. [[_not_center]] -.Notification center +.Notification center (مركز الإشعارات) image::images/maint-08-notifications-page.png[Notification center] -If you click on that, you will see a list of all the items you have been notified about, grouped by project. -You can filter to the notifications of a specific project by clicking on its name in the left hand sidebar. -You can also acknowledge the notification by clicking the checkmark icon next to any notification, or acknowledge _all_ of the notifications in a project by clicking the checkmark at the top of the group. -There is also a mute button next to each checkmark that you can click to not receive any further notifications on that item. +إذا قمت بالنقر فوق ذلك، فسترى قائمة بجميع العناصر (items) التي تم إخبارك بها، مجمعة حسب المشروع (project). +يمكنك التصفية (filter) حسب إشعارات مشروع معين (specific project) بالنقر فوق اسمه في الشريط الجانبي الأيسر (left hand sidebar). +يمكنك أيضاً تأكيد (acknowledge) الإشعار بالنقر فوق أيقونة علامة الاختيار (checkmark icon) الموجودة بجوار أي إشعار، أو تأكيد _جميع_ الإشعارات في مشروع بالنقر فوق علامة الاختيار الموجودة أعلى المجموعة. +يوجد أيضاً زر كتم الصوت (mute button) بجوار كل علامة اختيار يمكنك النقر عليه لعدم تلقي أي إشعارات أخرى حول ذلك العنصر. -All of these tools are very useful for handling large numbers of notifications. -Many GitHub power users will simply turn off email notifications entirely and manage all of their notifications through this screen. +تعد كل هذه الأدوات مفيدة جداً (very useful) للتعامل مع أعداد كبيرة (large numbers) من الإشعارات. +سيقوم العديد من مستخدمي GitHub المتقدمين (power users) ببساطة بإيقاف تشغيل (turn off) إشعارات البريد الإلكتروني تماماً وإدارة (manage) جميع إشعاراتهم من خلال هذه الشاشة. -====== Email Notifications +====== Email Notifications (إشعارات البريد الإلكتروني) -Email notifications are the other way you can handle notifications through GitHub. -If you have this turned on you will get emails for each notification. -We saw examples of this in <<_email_notification>> and <<_email_pr>>. -The emails will also be threaded properly, which is nice if you're using a threading email client. +إشعارات البريد الإلكتروني (Email notifications) هي الطريقة الأخرى التي يمكنك من خلالها التعامل مع الإشعارات عبر GitHub. +إذا قمت بتشغيل هذا، فستتلقى رسائل بريد إلكتروني (emails) لكل إشعار. +لقد رأينا أمثلة (examples) على ذلك في <<_email_notification>> و <<_email_pr>>. +سيتم أيضاً ربط (threaded) رسائل البريد الإلكتروني بشكل صحيح، وهو أمر رائع إذا كنت تستخدم عميل بريد إلكتروني مترابط (threading email client). -There is also a fair amount of metadata embedded in the headers of the emails that GitHub sends you, which can be really helpful for setting up custom filters and rules. +يوجد أيضاً قدر لا بأس به من البيانات الوصفية (metadata) المضمنة (embedded) في رؤوس (headers) رسائل البريد الإلكتروني التي يرسلها لك GitHub، والتي يمكن أن تكون مفيدة حقاً (really helpful) لإعداد عوامل تصفية وقواعد مخصصة (custom filters and rules). -For instance, if we look at the actual email headers sent to Tony in the email shown in <<_email_pr>>, we will see the following among the information sent: +على سبيل المثال، إذا نظرنا إلى رؤوس البريد الإلكتروني الفعلية (actual email headers) المرسلة إلى Tony في البريد الإلكتروني الموضح في <<_email_pr>>، فسنرى ما يلي من بين المعلومات المرسلة: [source,mbox] ---- @@ -307,71 +307,71 @@ List-Unsubscribe: ,... X-GitHub-Recipient-Address: tchacon@example.com ---- -There are a couple of interesting things here. -If you want to highlight or re-route emails to this particular project or even Pull Request, the information in `Message-ID` gives you all the data in `///` format. -If this was an issue, for example, the `` field would have been "`issues`" rather than "`pull`". +هناك بعض الأشياء المثيرة للاهتمام (interesting things) هنا. +إذا كنت ترغب في تمييز (highlight) رسائل البريد الإلكتروني أو إعادة توجيهها (re-route) إلى هذا المشروع المحدد أو حتى طلب السحب (Pull Request)، فإن المعلومات الموجودة في `Message-ID` تمنحك جميع البيانات بتنسيق `///`. +إذا كانت هذه مشكلة (issue)، على سبيل المثال، فسيكون الحقل `` هو "`issues`" بدلاً من "`pull`". -The `List-Post` and `List-Unsubscribe` fields mean that if you have a mail client that understands those, you can easily post to the list or "`Unsubscribe`" from the thread. -That would be essentially the same as clicking the "`mute`" button on the web version of the notification or "`Unsubscribe`" on the Issue or Pull Request page itself. +تعني الحقول `List-Post` و `List-Unsubscribe` أنه إذا كان لديك عميل بريد (mail client) يفهم هذه الحقول، فيمكنك النشر بسهولة (easily post) في القائمة أو "`إلغاء الاشتراك`" ("`Unsubscribe`") من السلسلة (thread). +سيكون هذا هو نفسه أساساً النقر فوق زر "`كتم الصوت`" ("`mute`") على إصدار الويب (web version) من الإشعار (notification) أو "`إلغاء الاشتراك`" على صفحة المشكلة (Issue) أو طلب السحب (Pull Request) نفسها. -It's also worth noting that if you have both email and web notifications enabled and you read the email version of the notification, the web version will be marked as read as well if you have images allowed in your mail client. +تجدر الإشارة أيضاً إلى أنه إذا تم تمكين (enabled) كل من إشعارات البريد الإلكتروني وإشعارات الويب لديك وقرأت إصدار البريد الإلكتروني من الإشعار، فسيتم تمييز إصدار الويب كمقروء (marked as read) أيضاً إذا كان مسموحاً لك بالصور (images allowed) في عميل البريد الخاص بك. -==== Special Files +==== Special Files (الملفات الخاصة) -There are a couple of special files that GitHub will notice if they are present in your repository. +هناك ملفان خاصان سيلاحظهما GitHub إذا كانا موجودين في مستودعك (repository). -==== README +==== README (اقرأني) -The first is the `README` file, which can be of nearly any format that GitHub recognizes as prose. -For example, it could be `README`, `README.md`, `README.asciidoc`, etc. -If GitHub sees a `README` file in your source, it will render it on the landing page of the project. +الأول هو ملف `README`، والذي يمكن أن يكون بأي تنسيق (format) تقريباً يتعرف عليه GitHub على أنه نثر (prose). +على سبيل المثال، يمكن أن يكون `README` أو `README.md` أو `README.asciidoc` إلخ. +إذا رأى GitHub ملف `README` في مصدرك (source)، فسيعرضه (render it) على الصفحة المقصودة (landing page) للمشروع. -Many teams use this file to hold all the relevant project information for someone who might be new to the repository or project. -This generally includes things like: +تستخدم العديد من الفرق (teams) هذا الملف للاحتفاظ بجميع معلومات المشروع (project information) ذات الصلة لشخص قد يكون جديداً على المستودع أو المشروع. +يتضمن هذا بشكل عام أشياء مثل: -* What the project is for -* How to configure and install it -* An example of how to use it or get it running -* The license that the project is offered under -* How to contribute to it +* ما الغرض من المشروع +* كيفية تكوينه وتثبيته (configure and install it) +* مثال لكيفية استخدامه أو تشغيله +* الترخيص (license) الذي يتم تقديم المشروع بموجبه +* كيفية المساهمة (contribute) فيه -Since GitHub will render this file, you can embed images or links in it for added ease of understanding. +نظراً لأن GitHub سيعرض هذا الملف، يمكنك تضمين صور (embed images) أو روابط فيه لمزيد من سهولة الفهم (ease of understanding). -==== CONTRIBUTING +==== CONTRIBUTING (المساهمة) -The other special file that GitHub recognizes is the `CONTRIBUTING` file. -If you have a file named `CONTRIBUTING` with any file extension, GitHub will show <<_contrib_file>> when anyone starts opening a Pull Request. +الملف الخاص الآخر (other special file) الذي يتعرف عليه GitHub هو ملف `CONTRIBUTING`. +إذا كان لديك ملف باسم `CONTRIBUTING` بأي امتداد ملف (file extension)، فسيعرض GitHub <<_contrib_file>> عندما يبدأ أي شخص في فتح طلب سحب (Pull Request). [[_contrib_file]] -.Opening a Pull Request when a CONTRIBUTING file exists +.Opening a Pull Request when a CONTRIBUTING file exists (فتح طلب سحب عند وجود ملف CONTRIBUTING) image::images/maint-09-contrib.png[Opening a Pull Request when a CONTRIBUTING file exists] -The idea here is that you can specify specific things you want or don't want in a Pull Request sent to your project. -This way people may actually read the guidelines before opening the Pull Request. +الفكرة هنا هي أنه يمكنك تحديد أشياء معينة (specific things) تريدها أو لا تريدها في طلب سحب (Pull Request) مرسل إلى مشروعك. +بهذه الطريقة قد يقرأ الأشخاص بالفعل الإرشادات (guidelines) قبل فتح طلب السحب. -==== Project Administration +==== Project Administration (إدارة المشروع) -Generally there are not a lot of administrative things you can do with a single project, but there are a couple of items that might be of interest. +بشكل عام، لا يوجد الكثير من الأشياء الإدارية (administrative things) التي يمكنك القيام بها في مشروع واحد، ولكن هناك بعض العناصر (items) التي قد تكون ذات أهمية. -===== Changing the Default Branch +===== Changing the Default Branch (تغيير الفرع الافتراضي) -If you are using a branch other than "`master`" as your default branch that you want people to open Pull Requests on or see by default, you can change that in your repository's settings page under the "`Options`" tab. +إذا كنت تستخدم فرعاً غير "`master`" كفرعك الافتراضي (default branch) والذي تريد من الأشخاص فتح طلبات سحب (Pull Requests) عليه أو رؤيته افتراضياً، فيمكنك تغيير ذلك في صفحة إعدادات مستودعك (repository's settings page) ضمن علامة التبويب "`Options`" (خيارات). [[_default_branch]] -.Change the default branch for a project +.Change the default branch for a project (تغيير الفرع الافتراضي للمشروع) image::images/maint-10-default-branch.png[Change the default branch for a project] -Simply change the default branch in the dropdown and that will be the default for all major operations from then on, including which branch is checked out by default when someone clones the repository. +ما عليك سوى تغيير الفرع الافتراضي في القائمة المنسدلة (dropdown) وسيكون هذا هو الافتراضي (default) لجميع العمليات الرئيسية (major operations) من تلك اللحظة فصاعداً، بما في ذلك الفرع الذي يتم التحقق منه (checked out) افتراضياً عندما يستنسخ (clones) شخص ما المستودع (repository). -===== Transferring a Project +===== Transferring a Project (نقل مشروع) -If you would like to transfer a project to another user or an organization in GitHub, there is a "`Transfer ownership`" option at the bottom of the same "`Options`" tab of your repository settings page that allows you to do this. +إذا كنت ترغب في نقل (transfer) مشروع إلى مستخدم آخر أو مؤسسة (organization) في GitHub، فهناك خيار "`Transfer ownership`" (نقل الملكية) أسفل نفس علامة التبويب "`Options`" (خيارات) في صفحة إعدادات مستودعك (repository settings page) والذي يتيح لك القيام بذلك. [[_transfer_project]] -.Transfer a project to another GitHub user or Organization +.Transfer a project to another GitHub user or Organization (نقل مشروع إلى مستخدم GitHub آخر أو مؤسسة) image::images/maint-11-transfer.png[Transfer a project to another GitHub user or Organization] -This is helpful if you are abandoning a project and someone wants to take it over, or if your project is getting bigger and want to move it into an organization. +هذا مفيد إذا كنت تتخلى (abandoning) عن مشروع ويريد شخص ما تولي أمره، أو إذا كان مشروعك يزداد حجماً (getting bigger) وتريد نقله إلى مؤسسة (organization). -Not only does this move the repository along with all its watchers and stars to another place, it also sets up a redirect from your URL to the new place. -It will also redirect clones and fetches from Git, not just web requests. +لا يؤدي هذا إلى نقل (move) المستودع إلى جانب جميع مراقبيه (watchers) ونجومه (stars) إلى مكان آخر فحسب، بل يقوم أيضاً بإعداد إعادة توجيه (redirect) من عنوان URL الخاص بك إلى المكان الجديد. +كما سيقوم بإعادة توجيه الاستنساخ (clones) وعمليات الجلب (fetches) من Git، وليس فقط طلبات الويب (web requests). diff --git a/book/06-github/sections/4-managing-organization.asc b/book/06-github/sections/4-managing-organization.asc index cdb2447ab..48a26efd4 100644 --- a/book/06-github/sections/4-managing-organization.asc +++ b/book/06-github/sections/4-managing-organization.asc @@ -1,72 +1,72 @@ [[ch06-github_orgs]] -=== Managing an organization +=== Managing an organization (إدارة مؤسسة) (((GitHub, organizations))) -In addition to single-user accounts, GitHub has what are called Organizations. -Like personal accounts, Organizational accounts have a namespace where all their projects exist, but many other things are different. -These accounts represent a group of people with shared ownership of projects, and there are many tools to manage subgroups of those people. -Normally these accounts are used for Open Source groups (such as "`perl`" or "`rails`") or companies (such as "`google`" or "`twitter`"). +بالإضافة إلى حسابات المستخدم الفردي (single-user accounts)، يحتوي GitHub على ما يسمى بالمؤسسات (Organizations). +مثل الحسابات الشخصية (personal accounts)، تحتوي حسابات المؤسسات على مساحة أسماء (namespace) توجد فيها جميع مشاريعها (projects)، ولكن العديد من الأشياء الأخرى مختلفة. +تمثل (represent) هذه الحسابات مجموعة من الأشخاص (group of people) بملكية مشتركة (shared ownership) للمشاريع، وهناك العديد من الأدوات لإدارة المجموعات الفرعية (subgroups) من هؤلاء الأشخاص. +عادةً ما تُستخدم هذه الحسابات لمجموعات مفتوحة المصدر (Open Source groups) (مثل "`perl`" أو "`rails`") أو الشركات (مثل "`google`" أو "`twitter`"). -==== Organization Basics +==== Organization Basics (أساسيات المؤسسة) -An organization is pretty easy to create; just click on the "`+`" icon at the top-right of any GitHub page, and select "`New organization`" from the menu. +من السهل جداً إنشاء مؤسسة (organization)؛ ما عليك سوى النقر فوق أيقونة "`+`" في أعلى يمين أي صفحة GitHub، وتحديد "`New organization`" (مؤسسة جديدة) من القائمة. -.The "`New organization`" menu item +.The "`New organization`" menu item (عنصر القائمة "`مؤسسة جديدة`") image::images/neworg.png[The “New organization” menu item] -First you'll need to name your organization and provide an email address for a main point of contact for the group. -Then you can invite other users to be co-owners of the account if you want to. +أولاً ستحتاج إلى تسمية مؤسستك وتوفير عنوان بريد إلكتروني (email address) كنقطة اتصال رئيسية (main point of contact) للمجموعة. +ثم يمكنك دعوة (invite) مستخدمين آخرين (other users) ليكونوا مالكين مشاركين (co-owners) للحساب إذا كنت ترغب في ذلك. -Follow these steps and you'll soon be the owner of a brand-new organization. -Like personal accounts, organizations are free if everything you plan to store there will be open source. +اتبع هذه الخطوات وستصبح قريباً مالكاً لمؤسسة جديدة تماماً (brand-new organization). +مثل الحسابات الشخصية (personal accounts)، تكون المؤسسات مجانية (free) إذا كان كل ما تخطط لتخزينه هناك سيكون مفتوح المصدر (open source). -As an owner in an organization, when you fork a repository, you'll have the choice of forking it to your organization's namespace. -When you create new repositories you can create them either under your personal account or under any of the organizations that you are an owner in. -You also automatically "`watch`" any new repository created under these organizations. +كمالك (owner) في مؤسسة، عندما تقوم بنسخ (fork) مستودع (repository)، سيكون لديك خيار (choice) نسخه إلى مساحة أسماء (namespace) مؤسستك. +عند إنشاء مستودعات جديدة (new repositories)، يمكنك إنشاؤها إما ضمن حسابك الشخصي (personal account) أو ضمن أي من المؤسسات التي تمتلكها (owner in). +أنت أيضاً تراقب تلقائياً ("`watch`") أي مستودع جديد يتم إنشاؤه ضمن هذه المؤسسات. -Just like in <<_personal_avatar>>, you can upload an avatar for your organization to personalize it a bit. -Also just like personal accounts, you have a landing page for the organization that lists all of your repositories and can be viewed by other people. +تماماً كما هو الحال في <<_personal_avatar>>، يمكنك تحميل صورة رمزية (avatar) لمؤسستك لتخصيصها (personalize) قليلاً. +كما هو الحال مع الحسابات الشخصية، لديك صفحة مقصودة (landing page) للمؤسسة تسرد (lists) جميع مستودعاتك (repositories) ويمكن للآخرين عرضها. -Now let's cover some of the things that are a bit different with an organizational account. +الآن دعنا نغطي بعض الأشياء التي تختلف قليلاً مع حساب المؤسسة (organizational account). -==== Teams +==== Teams (الفرق) -Organizations are associated with individual people by way of teams, which are simply a grouping of individual user accounts and repositories within the organization and what kind of access those people have in those repositories. +ترتبط المؤسسات (Organizations) بأفراد (individual people) عن طريق الفرق (teams)، وهي ببساطة تجميع لحسابات مستخدمين فردية (individual user accounts) ومستودعات (repositories) داخل المؤسسة ونوع الوصول الذي يمتلكه هؤلاء الأشخاص في تلك المستودعات. -For example, say your company has three repositories: `frontend`, `backend`, and `deployscripts`. -You'd want your HTML/CSS/JavaScript developers to have access to `frontend` and maybe `backend`, and your Operations people to have access to `backend` and `deployscripts`. -Teams make this easy, without having to manage the collaborators for every individual repository. +على سبيل المثال، لنفترض أن شركتك تمتلك ثلاثة مستودعات (repositories): `frontend` (الواجهة الأمامية)، و `backend` (الواجهة الخلفية)، و `deployscripts` (نصوص النشر). +قد ترغب في أن يتمتع مطورو (developers) HTML/CSS/JavaScript لديك بإمكانية الوصول (access) إلى `frontend` وربما `backend`، وأن يتمتع موظفو العمليات (Operations) لديك بإمكانية الوصول إلى `backend` و `deployscripts`. +تجعل الفرق (Teams) هذا الأمر سهلاً، دون الحاجة إلى إدارة المتعاونين (collaborators) لكل مستودع (repository) على حدة. -The Organization page shows you a simple dashboard of all the repositories, users and teams that are under this organization. +تعرض لك صفحة المؤسسة (Organization page) لوحة تحكم (dashboard) بسيطة لجميع المستودعات (repositories) والمستخدمين والفرق (users and teams) الموجودة ضمن هذه المؤسسة. [[_org_page]] -.The Organization page +.The Organization page (صفحة المؤسسة) image::images/orgs-01-page.png[The Organization page] -To manage your Teams, you can click on the Teams sidebar on the right hand side of the page in <<_org_page>>. -This will bring you to a page you can use to add members to the team, add repositories to the team or manage the settings and access control levels for the team. -Each team can have read only, read/write or administrative access to the repositories. -You can change that level by clicking the "`Settings`" button in <<_team_page>>. +لإدارة فرقك (Teams)، يمكنك النقر فوق الشريط الجانبي للفرق (Teams sidebar) على الجانب الأيمن من الصفحة في <<_org_page>>. +سيوجهك هذا إلى صفحة يمكنك استخدامها لإضافة أعضاء (add members) إلى الفريق، أو إضافة مستودعات (repositories) إلى الفريق، أو إدارة الإعدادات (manage the settings) ومستويات التحكم في الوصول (access control levels) للفريق. +يمكن أن يتمتع كل فريق بوصول للقراءة فقط (read only) أو قراءة/كتابة (read/write) أو وصول إداري (administrative access) إلى المستودعات (repositories). +يمكنك تغيير ذلك المستوى بالنقر فوق زر "`Settings`" (الإعدادات) في <<_team_page>>. [[_team_page]] -.The Team page +.The Team page (صفحة الفريق) image::images/orgs-02-teams.png[The Team page] -When you invite someone to a team, they will get an email letting them know they've been invited. +عندما تدعو (invite) شخصاً ما إلى فريق، سيتلقى رسالة بريد إلكتروني (email) تخبره بأنه تمت دعوته. -Additionally, team `@mentions` (such as `@acmecorp/frontend`) work much the same as they do with individual users, except that *all* members of the team are then subscribed to the thread. -This is useful if you want the attention from someone on a team, but you don't know exactly who to ask. +بالإضافة إلى ذلك، تعمل إشارات الفريق (team `@mentions`) (مثل `@acmecorp/frontend`) بنفس الطريقة التي تعمل بها مع المستخدمين الفرديين (individual users)، باستثناء أن *جميع* أعضاء الفريق يتم الاشتراك (subscribed) بعد ذلك في السلسلة (thread). +هذا مفيد إذا كنت تريد لفت انتباه (attention) شخص ما في الفريق، لكنك لا تعرف بالضبط من تسأل. -A user can belong to any number of teams, so don't limit yourself to only access-control teams. -Special-interest teams like `ux`, `css`, or `refactoring` are useful for certain kinds of questions, and others like `legal` and `colorblind` for an entirely different kind. +يمكن أن ينتمي المستخدم إلى أي عدد من الفرق (teams)، لذا لا تقصر (limit) نفسك على فرق التحكم في الوصول (access-control) فقط. +تعد فرق الاهتمامات الخاصة (Special-interest teams) مثل `ux` أو `css` أو `refactoring` مفيدة لأنواع معينة من الأسئلة (questions)، وغيرها مثل `legal` و `colorblind` لنوع مختلف تماماً. -==== Audit Log +==== Audit Log (سجل التدقيق) -Organizations also give owners access to all the information about what went on under the organization. -You can go to the 'Audit Log' tab and see what events have happened at an organization level, who did them and where in the world they were done. +تمنح المؤسسات (Organizations) أيضاً المالكين (owners) حق الوصول إلى جميع المعلومات حول ما حدث (went on) تحت إشراف المؤسسة. +يمكنك الانتقال إلى علامة التبويب 'Audit Log' (سجل التدقيق) ومعرفة الأحداث (events) التي حدثت على مستوى المؤسسة (organization level)، ومن قام بها، وأين تم القيام بها (where in the world). [[_the_audit_log]] -.The Audit log +.The Audit log (سجل التدقيق) image::images/orgs-03-audit.png[The Audit log] -You can also filter down to specific types of events, specific places or specific people. +يمكنك أيضاً التصفية (filter down) إلى أنواع معينة من الأحداث، أو أماكن معينة، أو أشخاص معينين. diff --git a/book/06-github/sections/5-scripting.asc b/book/06-github/sections/5-scripting.asc index c755afa17..3e82566b9 100644 --- a/book/06-github/sections/5-scripting.asc +++ b/book/06-github/sections/5-scripting.asc @@ -1,63 +1,63 @@ -=== Scripting GitHub +=== Scripting GitHub (برمجة GitHub) -So now we've covered all of the major features and workflows of GitHub, but any large group or project will have customizations they may want to make or external services they may want to integrate. +لقد غطينا الآن جميع الميزات (features) الرئيسية ومهام سير العمل (workflows) الخاصة بـ GitHub، ولكن أي مجموعة (group) أو مشروع كبير (large project) سيكون لديه تخصيصات (customizations) قد يرغبون في إجرائها أو خدمات خارجية (external services) قد يرغبون في دمجها (integrate). -Luckily for us, GitHub is really quite hackable in many ways. -In this section we'll cover how to use the GitHub hooks system and its API to make GitHub work how we want it to. +لحسن الحظ بالنسبة لنا، يمكن اختراق (hackable) GitHub حقاً بعدة طرق. +في هذا القسم، سنغطي كيفية استخدام نظام مشغلات (hooks system) GitHub وواجهة برمجة التطبيقات (API) الخاصة به لجعل GitHub يعمل بالطريقة التي نريدها. -==== Services and Hooks +==== Services and Hooks (الخدمات والمشغلات) -The Hooks and Services section of GitHub repository administration is the easiest way to have GitHub interact with external systems. +يعد قسم المشغلات والخدمات (Hooks and Services section) في إدارة مستودع (repository administration) GitHub هو أسهل طريقة لجعل GitHub يتفاعل (interact) مع الأنظمة الخارجية (external systems). -===== Services +===== Services (الخدمات) -First we'll take a look at Services. -Both the Hooks and Services integrations can be found in the Settings section of your repository, where we previously looked at adding Collaborators and changing the default branch of your project. -Under the "`Webhooks and Services`" tab you will see something like <<_services_hooks>>. +أولاً سنلقي نظرة على الخدمات (Services). +يمكن العثور على كل من تكاملات المشغلات والخدمات (Hooks and Services integrations) في قسم الإعدادات (Settings) في مستودعك، حيث نظرنا سابقاً في إضافة متعاونين (adding Collaborators) وتغيير الفرع الافتراضي (default branch) لمشروعك. +ضمن علامة التبويب "`Webhooks and Services`" (مشغلات الويب والخدمات)، سترى شيئاً مثل <<_services_hooks>>. [[_services_hooks]] -.Services and Hooks configuration section +.Services and Hooks configuration section (قسم تكوين الخدمات والمشغلات) image::images/scripting-01-services.png[Services and Hooks configuration section] -There are dozens of services you can choose from, most of them integrations into other commercial and open source systems. -Most of them are for Continuous Integration services, bug and issue trackers, chat room systems and documentation systems. -We'll walk through setting up a very simple one, the Email hook. -If you choose "`email`" from the "`Add Service`" dropdown, you'll get a configuration screen like <<_service_config>>. +هناك العشرات من الخدمات (services) التي يمكنك الاختيار من بينها، ومعظمها عبارة عن تكاملات (integrations) في أنظمة تجارية (commercial) ومفتوحة المصدر (open source) أخرى. +معظمها لخدمات التكامل المستمر (Continuous Integration services)، ومتتبعات الأخطاء والمشكلات (bug and issue trackers)، وأنظمة غرف الدردشة (chat room systems)، وأنظمة التوثيق (documentation systems). +سنستعرض إعداد واحد بسيط للغاية، وهو مشغل البريد الإلكتروني (Email hook). +إذا اخترت "`email`" من القائمة المنسدلة (dropdown) "`Add Service`" (إضافة خدمة)، فستحصل على شاشة تكوين (configuration screen) مثل <<_service_config>>. [[_service_config]] -.Email service configuration +.Email service configuration (تكوين خدمة البريد الإلكتروني) image::images/scripting-02-email-service.png[Email service configuration] -In this case, if we hit the "`Add service`" button, the email address we specified will get an email every time someone pushes to the repository. -Services can listen for lots of different types of events, but most only listen for push events and then do something with that data. +في هذه الحالة، إذا ضغطنا على زر "`Add service`" (إضافة خدمة)، فإن عنوان البريد الإلكتروني (email address) الذي حددناه سيتلقى بريداً إلكترونياً في كل مرة يدفع (pushes) فيها شخص ما إلى المستودع. +يمكن للخدمات (Services) الاستماع إلى الكثير من أنواع الأحداث (events) المختلفة، ولكن معظمها يستمع فقط لأحداث الدفع (push events) ثم يفعل شيئاً بتلك البيانات. -If there is a system you are using that you would like to integrate with GitHub, you should check here to see if there is an existing service integration available. -For example, if you're using Jenkins to run tests on your codebase, you can enable the Jenkins builtin service integration to kick off a test run every time someone pushes to your repository. +إذا كان هناك نظام تستخدمه وترغب في دمجه (integrate) مع GitHub، فيجب عليك التحقق هنا لمعرفة ما إذا كان هناك تكامل خدمة (service integration) حالي متاح. +على سبيل المثال، إذا كنت تستخدم Jenkins لإجراء اختبارات (run tests) على قاعدة التعليمات البرمجية (codebase) الخاصة بك، فيمكنك تمكين (enable) تكامل خدمة Jenkins المدمج لبدء تشغيل اختبار (test run) في كل مرة يدفع فيها شخص ما إلى مستودعك. -===== Hooks +===== Hooks (المشغلات) -If you need something more specific or you want to integrate with a service or site that is not included in this list, you can instead use the more generic hooks system. -GitHub repository hooks are pretty simple. -You specify a URL and GitHub will post an HTTP payload to that URL on any event you want. +إذا كنت بحاجة إلى شيء أكثر تحديداً أو كنت ترغب في التكامل (integrate) مع خدمة (service) أو موقع غير مدرج في هذه القائمة، يمكنك بدلاً من ذلك استخدام نظام المشغلات (hooks system) الأكثر عمومية. +مشغلات مستودع (repository hooks) GitHub بسيطة جداً. +تحدد عنوان URL وسيقوم GitHub بنشر (post) حمولة (payload) HTTP إلى عنوان URL ذلك في أي حدث (event) تريده. -Generally the way this works is you can setup a small web service to listen for a GitHub hook payload and then do something with the data when it is received. +بشكل عام، الطريقة التي يعمل بها هذا هي أنه يمكنك إعداد خدمة ويب (web service) صغيرة للاستماع (listen) إلى حمولة (payload) مشغل GitHub ثم القيام بشيء بالبيانات (data) عند استلامها. -To enable a hook, you click the "`Add webhook`" button in <<_services_hooks>>. -This will bring you to a page that looks like <<_web_hook>>. +لتمكين (enable) مشغل، تنقر فوق الزر "`Add webhook`" (إضافة مشغل ويب) في <<_services_hooks>>. +سينقلك هذا إلى صفحة تبدو مثل <<_web_hook>>. [[_web_hook]] -.Web hook configuration +.Web hook configuration (تكوين مشغل الويب) image::images/scripting-03-webhook.png[Web hook configuration] -The configuration for a web hook is pretty simple. -In most cases you simply enter a URL and a secret key and hit "`Add webhook`". -There are a few options for which events you want GitHub to send you a payload for -- the default is to only get a payload for the `push` event, when someone pushes new code to any branch of your repository. +تكوين مشغل الويب (web hook) بسيط جداً. +في معظم الحالات، تقوم ببساطة بإدخال عنوان URL ومفتاح سري (secret key) وتضغط على "`Add webhook`". +هناك بعض الخيارات للأحداث (events) التي تريد أن يرسل لك GitHub حمولة (payload) من أجلها -- الافتراضي (default) هو الحصول على حمولة لحدث `push` فقط، عندما يدفع شخص ما كوداً جديداً (new code) إلى أي فرع (branch) من مستودعك. -Let's see a small example of a web service you may set up to handle a web hook. -We'll use the Ruby web framework Sinatra since it's fairly concise and you should be able to easily see what we're doing. +دعونا نرى مثالاً صغيراً على خدمة ويب (web service) قد تقوم بإعدادها للتعامل مع مشغل ويب (web hook). +سنستخدم إطار عمل الويب (web framework) الخاص بـ Ruby وهو Sinatra نظراً لأنه موجز إلى حد ما ويجب أن تكون قادراً على رؤية ما نقوم به بسهولة. -Let's say we want to get an email if a specific person pushes to a specific branch of our project modifying a specific file. -We could fairly easily do that with code like this: +لنفترض أننا نريد الحصول على بريد إلكتروني (email) إذا قام شخص معين بالدفع (pushes) إلى فرع معين من مشروعنا وقام بتعديل (modifying) ملف معين (specific file). +يمكننا القيام بذلك بسهولة تامة باستخدام كود مثل هذا: [source,ruby] ---- @@ -93,37 +93,37 @@ post '/payload' do end ---- -Here we're taking the JSON payload that GitHub delivers us and looking up who pushed it, what branch they pushed to and what files were touched in all the commits that were pushed. -Then we check that against our criteria and send an email if it matches. +هنا نأخذ حمولة (payload) JSON التي يقدمها (delivers) لنا GitHub ونبحث عمن دفعها (pushed it)، وما هو الفرع الذي دفعوا إليه وما هي الملفات التي تم مسها (touched) في جميع عمليات التأكيد (commits) التي تم دفعها. +ثم نتحقق من ذلك مقابل معاييرنا (criteria) ونرسل بريداً إلكترونياً (email) إذا كان متطابقاً (matches). -In order to develop and test something like this, you have a nice developer console in the same screen where you set the hook up. -You can see the last few deliveries that GitHub has tried to make for that webhook. -For each hook you can dig down into when it was delivered, if it was successful and the body and headers for both the request and the response. -This makes it incredibly easy to test and debug your hooks. +من أجل تطوير (develop) واختبار (test) شيء من هذا القبيل، لديك وحدة تحكم مطور (developer console) لطيفة في نفس الشاشة التي قمت بإعداد المشغل (hook) فيها. +يمكنك رؤية عمليات التسليم (deliveries) القليلة الماضية التي حاول GitHub إجراؤها لمشغل الويب (webhook) ذلك. +لكل مشغل، يمكنك التعمق (dig down) في وقت تسليمه (delivered)، وما إذا كان ناجحاً وجسم الرسالة (body) والرؤوس (headers) لكل من الطلب (request) والاستجابة (response). +هذا يجعل من السهل جداً اختبار مشغلاتك (hooks) وتصحيح أخطائها (debug). [[_web_hook_debug]] -.Web hook debugging information +.Web hook debugging information (معلومات تصحيح أخطاء مشغل الويب) image::images/scripting-04-webhook-debug.png[Web hook debugging information] -The other great feature of this is that you can redeliver any of the payloads to test your service easily. +الميزة الرائعة (great feature) الأخرى في هذا هي أنه يمكنك إعادة تسليم (redeliver) أي من الحمولات (payloads) لاختبار (test) خدمتك (service) بسهولة. -For more information on how to write webhooks and all the different event types you can listen for, go to the GitHub Developer documentation at https://docs.github.com/en/webhooks-and-events/webhooks/about-webhooks[^]. +لمزيد من المعلومات حول كيفية كتابة مشغلات الويب (webhooks) وجميع أنواع الأحداث (event types) المختلفة التي يمكنك الاستماع إليها، انتقل إلى وثائق مطور GitHub (GitHub Developer documentation) على https://docs.github.com/en/webhooks-and-events/webhooks/about-webhooks[^]. -==== The GitHub API +==== The GitHub API (واجهة برمجة تطبيقات GitHub) (((GitHub, API))) -Services and hooks give you a way to receive push notifications about events that happen on your repositories, but what if you need more information about these events? -What if you need to automate something like adding collaborators or labeling issues? +تمنحك الخدمات والمشغلات (Services and hooks) طريقة لتلقي إشعارات الدفع (push notifications) حول الأحداث (events) التي تحدث على مستودعاتك (repositories)، ولكن ماذا لو كنت بحاجة إلى مزيد من المعلومات (more information) حول هذه الأحداث؟ +ماذا لو كنت بحاجة إلى أتمتة (automate) شيء ما مثل إضافة متعاونين (collaborators) أو تصنيف (labeling) المشكلات (issues)؟ -This is where the GitHub API comes in handy. -GitHub has tons of API endpoints for doing nearly anything you can do on the website in an automated fashion. -In this section we'll learn how to authenticate and connect to the API, how to comment on an issue and how to change the status of a Pull Request through the API. +هذا هو المكان الذي تكون فيه واجهة برمجة تطبيقات GitHub (GitHub API) مفيدة (handy). +يحتوي GitHub على الكثير من نقاط نهاية API (API endpoints) للقيام بأي شيء تقريباً يمكنك القيام به على موقع الويب بطريقة آلية (automated fashion). +في هذا القسم سنتعلم كيفية المصادقة (authenticate) والاتصال (connect) بـ API، وكيفية التعليق (comment) على مشكلة (issue) وكيفية تغيير حالة (status) طلب السحب (Pull Request) من خلال API. -==== Basic Usage +==== Basic Usage (الاستخدام الأساسي) -The most basic thing you can do is a simple GET request on an endpoint that doesn't require authentication. -This could be a user or read-only information on an open source project. -For example, if we want to know more about a user named "`schacon`", we can run something like this: +أبسط شيء يمكنك القيام به هو طلب GET (GET request) بسيط على نقطة نهاية (endpoint) لا تتطلب مصادقة (authentication). +يمكن أن يكون هذا مستخدماً (user) أو معلومات للقراءة فقط (read-only information) حول مشروع مفتوح المصدر (open source project). +على سبيل المثال، إذا أردنا معرفة المزيد عن مستخدم يسمى "`schacon`"، فيمكننا تشغيل شيء كهذا: [source,javascript] ---- @@ -141,8 +141,8 @@ $ curl https://api.github.com/users/schacon } ---- -There are tons of endpoints like this to get information about organizations, projects, issues, commits -- just about anything you can publicly see on GitHub. -You can even use the API to render arbitrary Markdown or find a `.gitignore` template. +هناك الكثير من نقاط النهاية (endpoints) مثل هذه للحصول على معلومات حول المؤسسات (organizations)، والمشاريع (projects)، والمشكلات (issues)، وعمليات التأكيد (commits) -- تقريباً أي شيء يمكنك رؤيته علناً (publicly) على GitHub. +يمكنك حتى استخدام API لعرض (render) أي Markdown عشوائي أو العثور على قالب (template) `.gitignore`. [source,javascript] ---- @@ -165,32 +165,32 @@ hs_err_pid* } ---- -==== Commenting on an Issue +==== Commenting on an Issue (التعليق على مشكلة) -However, if you want to do an action on the website such as comment on an Issue or Pull Request or if you want to view or interact with private content, you'll need to authenticate. +ومع ذلك، إذا كنت ترغب في القيام بإجراء (action) على الموقع الإلكتروني مثل التعليق (comment) على مشكلة (Issue) أو طلب سحب (Pull Request) أو إذا كنت ترغب في عرض محتوى خاص (private content) أو التفاعل معه، فستحتاج إلى المصادقة (authenticate). -There are several ways to authenticate. -You can use basic authentication with just your username and password, but generally it's a better idea to use a personal access token. -You can generate this from the "`Applications`" tab of your settings page. +هناك عدة طرق للمصادقة. +يمكنك استخدام المصادقة الأساسية (basic authentication) باستخدام اسم المستخدم وكلمة المرور (username and password) الخاصين بك فقط، ولكن بشكل عام من الأفضل استخدام رمز وصول شخصي (personal access token). +يمكنك إنشاء (generate) هذا من علامة التبويب "`Applications`" (التطبيقات) في صفحة الإعدادات (settings page). [[_access_token]] -.Generate your access token from the "`Applications`" tab of your settings page +.Generate your access token from the "`Applications`" tab of your settings page (إنشاء رمز الوصول الخاص بك من علامة التبويب "`التطبيقات`" في صفحة إعداداتك) image::images/scripting-05-access-token.png[Generate your access token from the “Applications” tab of your settings page] -It will ask you which scopes you want for this token and a description. -Make sure to use a good description so you feel comfortable removing the token when your script or application is no longer used. +سيسألك عن النطاقات (scopes) التي تريدها لهذا الرمز المميز (token) ووصف (description). +تأكد من استخدام وصف جيد (good description) حتى تشعر بالراحة (comfortable) في إزالة (removing) الرمز المميز عندما لا يعود البرنامج النصي (script) أو التطبيق (application) قيد الاستخدام. -GitHub will only show you the token once, so be sure to copy it. -You can now use this to authenticate in your script instead of using a username and password. -This is nice because you can limit the scope of what you want to do and the token is revocable. +سيعرض لك GitHub الرمز المميز (token) مرة واحدة فقط، لذا تأكد من نسخه (copy it). +يمكنك الآن استخدامه للمصادقة (authenticate) في برنامجك النصي (script) بدلاً من استخدام اسم مستخدم وكلمة مرور. +هذا أمر رائع لأنه يمكنك تقييد نطاق (limit the scope) ما تريد القيام به والرمز المميز قابل للإلغاء (revocable). -This also has the added advantage of increasing your rate limit. -Without authenticating, you will be limited to 60 requests per hour. -If you authenticate you can make up to 5,000 requests per hour. +هذا له أيضاً ميزة إضافية (added advantage) تتمثل في زيادة حد المعدل (rate limit) الخاص بك. +بدون المصادقة (authenticating)، سيقتصر (limited) عدد الطلبات (requests) على 60 طلباً في الساعة. +إذا قمت بالمصادقة، يمكنك تقديم ما يصل إلى 5000 طلب في الساعة. -So let's use it to make a comment on one of our issues. -Let's say we want to leave a comment on a specific issue, Issue #6. -To do so we have to do an HTTP POST request to `repos///issues//comments` with the token we just generated as an Authorization header. +لذا دعنا نستخدمه لترك تعليق (comment) على إحدى مشكلاتنا (issues). +لنفترض أننا نريد ترك تعليق على مشكلة معينة، الإصدار رقم 6. +للقيام بذلك، يتعين علينا إجراء طلب HTTP POST إلى `repos///issues//comments` باستخدام الرمز المميز (token) الذي أنشأناه للتو كـ Authorization header (رأس تفويض). [source,javascript] ---- @@ -214,23 +214,23 @@ $ curl -H "Content-Type: application/json" \ } ---- -Now if you go to that issue, you can see the comment that we just successfully posted as in <<_api_comment>>. +الآن إذا ذهبت إلى تلك المشكلة، يمكنك رؤية التعليق (comment) الذي قمنا بنشره للتو بنجاح (successfully posted) كما في <<_api_comment>>. [[_api_comment]] -.A comment posted from the GitHub API +.A comment posted from the GitHub API (تعليق تم نشره من GitHub API) image::images/scripting-06-comment.png[A comment posted from the GitHub API] -You can use the API to do just about anything you can do on the website -- creating and setting milestones, assigning people to Issues and Pull Requests, creating and changing labels, accessing commit data, creating new commits and branches, opening, closing or merging Pull Requests, creating and editing teams, commenting on lines of code in a Pull Request, searching the site and on and on. +يمكنك استخدام API للقيام بأي شيء تقريباً يمكنك القيام به على موقع الويب -- إنشاء (creating) المعالم (milestones) وتعيينها (setting)، وتعيين (assigning) أشخاص للمشكلات (Issues) وطلبات السحب (Pull Requests)، وإنشاء (creating) التصنيفات (labels) وتغييرها (changing)، والوصول إلى بيانات التأكيد (commit data)، وإنشاء عمليات تأكيد (commits) وفروع (branches) جديدة، وفتح (opening) طلبات السحب (Pull Requests) أو إغلاقها (closing) أو دمجها (merging)، وإنشاء وتحرير الفرق (teams)، والتعليق (commenting) على أسطر الكود (lines of code) في طلب السحب (Pull Request)، والبحث في الموقع (searching the site) وما إلى ذلك. -==== Changing the Status of a Pull Request +==== Changing the Status of a Pull Request (تغيير حالة طلب السحب) -There is one final example we'll look at since it's really useful if you're working with Pull Requests. -Each commit can have one or more statuses associated with it and there is an API to add and query that status. +هناك مثال أخير سننظر إليه لأنه مفيد حقاً (really useful) إذا كنت تعمل مع طلبات السحب (Pull Requests). +يمكن أن يكون لكل تأكيد (commit) حالة (status) واحدة أو أكثر مرتبطة به وهناك API لإضافة (add) تلك الحالة والاستعلام (query) عنها. -Most of the Continuous Integration and testing services make use of this API to react to pushes by testing the code that was pushed, and then report back if that commit has passed all the tests. -You could also use this to check if the commit message is properly formatted, if the submitter followed all your contribution guidelines, if the commit was validly signed -- any number of things. +تستفيد معظم خدمات التكامل المستمر (Continuous Integration) والاختبار (testing services) من واجهة برمجة التطبيقات (API) هذه للرد على عمليات الدفع (pushes) عن طريق اختبار الكود الذي تم دفعه، ثم الإبلاغ (report back) عما إذا كان ذلك التأكيد قد اجتاز جميع الاختبارات (passed all the tests). +يمكنك أيضاً استخدام هذا للتحقق مما إذا كانت رسالة التأكيد (commit message) منسقة بشكل صحيح (properly formatted)، وما إذا كان المرسل (submitter) قد اتبع جميع إرشادات المساهمة (contribution guidelines) الخاصة بك، وما إذا كان التأكيد (commit) موقعاً بشكل صالح (validly signed) -- أي عدد من الأشياء. -Let's say you set up a webhook on your repository that hits a small web service that checks for a `Signed-off-by` string in the commit message. +لنفترض أنك قمت بإعداد مشغل ويب (webhook) في مستودعك (repository) يضرب (hits) خدمة ويب (web service) صغيرة تتحقق (checks) من وجود سلسلة `Signed-off-by` في رسالة التأكيد (commit message). [source,ruby] ---- @@ -275,27 +275,27 @@ post '/payload' do end ---- -Hopefully this is fairly simple to follow. -In this web hook handler we look through each commit that was just pushed, we look for the string 'Signed-off-by' in the commit message and finally we POST via HTTP to the `/repos///statuses/` API endpoint with the status. +نأمل أن يكون هذا بسيطاً (simple) بما يكفي لمتابعته (follow). +في معالج مشغل الويب (web hook handler) هذا، نبحث في كل عملية تأكيد (commit) تم دفعها (pushed) للتو، ونبحث عن السلسلة 'Signed-off-by' في رسالة التأكيد (commit message) وأخيراً نقوم بعملية POST عبر HTTP إلى نقطة نهاية API (API endpoint) `/repos///statuses/` مع الحالة (status). -In this case you can send a state ('success', 'failure', 'error'), a description of what happened, a target URL the user can go to for more information and a "`context`" in case there are multiple statuses for a single commit. -For example, a testing service may provide a status and a validation service like this may also provide a status -- the "`context`" field is how they're differentiated. +في هذه الحالة، يمكنك إرسال حالة (state) ('success', 'failure', 'error')، ووصف (description) لما حدث، وعنوان URL هدف (target URL) يمكن للمستخدم الانتقال إليه للحصول على مزيد من المعلومات، و "`سياق`" ("`context`") في حالة وجود حالات متعددة (multiple statuses) لتأكيد واحد (single commit). +على سبيل المثال، قد توفر خدمة اختبار (testing service) حالة (status) وقد توفر خدمة تحقق (validation service) مثل هذه حالة أيضاً -- حقل "`سياق`" ("`context`") هو كيفية التمييز (differentiated) بينها. -If someone opens a new Pull Request on GitHub and this hook is set up, you may see something like <<_commit_status>>. +إذا فتح شخص ما طلب سحب (Pull Request) جديداً على GitHub وتم إعداد هذا المشغل (hook)، فقد ترى شيئاً مثل <<_commit_status>>. [[_commit_status]] -.Commit status via the API +.Commit status via the API (حالة التأكيد عبر API) image::images/scripting-07-status.png[Commit status via the API] -You can now see a little green check mark next to the commit that has a "`Signed-off-by`" string in the message and a red cross through the one where the author forgot to sign off. -You can also see that the Pull Request takes the status of the last commit on the branch and warns you if it is a failure. -This is really useful if you're using this API for test results so you don't accidentally merge something where the last commit is failing tests. +يمكنك الآن رؤية علامة اختيار (check mark) خضراء صغيرة بجوار عملية التأكيد (commit) التي تحتوي على سلسلة "`Signed-off-by`" في الرسالة وصليب أحمر (red cross) خلال تلك التي نسي المؤلف (author) التوقيع (sign off) عليها. +يمكنك أيضاً أن ترى أن طلب السحب (Pull Request) يأخذ حالة (status) التأكيد الأخير (last commit) على الفرع (branch) ويحذرك (warns you) إذا كان فاشلاً (failure). +يعد هذا مفيداً حقاً إذا كنت تستخدم API هذا لنتائج الاختبار (test results) بحيث لا تدمج (merge) شيئاً عن طريق الخطأ (accidentally) حيث يفشل التأكيد الأخير (last commit is failing) في الاختبارات (tests). -==== Octokit +==== Octokit (مكتبة Octokit) -Though we've been doing nearly everything through `curl` and simple HTTP requests in these examples, several open-source libraries exist that make this API available in a more idiomatic way. -At the time of this writing, the supported languages include Go, Objective-C, Ruby, and .NET. -Check out https://github.com/octokit[^] for more information on these, as they handle much of the HTTP for you. +على الرغم من أننا كنا نفعل كل شيء تقريباً من خلال `curl` وطلبات HTTP (HTTP requests) البسيطة في هذه الأمثلة، إلا أن هناك العديد من المكتبات مفتوحة المصدر (open-source libraries) التي تجعل واجهة برمجة التطبيقات (API) هذه متاحة بطريقة أكثر اصطلاحية (idiomatic). +في وقت كتابة هذا التقرير، تتضمن اللغات المدعومة (supported languages) Go و Objective-C و Ruby و .NET. +تحقق من https://github.com/octokit[^] للحصول على مزيد من المعلومات حول هذه اللغات، حيث إنها تتعامل مع الكثير من بروتوكول HTTP نيابة عنك. -Hopefully these tools can help you customize and modify GitHub to work better for your specific workflows. -For complete documentation on the entire API as well as guides for common tasks, check out https://docs.github.com/[^]. +نأمل أن تساعدك هذه الأدوات (tools) في تخصيص (customize) GitHub وتعديله (modify) ليعمل بشكل أفضل لسير العمل (workflows) الخاص بك. +للحصول على وثائق (documentation) كاملة حول واجهة برمجة التطبيقات (API) بأكملها بالإضافة إلى أدلة (guides) للمهام الشائعة (common tasks)، تحقق من https://docs.github.com/[^]. diff --git a/book/07-git-tools/sections/advanced-merging.asc b/book/07-git-tools/sections/advanced-merging.asc index 7ace27bcd..cdcf382e8 100644 --- a/book/07-git-tools/sections/advanced-merging.asc +++ b/book/07-git-tools/sections/advanced-merging.asc @@ -1,28 +1,28 @@ [[_advanced_merging]] -=== Advanced Merging +=== Advanced Merging (الدمج المتقدم) -Merging in Git is typically fairly easy. -Since Git makes it easy to merge another branch multiple times, it means that you can have a very long lived branch but you can keep it up to date as you go, solving small conflicts often, rather than be surprised by one enormous conflict at the end of the series. +عادة ما يكون الدمج (Merging) في Git سهلاً إلى حد ما. +نظراً لأن Git يجعل من السهل دمج فرع (branch) آخر عدة مرات، فهذا يعني أنه يمكن أن يكون لديك فرع طويل الأمد (long lived branch) ولكن يمكنك إبقاؤه محدثاً (up to date) أثناء تقدمك، وحل التعارضات الصغيرة (small conflicts) غالباً، بدلاً من أن تتفاجأ بتعارض هائل (enormous conflict) واحد في نهاية السلسلة. -However, sometimes tricky conflicts do occur. -Unlike some other version control systems, Git does not try to be overly clever about merge conflict resolution. -Git's philosophy is to be smart about determining when a merge resolution is unambiguous, but if there is a conflict, it does not try to be clever about automatically resolving it. -Therefore, if you wait too long to merge two branches that diverge quickly, you can run into some issues. +ومع ذلك، تحدث أحياناً تعارضات صعبة (tricky conflicts). +على عكس بعض أنظمة التحكم في الإصدارات الأخرى، لا يحاول Git أن يكون ذكياً جداً بشأن حل تعارضات الدمج (merge conflict resolution). +تتمثل فلسفة Git في أن يكون ذكياً بشأن تحديد متى يكون حل الدمج (merge resolution) غير غامض (unambiguous)، ولكن إذا كان هناك تعارض، فإنه لا يحاول أن يكون ذكياً بشأن حله تلقائياً. +لذلك، إذا انتظرت طويلاً لدمج فرعين يتباعدان (diverge) بسرعة، فقد تواجه بعض المشكلات (issues). -In this section, we'll go over what some of those issues might be and what tools Git gives you to help handle these more tricky situations. -We'll also cover some of the different, non-standard types of merges you can do, as well as see how to back out of merges that you've done. +في هذا القسم، سنستعرض ماهية بعض هذه المشكلات والأدوات التي يوفرها لك Git للمساعدة في التعامل مع هذه المواقف (situations) الأكثر صعوبة. +سنغطي أيضاً بعض الأنواع المختلفة وغير القياسية (non-standard types) من عمليات الدمج التي يمكنك القيام بها، بالإضافة إلى معرفة كيفية التراجع (back out) عن عمليات الدمج التي قمت بها. -==== Merge Conflicts +==== Merge Conflicts (تعارضات الدمج) -While we covered some basics on resolving merge conflicts in <>, for more complex conflicts, Git provides a few tools to help you figure out what's going on and how to better deal with the conflict. +بينما قمنا بتغطية بعض الأساسيات (basics) حول حل تعارضات الدمج في <>، بالنسبة للتعارضات الأكثر تعقيداً (complex conflicts)، يوفر Git بعض الأدوات لمساعدتك في معرفة (figure out) ما يجري وكيفية التعامل مع التعارض بشكل أفضل. -First of all, if at all possible, try to make sure your working directory is clean before doing a merge that may have conflicts. -If you have work in progress, either commit it to a temporary branch or stash it. -This makes it so that you can undo *anything* you try here. -If you have unsaved changes in your working directory when you try a merge, some of these tips may help you preserve that work. +أولاً وقبل كل شيء، إذا كان ذلك ممكناً على الإطلاق، فحاول التأكد من أن دليل عملك (working directory) نظيف قبل إجراء عملية دمج قد تحتوي على تعارضات. +إذا كان لديك عمل قيد التقدم (work in progress)، فإما أن تقوم بتأكيده (commit it) في فرع مؤقت (temporary branch) أو تخبئته (stash it). +هذا يجعلك قادراً على التراجع (undo) عن *أي شيء* تحاوله هنا. +إذا كانت لديك تغييرات غير محفوظة (unsaved changes) في دليل عملك عند محاولة الدمج، فقد تساعدك بعض هذه النصائح (tips) في الحفاظ (preserve) على هذا العمل. -Let's walk through a very simple example. -We have a super simple Ruby file that prints 'hello world'. +دعونا نمر بمثال بسيط جداً (very simple example). +لدينا ملف Ruby بسيط جداً يطبع 'hello world'. [source,ruby] ---- @@ -35,8 +35,8 @@ end hello() ---- -In our repository, we create a new branch named `whitespace` and proceed to change all the Unix line endings to DOS line endings, essentially changing every line of the file, but just with whitespace. -Then we change the line "`hello world`" to "`hello mundo`". +في مستودعنا (repository)، نقوم بإنشاء فرع جديد يسمى `whitespace` ونشرع في تغيير جميع نهايات أسطر Unix (Unix line endings) إلى نهايات أسطر DOS (DOS line endings)، وتغيير كل سطر من الملف بشكل أساسي، ولكن فقط بمسافات بيضاء (whitespace). +ثم نغير السطر "`hello world`" إلى "`hello mundo`". [source,console] ---- @@ -70,7 +70,7 @@ $ git commit -am 'Use Spanish instead of English' 1 file changed, 1 insertion(+), 1 deletion(-) ---- -Now we switch back to our `master` branch and add some documentation for the function. +الآن نعود إلى فرع `master` الخاص بنا ونضيف بعض الوثائق (documentation) للدالة (function). [source,console] ---- @@ -96,7 +96,7 @@ $ git commit -am 'Add comment documenting the function' 1 file changed, 1 insertion(+) ---- -Now we try to merge in our `whitespace` branch and we'll get conflicts because of the whitespace changes. +الآن نحاول دمج (merge) فرع `whitespace` الخاص بنا وسنحصل على تعارضات (conflicts) بسبب تغييرات المسافات البيضاء. [source,console] ---- @@ -107,11 +107,11 @@ Automatic merge failed; fix conflicts and then commit the result. ---- [[_abort_merge]] -===== Aborting a Merge +===== Aborting a Merge (إلغاء عملية الدمج) -We now have a few options. -First, let's cover how to get out of this situation. -If you perhaps weren't expecting conflicts and don't want to quite deal with the situation yet, you can simply back out of the merge with `git merge --abort`. +لدينا الآن بعض الخيارات (options). +أولاً، دعنا نغطي كيفية الخروج من هذا الموقف (situation). +إذا لم تكن تتوقع (expecting) حدوث تعارضات ولا تريد التعامل (deal) مع الموقف بعد، يمكنك ببساطة التراجع (back out) عن الدمج باستخدام `git merge --abort`. [source,console] ---- @@ -125,21 +125,21 @@ $ git status -sb ## master ---- -The `git merge --abort` option tries to revert back to your state before you ran the merge. -The only cases where it may not be able to do this perfectly would be if you had unstashed, uncommitted changes in your working directory when you ran it, otherwise it should work fine. +يحاول خيار `git merge --abort` العودة (revert) إلى حالتك قبل تشغيل الدمج. +الحالات الوحيدة (only cases) التي قد لا يكون قادراً فيها على القيام بذلك بشكل مثالي هي إذا كانت لديك تغييرات تم التراجع عن تخبئتها (unstashed) وغير مؤكدة (uncommitted) في دليل عملك (working directory) عند تشغيله، بخلاف ذلك يجب أن يعمل بشكل جيد (work fine). -If for some reason you just want to start over, you can also run `git reset --hard HEAD`, and your repository will be back to the last committed state. -Remember that any uncommitted work will be lost, so make sure you don't want any of your changes. +إذا كنت تريد فقط البدء من جديد (start over) لسبب ما، يمكنك أيضاً تشغيل `git reset --hard HEAD`، وسيعود مستودعك (repository) إلى آخر حالة مؤكدة (last committed state). +تذكر أنه سيتم فقدان أي عمل غير مؤكد (uncommitted work)، لذا تأكد من أنك لا تريد أياً من تغييراتك. -===== Ignoring Whitespace +===== Ignoring Whitespace (تجاهل المسافات البيضاء) -In this specific case, the conflicts are whitespace related. -We know this because the case is simple, but it's also pretty easy to tell in real cases when looking at the conflict because every line is removed on one side and added again on the other. -By default, Git sees all of these lines as being changed, so it can't merge the files. +في هذه الحالة المحددة (specific case)، ترتبط التعارضات (conflicts) بالمسافات البيضاء (whitespace). +نعرف هذا لأن الحالة بسيطة، ولكن من السهل جداً معرفة ذلك في الحالات الحقيقية (real cases) عند النظر إلى التعارض لأن كل سطر تمت إزالته على أحد الجانبين (one side) وإضافته مرة أخرى على الجانب الآخر. +بشكل افتراضي، يرى Git أن كل هذه الأسطر قد تم تغييرها، لذلك لا يمكنه دمج الملفات. -The default merge strategy can take arguments though, and a few of them are about properly ignoring whitespace changes. -If you see that you have a lot of whitespace issues in a merge, you can simply abort it and do it again, this time with `-Xignore-all-space` or `-Xignore-space-change`. -The first option ignores whitespace *completely* when comparing lines, the second treats sequences of one or more whitespace characters as equivalent. +يمكن لاستراتيجية الدمج الافتراضية (default merge strategy) أن تأخذ وسيطات (arguments) مع ذلك، ويتعلق بعضها بتجاهل (ignoring) تغييرات المسافات البيضاء بشكل صحيح. +إذا رأيت أن لديك الكثير من مشكلات المسافات البيضاء (whitespace issues) في عملية دمج، يمكنك ببساطة إحباطها (abort it) والقيام بها مرة أخرى، هذه المرة باستخدام `-Xignore-all-space` أو `-Xignore-space-change`. +يتجاهل الخيار الأول المسافات البيضاء *تماماً* عند مقارنة الأسطر، بينما يتعامل الثاني مع تسلسلات (sequences) حرف مسافة بيضاء واحد أو أكثر كمتكافئة (equivalent). [source,console] ---- @@ -150,28 +150,28 @@ Merge made by the 'recursive' strategy. 1 file changed, 1 insertion(+), 1 deletion(-) ---- -Since in this case, the actual file changes were not conflicting, once we ignore the whitespace changes, everything merges just fine. +نظراً لأنه في هذه الحالة، لم تكن تغييرات الملفات الفعلية متعارضة (conflicting)، بمجرد أن نتجاهل تغييرات المسافات البيضاء، يتم دمج كل شيء بشكل جيد. -This is a lifesaver if you have someone on your team who likes to occasionally reformat everything from spaces to tabs or vice-versa. +يعد هذا منقذاً للحياة (lifesaver) إذا كان لديك شخص في فريقك يحب من حين لآخر إعادة تنسيق (reformat) كل شيء من مسافات (spaces) إلى علامات تبويب (tabs) أو العكس (vice-versa). [[_manual_remerge]] -===== Manual File Re-merging +===== Manual File Re-merging (إعادة الدمج اليدوي للملفات) -Though Git handles whitespace pre-processing pretty well, there are other types of changes that perhaps Git can't handle automatically, but are scriptable fixes. -As an example, let's pretend that Git could not handle the whitespace change and we needed to do it by hand. +على الرغم من أن Git يتعامل مع المعالجة المسبقة للمسافات البيضاء (whitespace pre-processing) بشكل جيد، إلا أن هناك أنواعاً أخرى من التغييرات التي ربما لا يستطيع Git التعامل معها تلقائياً، ولكنها إصلاحات قابلة للبرمجة (scriptable fixes). +كمثال، لنتظاهر (pretend) أن Git لا يمكنه التعامل مع تغيير المسافة البيضاء وكنا بحاجة إلى القيام بذلك يدوياً (by hand). -What we really need to do is run the file we're trying to merge in through a `dos2unix` program before trying the actual file merge. -So how would we do that? +ما نحتاج حقاً للقيام به هو تشغيل الملف الذي نحاول دمجه من خلال برنامج `dos2unix` قبل محاولة دمج الملف الفعلي (actual file merge). +إذن كيف نفعل ذلك؟ -First, we get into the merge conflict state. -Then we want to get copies of our version of the file, their version (from the branch we're merging in) and the common version (from where both sides branched off). -Then we want to fix up either their side or our side and re-try the merge again for just this single file. +أولاً، ندخل في حالة تعارض الدمج (merge conflict state). +ثم نريد الحصول على نسخ (copies) من نسختنا من الملف (our version)، ونسختهم (their version - من الفرع الذي ندمجه) والنسخة المشتركة (common version - من حيث تفرع كلا الجانبين). +ثم نريد إصلاح (fix up) جانبهم أو جانبنا وإعادة محاولة (re-try) الدمج مرة أخرى لهذا الملف الواحد فقط. -Getting the three file versions is actually pretty easy. -Git stores all of these versions in the index under "`stages`" which each have numbers associated with them. -Stage 1 is the common ancestor, stage 2 is your version and stage 3 is from the `MERGE_HEAD`, the version you're merging in ("`theirs`"). +يعد الحصول على إصدارات (versions) الملف الثلاثة أمراً سهلاً للغاية. +يخزن Git كل هذه الإصدارات في الفهرس (index) ضمن "`المراحل (stages)`" والتي يرتبط كل منها بأرقام (numbers associated). +المرحلة 1 (Stage 1) هي السلف المشترك (common ancestor)، والمرحلة 2 هي نسختك والمرحلة 3 مأخوذة من `MERGE_HEAD`، النسخة التي تقوم بدمجها ("`theirs`"). -You can extract a copy of each of these versions of the conflicted file with the `git show` command and a special syntax. +يمكنك استخراج (extract) نسخة من كل إصدار من هذه الإصدارات من الملف المتعارض باستخدام الأمر `git show` وبنية (syntax) خاصة. [source,console] ---- @@ -180,7 +180,7 @@ $ git show :2:hello.rb > hello.ours.rb $ git show :3:hello.rb > hello.theirs.rb ---- -If you want to get a little more hard core, you can also use the `ls-files -u` plumbing command to get the actual SHA-1s of the Git blobs for each of these files. +إذا كنت تريد أن تصبح أكثر احترافية (hard core)، يمكنك أيضاً استخدام أمر السباكة (plumbing command) `ls-files -u` للحصول على SHA-1s الفعلية لـ Git blobs لكل من هذه الملفات. [source,console] ---- @@ -190,9 +190,9 @@ $ git ls-files -u 100755 e85207e04dfdd5eb0a1e9febbc67fd837c44a1cd 3 hello.rb ---- -The `:1:hello.rb` is just a shorthand for looking up that blob SHA-1. +العلامة `:1:hello.rb` هي مجرد اختصار (shorthand) للبحث عن blob SHA-1 ذلك. -Now that we have the content of all three stages in our working directory, we can manually fix up theirs to fix the whitespace issue and re-merge the file with the little-known `git merge-file` command which does just that. +الآن بعد أن أصبح لدينا محتوى (content) المراحل الثلاث جميعها في دليل عملنا (working directory)، يمكننا إصلاح (fix up) الجانب الخاص بهم يدوياً لإصلاح مشكلة المسافات البيضاء (whitespace issue) وإعادة دمج (re-merge) الملف باستخدام الأمر `git merge-file` غير المعروف (little-known) والذي يقوم بذلك بالضبط. [source,console] ---- @@ -219,14 +219,14 @@ index 36c06c8,e85207e..0000000 hello() ---- -At this point we have nicely merged the file. -In fact, this actually works better than the `ignore-space-change` option because this actually fixes the whitespace changes before merge instead of simply ignoring them. -In the `ignore-space-change` merge, we actually ended up with a few lines with DOS line endings, making things mixed. +في هذه المرحلة (At this point) قمنا بدمج الملف بشكل جيد. +في الواقع، يعمل هذا في الحقيقة بشكل أفضل من الخيار `ignore-space-change` لأن هذا يعمل فعلياً على إصلاح (fixes) تغييرات المسافات البيضاء قبل الدمج بدلاً من تجاهلها ببساطة. +في الدمج بـ `ignore-space-change`، انتهى بنا الأمر في الواقع ببعض الأسطر بنهايات أسطر DOS (DOS line endings)، مما يجعل الأمور مختلطة (mixed). -If you want to get an idea before finalizing this commit about what was actually changed between one side or the other, you can ask `git diff` to compare what is in your working directory that you're about to commit as the result of the merge to any of these stages. -Let's go through them all. +إذا كنت ترغب في الحصول على فكرة قبل إنهاء هذا التأكيد (finalizing this commit) حول ما تم تغييره بالفعل بين جانب أو آخر، يمكنك أن تطلب من `git diff` مقارنة (compare) ما هو موجود في دليل عملك (working directory) والذي أنت على وشك تأكيده كنتيجة (result) للدمج إلى أي من هذه المراحل (stages). +دعونا نستعرضها جميعاً. -To compare your result to what you had in your branch before the merge, in other words, to see what the merge introduced, you can run `git diff --ours`: +لمقارنة نتيجتك بما كان لديك في فرعك قبل الدمج، وبعبارة أخرى (in other words)، لمعرفة ما أدخله (introduced) الدمج، يمكنك تشغيل `git diff --ours`: [source,console] ---- @@ -247,10 +247,10 @@ index 36c06c8..44d0a25 100755 hello() ---- -So here we can easily see that what happened in our branch, what we're actually introducing to this file with this merge, is changing that single line. +هنا يمكننا أن نرى بسهولة أن ما حدث في فرعنا (our branch)، وما نقدمه (introducing) فعلياً لهذا الملف بهذا الدمج، هو تغيير ذلك السطر الواحد (single line). -If we want to see how the result of the merge differed from what was on their side, you can run `git diff --theirs`. -In this and the following example, we have to use `-b` to strip out the whitespace because we're comparing it to what is in Git, not our cleaned up `hello.theirs.rb` file. +إذا أردنا أن نرى كيف اختلفت نتيجة (result) الدمج عما كان على جانبهم (their side)، يمكنك تشغيل `git diff --theirs`. +في هذا المثال والمثال التالي، يجب علينا استخدام `-b` لإزالة المسافات البيضاء (strip out the whitespace) لأننا نقارنه بما هو موجود في Git، وليس ملف `hello.theirs.rb` الذي تم تنظيفه. [source,console] ---- @@ -269,7 +269,7 @@ index e85207e..44d0a25 100755 end ---- -Finally, you can see how the file has changed from both sides with `git diff --base`. +أخيراً، يمكنك أن ترى كيف تغير الملف من كلا الجانبين باستخدام `git diff --base`. [source,console] ---- @@ -291,7 +291,7 @@ index ac51efd..44d0a25 100755 hello() ---- -At this point we can use the `git clean` command to clear out the extra files we created to do the manual merge but no longer need. +في هذه المرحلة، يمكننا استخدام الأمر `git clean` لمسح (clear out) الملفات الإضافية (extra files) التي أنشأناها لإجراء الدمج اليدوي (manual merge) ولكن لم نعد بحاجة إليها. [source,console] ---- @@ -302,12 +302,12 @@ Removing hello.theirs.rb ---- [[_checking_out_conflicts]] -===== Checking Out Conflicts +===== Checking Out Conflicts (التحقق من التعارضات) -Perhaps we're not happy with the resolution at this point for some reason, or maybe manually editing one or both sides still didn't work well and we need more context. +ربما لا نكون سعداء (happy) بالحل (resolution) في هذه المرحلة لسبب ما، أو ربما لا يزال التحرير اليدوي (manually editing) لأحد الجانبين أو كليهما غير جيد بشكل كافٍ ونحتاج إلى مزيد من السياق (more context). -Let's change up the example a little. -For this example, we have two longer lived branches that each have a few commits in them but create a legitimate content conflict when merged. +دعونا نغير المثال (example) قليلاً. +في هذا المثال، لدينا فرعان (two branches) طويلان الأمد (longer lived) يحتوي كل منهما على عدد قليل من التأكيدات (commits) ولكنهما ينشئان تعارض محتوى شرعي (legitimate content conflict) عند دمجهما. [source,console] ---- @@ -322,8 +322,8 @@ $ git log --graph --oneline --decorate --all * b7dcc89 Initial hello world code ---- -We now have three unique commits that live only on the `master` branch and three others that live on the `mundo` branch. -If we try to merge the `mundo` branch in, we get a conflict. +لدينا الآن ثلاثة تأكيدات (commits) فريدة موجودة فقط في فرع `master` وثلاثة تأكيدات أخرى موجودة في فرع `mundo`. +إذا حاولنا دمج فرع `mundo`، فسنحصل على تعارض (conflict). [source,console] ---- @@ -333,8 +333,8 @@ CONFLICT (content): Merge conflict in hello.rb Automatic merge failed; fix conflicts and then commit the result. ---- -We would like to see what the merge conflict is. -If we open up the file, we'll see something like this: +نود أن نرى ما هو تعارض الدمج (merge conflict). +إذا فتحنا الملف، فسنرى شيئاً كالتالي: [source,ruby] ---- @@ -351,25 +351,25 @@ end hello() ---- -Both sides of the merge added content to this file, but some of the commits modified the file in the same place that caused this conflict. +أضاف كلا جانبي الدمج (both sides of the merge) محتوى (content) إلى هذا الملف، لكن بعض التأكيدات (commits) عدلت الملف في نفس المكان مما تسبب في هذا التعارض. -Let's explore a couple of tools that you now have at your disposal to determine how this conflict came to be. -Perhaps it's not obvious how exactly you should fix this conflict. -You need more context. +دعنا نستكشف (explore) بضع أدوات أصبحت تحت تصرفك (at your disposal) لتحديد كيف نشأ (came to be) هذا التعارض. +ربما ليس من الواضح تماماً كيف يجب عليك إصلاح (fix) هذا التعارض. +تحتاج إلى مزيد من السياق (more context). -One helpful tool is `git checkout` with the `--conflict` option. -This will re-checkout the file again and replace the merge conflict markers. -This can be useful if you want to reset the markers and try to resolve them again. +إحدى الأدوات المفيدة هي `git checkout` مع الخيار `--conflict`. +سيؤدي هذا إلى إعادة التحقق (re-checkout) من الملف مرة أخرى واستبدال علامات تعارض الدمج (merge conflict markers). +قد يكون هذا مفيداً إذا كنت تريد إعادة تعيين (reset) العلامات ومحاولة حلها مرة أخرى. -You can pass `--conflict` either `diff3` or `merge` (which is the default). -If you pass it `diff3`, Git will use a slightly different version of conflict markers, not only giving you the "`ours`" and "`theirs`" versions, but also the "`base`" version inline to give you more context. +يمكنك تمرير إما `diff3` أو `merge` (وهو الافتراضي) للخيار `--conflict`. +إذا مررت له `diff3`، فسيستخدم Git إصداراً (version) مختلفاً قليلاً من علامات التعارض، حيث لا يعطيك إصدارات "`ours`" و "`theirs`" فحسب، بل يمنحك أيضاً الإصدار "`base`" مضمناً (inline) لمنحك المزيد من السياق. [source,console] ---- $ git checkout --conflict=diff3 hello.rb ---- -Once we run that, the file will look like this instead: +بمجرد تشغيل ذلك، سيبدو الملف هكذا بدلاً من ذلك: [source,ruby] ---- @@ -388,25 +388,25 @@ end hello() ---- -If you like this format, you can set it as the default for future merge conflicts by setting the `merge.conflictstyle` setting to `diff3`. +إذا أعجبك (like) هذا التنسيق، فيمكنك تعيينه (set it) كإعداد افتراضي لتعارضات الدمج المستقبلية عن طريق تعيين إعداد `merge.conflictstyle` إلى `diff3`. [source,console] ---- $ git config --global merge.conflictstyle diff3 ---- -The `git checkout` command can also take `--ours` and `--theirs` options, which can be a really fast way of just choosing either one side or the other without merging things at all. +يمكن أن يأخذ الأمر `git checkout` أيضاً الخيارين `--ours` و `--theirs`، والذي يمكن أن يكون طريقة سريعة جداً (really fast way) لاختيار (choosing) أحد الجانبين أو الآخر دون دمج الأشياء على الإطلاق. -This can be particularly useful for conflicts of binary files where you can simply choose one side, or where you only want to merge certain files in from another branch -- you can do the merge and then checkout certain files from one side or the other before committing. +يمكن أن يكون هذا مفيداً بشكل خاص (particularly useful) لتعارضات الملفات الثنائية (binary files) حيث يمكنك ببساطة اختيار جانب واحد، أو حيث تريد فقط دمج ملفات معينة (certain files) من فرع آخر -- يمكنك إجراء الدمج (do the merge) ثم التحقق من ملفات معينة (checkout certain files) من جانب أو آخر قبل التأكيد (committing). [[_merge_log]] -===== Merge Log +===== Merge Log (سجل الدمج) -Another useful tool when resolving merge conflicts is `git log`. -This can help you get context on what may have contributed to the conflicts. -Reviewing a little bit of history to remember why two lines of development were touching the same area of code can be really helpful sometimes. +أداة أخرى مفيدة (useful tool) عند حل تعارضات الدمج (merge conflicts) هي `git log`. +يمكن أن يساعدك هذا في الحصول على سياق (context) حول ما قد ساهم في التعارضات. +يمكن أن تكون مراجعة القليل من السجل (history) لتذكر سبب تلامس (touching) خطي تطوير (lines of development) مع نفس المنطقة من الكود مفيدة حقاً في بعض الأحيان. -To get a full list of all of the unique commits that were included in either branch involved in this merge, we can use the "`triple dot`" syntax that we learned in <>. +للحصول على قائمة كاملة (full list) بجميع التأكيدات (commits) الفريدة التي تم تضمينها في أي من الفرعين المعنيين (involved) في هذا الدمج، يمكننا استخدام بنية (syntax) "`النقاط الثلاث (triple dot)`" التي تعلمناها في <>. [source,console] ---- @@ -419,10 +419,10 @@ $ git log --oneline --left-right HEAD...MERGE_HEAD > c3ffff1 Change text to 'hello mundo' ---- -That's a nice list of the six total commits involved, as well as which line of development each commit was on. +هذه قائمة (list) لطيفة من إجمالي ستة تأكيدات معنية، بالإضافة إلى خط التطوير (line of development) الذي كان عليه كل تأكيد. -We can further simplify this though to give us much more specific context. -If we add the `--merge` option to `git log`, it will only show the commits in either side of the merge that touch a file that's currently conflicted. +ومع ذلك، يمكننا تبسيط (simplify) هذا أكثر لمنحنا سياقاً (context) أكثر تحديداً. +إذا أضفنا الخيار `--merge` إلى `git log`، فلن يُظهر (show) سوى التأكيدات الموجودة في أي من جانبي الدمج والتي تمس (touch) ملفاً متعارضاً (conflicted) حالياً. [source,console] ---- @@ -431,15 +431,15 @@ $ git log --oneline --left-right --merge > c3ffff1 Change text to 'hello mundo' ---- -If you run that with the `-p` option instead, you get just the diffs to the file that ended up in conflict. -This can be *really* helpful in quickly giving you the context you need to help understand why something conflicts and how to more intelligently resolve it. +إذا قمت بتشغيل ذلك باستخدام الخيار `-p` بدلاً من ذلك، فستحصل فقط على الفروق (diffs) للملف الذي انتهى به الأمر في التعارض. +يمكن أن يكون هذا *مفيداً جداً (really helpful)* في إعطائك بسرعة السياق (context) الذي تحتاجه للمساعدة في فهم سبب تعارض شيء ما وكيفية حله (resolve it) بذكاء أكثر (intelligently). -===== Combined Diff Format +===== Combined Diff Format (تنسيق الفرق المدمج) -Since Git stages any merge results that are successful, when you run `git diff` while in a conflicted merge state, you only get what is currently still in conflict. -This can be helpful to see what you still have to resolve. +نظراً لأن Git يقوم بتجهيز (stages) أي نتائج دمج (merge results) ناجحة، فعندما تقوم بتشغيل `git diff` أثناء وجودك في حالة دمج متعارضة (conflicted merge state)، فإنك تحصل فقط على ما لا يزال قيد التعارض (still in conflict) حالياً. +يمكن أن يكون هذا مفيداً لمعرفة (see) ما لا يزال يتعين عليك حله (resolve). -When you run `git diff` directly after a merge conflict, it will give you information in a rather unique diff output format. +عندما تقوم بتشغيل `git diff` مباشرة بعد تعارض الدمج (merge conflict)، فإنه سيعطيك معلومات في تنسيق مخرجات فرق (diff output format) فريد (unique) نوعاً ما. [source,console] ---- @@ -462,13 +462,13 @@ index 0399cd5,59727f0..0000000 hello() ---- -The format is called "`Combined Diff`" and gives you two columns of data next to each line. -The first column shows you if that line is different (added or removed) between the "`ours`" branch and the file in your working directory and the second column does the same between the "`theirs`" branch and your working directory copy. +يُطلق على التنسيق اسم "`Combined Diff`" ("`الفرق المدمج`") ويمنحك عمودين (two columns) من البيانات بجوار كل سطر. +يوضح لك العمود الأول (first column) ما إذا كان هذا السطر مختلفاً (مضافاً أو محذوفاً) بين فرع "`ours`" والملف الموجود في دليل عملك (working directory) ويقوم العمود الثاني (second column) بنفس الشيء بين فرع "`theirs`" ونسخة دليل العمل الخاصة بك. -So in that example you can see that the `<<<<<<<` and `>>>>>>>` lines are in the working copy but were not in either side of the merge. -This makes sense because the merge tool stuck them in there for our context, but we're expected to remove them. +لذلك في هذا المثال (example)، يمكنك أن ترى أن الأسطر `<<<<<<<` و `>>>>>>>` موجودة في نسخة العمل (working copy) ولكن لم تكن في أي من جانبي الدمج. +هذا منطقي (makes sense) لأن أداة الدمج (merge tool) ألصقتها (stuck them) هناك من أجل سياقنا، ولكن يُتوقع منا (expected) إزالتها. -If we resolve the conflict and run `git diff` again, we'll see the same thing, but it's a little more useful. +إذا قمنا بحل التعارض (resolve the conflict) وتشغيل `git diff` مرة أخرى، فسنرى نفس الشيء، ولكنه أكثر فائدة (useful) بقليل. [source,console] ---- @@ -490,11 +490,11 @@ index 0399cd5,59727f0..0000000 hello() ---- -This shows us that "`hola world`" was in our side but not in the working copy, that "`hello mundo`" was in their side but not in the working copy and finally that "`hola mundo`" was not in either side but is now in the working copy. -This can be useful to review before committing the resolution. +يوضح لنا هذا أن "`hola world`" كانت في جانبنا ولكن لم تكن في نسخة العمل (working copy)، وأن "`hello mundo`" كانت في جانبهم ولكن لم تكن في نسخة العمل وأخيراً أن "`hola mundo`" لم تكن في كلا الجانبين ولكنها الآن في نسخة العمل. +يمكن أن يكون هذا مفيداً للمراجعة (review) قبل تأكيد الحل (committing the resolution). -You can also get this from the `git log` for any merge to see how something was resolved after the fact. -Git will output this format if you run `git show` on a merge commit, or if you add a `--cc` option to a `git log -p` (which by default only shows patches for non-merge commits). +يمكنك أيضاً الحصول على هذا من سجل `git log` لأي عملية دمج لمعرفة كيف تم حل (resolved) شيء ما بعد الواقعة (after the fact). +سيقوم Git بإخراج (output) هذا التنسيق إذا قمت بتشغيل `git show` على تأكيد دمج (merge commit)، أو إذا قمت بإضافة الخيار `--cc` إلى `git log -p` (والذي يُظهر (shows) التصحيحات - patches - افتراضياً فقط للتأكيدات غير المدمجة - non-merge commits). [source,console] ---- @@ -526,44 +526,44 @@ index 0399cd5,59727f0..e1d0799 ---- [[_undoing_merges]] -==== Undoing Merges +==== Undoing Merges (التراجع عن عمليات الدمج) -Now that you know how to create a merge commit, you'll probably make some by mistake. -One of the great things about working with Git is that it's okay to make mistakes, because it's possible (and in many cases easy) to fix them. +الآن بعد أن عرفت كيفية إنشاء تأكيد دمج (merge commit)، فمن المحتمل أن تقوم ببعضها عن طريق الخطأ (by mistake). +أحد الأشياء العظيمة (great things) في العمل مع Git هو أنه لا بأس من ارتكاب الأخطاء، لأنه من الممكن (وفي كثير من الحالات (cases) سهل) إصلاحها (fix them). -Merge commits are no different. -Let's say you started work on a topic branch, accidentally merged it into `master`, and now your commit history looks like this: +تأكيدات الدمج (Merge commits) لا تختلف (no different). +لنفترض أنك بدأت العمل (work) في فرع موضوع (topic branch)، وقمت بدمجه (merged it) عن طريق الخطأ في `master`، والآن يبدو سجل التأكيدات (commit history) الخاص بك كالتالي: -.Accidental merge commit +.Accidental merge commit (تأكيد دمج عرضي) image::images/undomerge-start.png[Accidental merge commit] -There are two ways to approach this problem, depending on what your desired outcome is. +هناك طريقتان (two ways) للتعامل (approach) مع هذه المشكلة، اعتماداً على ما هي النتيجة المرجوة (desired outcome). -===== Fix the references +===== Fix the references (إصلاح المراجع) -If the unwanted merge commit only exists on your local repository, the easiest and best solution is to move the branches so that they point where you want them to. -In most cases, if you follow the errant `git merge` with `git reset --hard HEAD~`, this will reset the branch pointers so they look like this: +إذا كان تأكيد الدمج (merge commit) غير المرغوب فيه (unwanted) موجوداً فقط في مستودعك المحلي (local repository)، فإن الحل الأسهل والأفضل هو نقل (move) الفروع (branches) بحيث تشير إلى حيث تريدها. +في معظم الحالات (most cases)، إذا تابعت الدمج الخاطئ (errant `git merge`) بالأمر `git reset --hard HEAD~`، فسيؤدي ذلك إلى إعادة تعيين مؤشرات الفروع (branch pointers) بحيث تبدو كالتالي: -.History after `git reset --hard HEAD~` +.History after `git reset --hard HEAD~` (السجل بعد `git reset --hard HEAD~`) image::images/undomerge-reset.png[History after `git reset --hard HEAD~`] -We covered `reset` back in <>, so it shouldn't be too hard to figure out what's going on here. -Here's a quick refresher: `reset --hard` usually goes through three steps: +لقد قمنا بتغطية (covered) `reset` بالعودة إلى <>، لذلك لا ينبغي أن يكون من الصعب جداً معرفة (figure out) ما يجري هنا. +إليك تحديث (refresher) سريع: يمر `reset --hard` عادة بثلاث خطوات: -. Move the branch HEAD points to. - In this case, we want to move `master` to where it was before the merge commit (`C6`). -. Make the index look like HEAD. -. Make the working directory look like the index. +. نقل الفرع (branch) الذي يشير إليه HEAD. + في هذه الحالة (case)، نريد نقل `master` إلى حيث كان قبل تأكيد الدمج (`C6`). +. جعل الفهرس (index) يبدو مثل HEAD. +. جعل دليل العمل (working directory) يبدو مثل الفهرس. -The downside of this approach is that it's rewriting history, which can be problematic with a shared repository. -Check out <> for more on what can happen; the short version is that if other people have the commits you're rewriting, you should probably avoid `reset`. -This approach also won't work if any other commits have been created since the merge; moving the refs would effectively lose those changes. +الجانب السلبي (downside) لهذا النهج (approach) هو أنه يعيد كتابة السجل (rewriting history)، مما قد يكون مشكلة في مستودع مشترك (shared repository). +راجع (Check out) <> لمزيد من المعلومات حول ما يمكن أن يحدث؛ النسخة القصيرة هي أنه إذا كان لدى أشخاص آخرين التأكيدات (commits) التي تقوم بإعادة كتابتها، فربما ينبغي عليك تجنب (avoid) استخدام `reset`. +لن ينجح (won't work) هذا النهج أيضاً إذا تم إنشاء (created) أي تأكيدات أخرى منذ الدمج؛ فإن نقل المراجع (refs) من شأنه أن يفقد (lose) تلك التغييرات فعلياً (effectively). [[_reverse_commit]] -===== Reverse the commit +===== Reverse the commit (عكس التأكيد) -If moving the branch pointers around isn't going to work for you, Git gives you the option of making a new commit which undoes all the changes from an existing one. -Git calls this operation a "`revert`", and in this particular scenario, you'd invoke it like this: +إذا لم ينجح (work) نقل مؤشرات الفروع (branch pointers) في حالتك، يمنحك Git خيار (option) إنشاء تأكيد جديد (new commit) يتراجع (undoes) عن جميع التغييرات (changes) من التأكيد الحالي (existing one). +يطلق Git على هذه العملية (operation) اسم "`عكس`" ("`revert`")، وفي هذا السيناريو المحدد (particular scenario)، يمكنك استدعاؤها (invoke it) كالتالي: [source,console] ---- @@ -571,17 +571,17 @@ $ git revert -m 1 HEAD [master b1d8379] Revert "Merge branch 'topic'" ---- -The `-m 1` flag indicates which parent is the "`mainline`" and should be kept. -When you invoke a merge into `HEAD` (`git merge topic`), the new commit has two parents: the first one is `HEAD` (`C6`), and the second is the tip of the branch being merged in (`C4`). -In this case, we want to undo all the changes introduced by merging in parent #2 (`C4`), while keeping all the content from parent #1 (`C6`). +تشير العلامة (flag) `-m 1` إلى الوالد (parent) الذي هو الـ "`خط الرئيسي`" ("`mainline`") ويجب الاحتفاظ به (kept). +عندما تستدعي دمجاً في `HEAD` (`git merge topic`)، فإن التأكيد الجديد (new commit) له والدان (two parents): الأول هو `HEAD` (`C6`)، والثاني هو طرف (tip) الفرع الذي يتم دمجه (`C4`). +في هذه الحالة (case)، نريد التراجع (undo) عن جميع التغييرات التي تم إدخالها (introduced) من خلال الدمج في الوالد رقم 2 (`C4`)، مع الاحتفاظ بجميع المحتويات (content) من الوالد رقم 1 (`C6`). -The history with the revert commit looks like this: +يبدو السجل (history) الذي يحتوي على تأكيد التراجع (revert commit) كالتالي: -.History after `git revert -m 1` +.History after `git revert -m 1` (السجل بعد `git revert -m 1`) image::images/undomerge-revert.png[History after `git revert -m 1`] -The new commit `^M` has exactly the same contents as `C6`, so starting from here it's as if the merge never happened, except that the now-unmerged commits are still in ``HEAD```'s history. -Git will get confused if you try to merge ``topic`` into ``master`` again: +التأكيد الجديد (new commit) `^M` له نفس محتويات (contents) `C6` تماماً، لذلك بدءاً من هنا يبدو الأمر كما لو أن الدمج (merge) لم يحدث أبداً (never happened)، باستثناء (except) أن التأكيدات التي أصبحت الآن غير مدمجة (now-unmerged commits) لا تزال موجودة في سجل ``HEAD``. +سيرتبك (get confused) Git إذا حاولت دمج ``topic`` في ``master`` مرة أخرى: [source,console] ---- @@ -589,13 +589,13 @@ $ git merge topic Already up-to-date. ---- -There's nothing in `topic` that isn't already reachable from `master`. -What's worse, if you add work to `topic` and merge again, Git will only bring in the changes _since_ the reverted merge: +لا يوجد شيء في `topic` لا يمكن الوصول إليه بالفعل (reachable) من `master`. +والأسوأ من ذلك (What's worse)، إذا أضفت عملاً (add work) إلى `topic` ودمجت مرة أخرى، فسوف يجلب (bring in) Git التغييرات فقط _منذ_ (since) الدمج المعكوس (reverted merge): -.History with a bad merge +.History with a bad merge (السجل مع دمج سيء) image::images/undomerge-revert2.png[History with a bad merge] -The best way around this is to un-revert the original merge, since now you want to bring in the changes that were reverted out, *then* create a new merge commit: +أفضل طريقة للالتفاف (way around) حول هذا الأمر هي التراجع عن التراجع (un-revert) عن الدمج الأصلي (original merge)، حيث أنك الآن تريد جلب (bring in) التغييرات (changes) التي تم التراجع عنها (reverted out)، *ثم* إنشاء تأكيد دمج جديد (new merge commit): [source,console] ---- @@ -604,31 +604,31 @@ $ git revert ^M $ git merge topic ---- -.History after re-merging a reverted merge +.History after re-merging a reverted merge (السجل بعد إعادة دمج دمج تم التراجع عنه) image::images/undomerge-revert3.png[History after re-merging a reverted merge] -In this example, `M` and `^M` cancel out. -`^^M` effectively merges in the changes from `C3` and `C4`, and `C8` merges in the changes from `C7`, so now `topic` is fully merged. +في هذا المثال (example)، `M` و `^M` يلغيان (cancel out) بعضهما البعض. +`^^M` يدمج فعلياً (effectively merges) التغييرات من `C3` و `C4`، و `C8` يدمج التغييرات من `C7`، لذا فإن فرع `topic` الآن مدمج بالكامل (fully merged). -==== Other Types of Merges +==== Other Types of Merges (أنواع أخرى من عمليات الدمج) -So far we've covered the normal merge of two branches, normally handled with what is called the "`recursive`" strategy of merging. -There are other ways to merge branches together however. -Let's cover a few of them quickly. +حتى الآن قمنا بتغطية الدمج العادي (normal merge) لفرعين، والذي يتم التعامل معه عادةً (normally handled) بما يُسمى استراتيجية الدمج "`العودية`" ("`recursive`"). +إلا أن هناك طرقاً أخرى (other ways) لدمج الفروع معاً. +دعونا نغطي (cover) القليل منها بسرعة. -===== Our or Theirs Preference +===== Our or Theirs Preference (تفضيل جانبنا أو جانبهم) -First of all, there is another useful thing we can do with the normal "`recursive`" mode of merging. -We've already seen the `ignore-all-space` and `ignore-space-change` options which are passed with a `-X` but we can also tell Git to favor one side or the other when it sees a conflict. +أولاً وقبل كل شيء، هناك شيء مفيد (useful thing) آخر يمكننا القيام به باستخدام وضع الدمج (mode of merging) "`العودي`" ("`recursive`") العادي. +لقد رأينا بالفعل خياري `ignore-all-space` و `ignore-space-change` اللذين يتم تمريرهما باستخدام `-X` ولكن يمكننا أيضاً إخبار Git بتفضيل (favor) جانب أو آخر عندما يرى تعارضاً (conflict). -By default, when Git sees a conflict between two branches being merged, it will add merge conflict markers into your code and mark the file as conflicted and let you resolve it. -If you would prefer for Git to simply choose a specific side and ignore the other side instead of letting you manually resolve the conflict, you can pass the `merge` command either a `-Xours` or `-Xtheirs`. +بشكل افتراضي (By default)، عندما يرى Git تعارضاً بين فرعين (two branches) يتم دمجهما، فإنه سيضيف علامات تعارض الدمج (merge conflict markers) إلى الكود الخاص بك ويضع علامة (mark) على الملف كمتعارض (conflicted) ويسمح لك بحله. +إذا كنت تفضل (prefer) أن يختار Git ببساطة جانباً معيناً (specific side) ويتجاهل الجانب الآخر بدلاً من السماح لك بحل التعارض يدوياً (manually resolve)، يمكنك تمرير أمر الدمج إما (either) `-Xours` أو `-Xtheirs`. -If Git sees this, it will not add conflict markers. -Any differences that are mergeable, it will merge. -Any differences that conflict, it will simply choose the side you specify in whole, including binary files. +إذا رأى Git ذلك، فلن يضيف علامات التعارض (conflict markers). +أي اختلافات (differences) قابلة للدمج (mergeable)، سيقوم بدمجها. +وأي اختلافات تتعارض، سيختار ببساطة الجانب الذي تحدده (specify) بالكامل (in whole)، بما في ذلك الملفات الثنائية (binary files). -If we go back to the "`hello world`" example we were using before, we can see that merging in our branch causes conflicts. +إذا عدنا إلى مثال (example) "`hello world`" الذي كنا نستخدمه من قبل، فيمكننا أن نرى أن دمج فرعنا يتسبب في تعارضات (conflicts). [source,console] ---- @@ -639,7 +639,7 @@ Resolved 'hello.rb' using previous resolution. Automatic merge failed; fix conflicts and then commit the result. ---- -However if we run it with `-Xours` or `-Xtheirs` it does not. +ومع ذلك، إذا قمنا بتشغيله باستخدام `-Xours` أو `-Xtheirs` فلن يفعل ذلك. [source,console] ---- @@ -652,17 +652,17 @@ Merge made by the 'recursive' strategy. create mode 100644 test.sh ---- -In that case, instead of getting conflict markers in the file with "`hello mundo`" on one side and "`hola world`" on the other, it will simply pick "`hola world`". -However, all the other non-conflicting changes on that branch are merged successfully in. +في هذه الحالة، بدلاً من الحصول على علامات تعارض (conflict markers) في الملف مع "`hello mundo`" على أحد الجانبين و "`hola world`" على الجانب الآخر، سيختار ببساطة "`hola world`". +ومع ذلك، يتم دمج جميع التغييرات غير المتعارضة (non-conflicting changes) الأخرى في ذلك الفرع بنجاح. -This option can also be passed to the `git merge-file` command we saw earlier by running something like `git merge-file --ours` for individual file merges. +يمكن أيضاً تمرير هذا الخيار (option) إلى الأمر `git merge-file` الذي رأيناه سابقاً عن طريق تشغيل شيء مثل `git merge-file --ours` لعمليات دمج الملفات الفردية (individual file merges). -If you want to do something like this but not have Git even try to merge changes from the other side in, there is a more draconian option, which is the "`ours`" merge _strategy_. -This is different from the "`ours`" recursive merge _option_. +إذا كنت تريد القيام بشيء من هذا القبيل ولكن لا تريد حتى أن يحاول Git دمج التغييرات (merge changes) من الجانب الآخر، فهناك خيار أكثر صرامة (more draconian)، وهو _استراتيجية (strategy)_ الدمج "`ours`". +يختلف (different) هذا عن _خيار (option)_ الدمج العودي (recursive merge) "`ours`". -This will basically do a fake merge. -It will record a new merge commit with both branches as parents, but it will not even look at the branch you're merging in. -It will simply record as the result of the merge the exact code in your current branch. +هذا سيقوم بشكل أساسي (basically) بدمج وهمي (fake merge). +سوف يسجل (record) تأكيد دمج (merge commit) جديد بكلا الفرعين كآباء (parents)، ولكنه لن ينظر (even look) حتى إلى الفرع الذي تدمجه. +سوف يسجل ببساطة كنتيجة للدمج (result of the merge) الكود الدقيق (exact code) في فرعك الحالي (current branch). [source,console] ---- @@ -672,11 +672,11 @@ $ git diff HEAD HEAD~ $ ---- -You can see that there is no difference between the branch we were on and the result of the merge. +يمكنك أن ترى أنه لا يوجد فرق (difference) بين الفرع (branch) الذي كنا فيه ونتيجة الدمج (result of the merge). -This can often be useful to basically trick Git into thinking that a branch is already merged when doing a merge later on. -For example, say you branched off a `release` branch and have done some work on it that you will want to merge back into your `master` branch at some point. -In the meantime some bugfix on `master` needs to be backported into your `release` branch. -You can merge the bugfix branch into the `release` branch and also `merge -s ours` the same branch into your `master` branch (even though the fix is already there) so when you later merge the `release` branch again, there are no conflicts from the bugfix. +يمكن أن يكون هذا مفيداً غالباً (often be useful) في خداع (trick) Git للاعتقاد بأن الفرع مدمج بالفعل (already merged) عند إجراء عملية دمج في وقت لاحق (later on). +على سبيل المثال، لنفترض أنك تفرعت من فرع `release` وقمت ببعض العمل عليه وترغب في دمجه مرة أخرى (merge back) في فرع `master` الخاص بك في وقت ما (some point). +في غضون ذلك (In the meantime)، يجب نقل (backported) بعض إصلاحات الأخطاء (bugfix) على فرع `master` إلى فرع `release` الخاص بك. +يمكنك دمج فرع إصلاح الأخطاء (bugfix branch) في فرع `release` وكذلك إجراء `merge -s ours` لنفس الفرع في فرع `master` الخاص بك (على الرغم من أن الإصلاح موجود بالفعل - already there) بحيث عندما تقوم لاحقاً بدمج فرع `release` مرة أخرى، فلن تكون هناك أي تعارضات (conflicts) من إصلاح الأخطاء. include::subtree-merges.asc[] diff --git a/book/07-git-tools/sections/bundling.asc b/book/07-git-tools/sections/bundling.asc index 79cb1b8a5..d5488d02f 100644 --- a/book/07-git-tools/sections/bundling.asc +++ b/book/07-git-tools/sections/bundling.asc @@ -1,20 +1,20 @@ [[_bundling]] -=== Bundling +=== Bundling (الحزم) -Though we've covered the common ways to transfer Git data over a network (HTTP, SSH, etc), there is actually one more way to do so that is not commonly used but can actually be quite useful. +على الرغم من أننا قمنا بتغطية الطرق الشائعة (common ways) لنقل بيانات Git عبر الشبكة (HTTP، SSH، إلخ)، إلا أن هناك في الواقع طريقة أخرى للقيام بذلك لا تُستخدم بشكل شائع ولكنها يمكن أن تكون مفيدة جداً (quite useful). -Git is capable of "`bundling`" its data into a single file. -This can be useful in various scenarios. -Maybe your network is down and you want to send changes to your co-workers. -Perhaps you're working somewhere offsite and don't have access to the local network for security reasons. -Maybe your wireless/ethernet card just broke. -Maybe you don't have access to a shared server for the moment, you want to email someone updates and you don't want to transfer 40 commits via `format-patch`. +Git قادر على "`حزم`" ("`bundling`") بياناته في ملف واحد (single file). +يمكن أن يكون هذا مفيداً في سيناريوهات مختلفة (various scenarios). +ربما تعطلت شبكتك (network is down) وتريد إرسال التغييرات إلى زملائك في العمل. +ربما تعمل في مكان ما خارج الموقع (offsite) ولا يمكنك الوصول (access) إلى الشبكة المحلية لأسباب أمنية (security reasons). +ربما تعطلت بطاقة الشبكة اللاسلكية/إيثرنت (wireless/ethernet card) الخاصة بك للتو. +ربما لا يمكنك الوصول إلى خادم مشترك (shared server) في الوقت الحالي، وتريد إرسال تحديثات لشخص ما عبر البريد الإلكتروني (email) ولا تريد نقل 40 تأكيداً (commits) عبر `format-patch`. -This is where the `git bundle` command can be helpful. -The `bundle` command will package up everything that would normally be pushed over the wire with a `git push` command into a binary file that you can email to someone or put on a flash drive, then unbundle into another repository. +هنا يمكن أن يكون الأمر `git bundle` مفيداً. +سيقوم الأمر `bundle` بحزم كل ما يتم دفعه (pushed) عادة عبر الشبكة باستخدام أمر `git push` في ملف ثنائي (binary file) يمكنك إرساله بالبريد الإلكتروني إلى شخص ما أو وضعه على محرك أقراص محمول (flash drive)، ثم فك حزمه (unbundle) في مستودع آخر (another repository). -Let's see a simple example. -Let's say you have a repository with two commits: +دعونا نرى مثالاً بسيطاً (simple example). +لنفترض أن لديك مستودعاً يحتوي على تأكيدين (two commits): [source,console] ---- @@ -32,7 +32,7 @@ Date: Wed Mar 10 07:34:01 2010 -0800 First commit ---- -If you want to send that repository to someone and you don't have access to a repository to push to, or simply don't want to set one up, you can bundle it with `git bundle create`. +إذا كنت تريد إرسال هذا المستودع إلى شخص ما وليس لديك وصول (access) إلى مستودع للدفع (push) إليه، أو ببساطة لا تريد إعداد (set one up) واحد، يمكنك حزمه باستخدام `git bundle create`. [source,console] ---- @@ -44,14 +44,14 @@ Writing objects: 100% (6/6), 441 bytes, done. Total 6 (delta 0), reused 0 (delta 0) ---- -Now you have a file named `repo.bundle` that has all the data needed to re-create the repository's `master` branch. -With the `bundle` command you need to list out every reference or specific range of commits that you want to be included. -If you intend for this to be cloned somewhere else, you should add HEAD as a reference as well as we've done here. +الآن لديك ملف يسمى `repo.bundle` يحتوي على جميع البيانات (data) اللازمة لإعادة إنشاء الفرع `master` للمستودع. +باستخدام الأمر `bundle`، تحتاج إلى سرد (list out) كل مرجع (reference) أو نطاق (range) معين من التأكيدات (commits) التي تريد تضمينها. +إذا كنت تنوي (intend) استنساخ (cloned) هذا الملف في مكان آخر، فيجب عليك إضافة HEAD كمرجع كما فعلنا هنا. -You can email this `repo.bundle` file to someone else, or put it on a USB drive and walk it over. +يمكنك إرسال هذا الملف `repo.bundle` بالبريد الإلكتروني إلى شخص آخر، أو وضعه على محرك أقراص USB (USB drive) ونقله (walk it over). -On the other side, say you are sent this `repo.bundle` file and want to work on the project. -You can clone from the binary file into a directory, much like you would from a URL. +على الجانب الآخر، لنفترض أنه تم إرسال هذا الملف `repo.bundle` إليك وتريد العمل (work) على المشروع. +يمكنك الاستنساخ (clone) من الملف الثنائي إلى دليل (directory)، تماماً كما تفعل من عنوان URL. [source,console] ---- @@ -64,9 +64,9 @@ $ git log --oneline b1ec324 First commit ---- -If you don't include HEAD in the references, you have to also specify `-b master` or whatever branch is included because otherwise it won't know what branch to check out. +إذا لم تقم بتضمين HEAD في المراجع، فيجب عليك أيضاً تحديد (specify) `-b master` أو أي فرع (branch) متضمن لأنه بخلاف ذلك لن يعرف أي فرع يجب التحقق منه (check out). -Now let's say you do three commits on it and want to send the new commits back via a bundle on a USB stick or email. +الآن لنفترض أنك قمت بثلاث عمليات تأكيد (commits) عليه وتريد إرسال التأكيدات الجديدة مرة أخرى عبر حزمة (bundle) على محرك أقراص USB (USB stick) أو بريد إلكتروني. [source,console] ---- @@ -78,14 +78,14 @@ c99cf5b Fourth commit - second repo b1ec324 First commit ---- -First we need to determine the range of commits we want to include in the bundle. -Unlike the network protocols which figure out the minimum set of data to transfer over the network for us, we'll have to figure this out manually. -Now, you could just do the same thing and bundle the entire repository, which will work, but it's better to just bundle up the difference - just the three commits we just made locally. +أولاً، نحتاج إلى تحديد نطاق التأكيدات (range of commits) التي نريد تضمينها في الحزمة. +على عكس بروتوكولات الشبكة (network protocols) التي تكتشف (figure out) الحد الأدنى (minimum) من مجموعة البيانات لنقلها عبر الشبكة من أجلنا، سيتعين علينا اكتشاف ذلك يدوياً (manually). +الآن، يمكنك القيام بنفس الشيء وحزم المستودع بأكمله، والذي سيعمل (will work)، ولكن من الأفضل فقط حزم الفرق (difference) - مجرد التأكيدات الثلاثة (three commits) التي قمنا بها للتو محلياً (locally). -In order to do that, you'll have to calculate the difference. -As we described in <>, you can specify a range of commits in a number of ways. -To get the three commits that we have in our `master` branch that weren't in the branch we originally cloned, we can use something like `origin/master..master` or `master ^origin/master`. -You can test that with the `log` command. +للقيام بذلك، سيتعين عليك حساب (calculate) الفرق. +كما وصفنا في <>، يمكنك تحديد نطاق (range) من التأكيدات بعدة طرق. +للحصول على التأكيدات الثلاثة الموجودة في فرع `master` الخاص بنا والتي لم تكن في الفرع الذي استنسخناه (cloned) في الأصل (originally)، يمكننا استخدام شيء مثل `origin/master..master` أو `master ^origin/master`. +يمكنك اختبار (test) ذلك باستخدام الأمر `log`. [source,console] ---- @@ -95,8 +95,8 @@ c99cf5b Fourth commit - second repo 7011d3d Third commit - second repo ---- -So now that we have the list of commits we want to include in the bundle, let's bundle them up. -We do that with the `git bundle create` command, giving it a filename we want our bundle to be and the range of commits we want to go into it. +الآن وبعد أن أصبح لدينا قائمة (list) التأكيدات (commits) التي نريد تضمينها (include) في الحزمة (bundle)، دعونا نحزمها. +نقوم بذلك باستخدام الأمر `git bundle create`، مع إعطائه اسم ملف (filename) نريده لحزمتنا ونطاق التأكيدات التي نريد أن تدخل فيه. [source,console] ---- @@ -108,11 +108,11 @@ Writing objects: 100% (9/9), 775 bytes, done. Total 9 (delta 0), reused 0 (delta 0) ---- -Now we have a `commits.bundle` file in our directory. -If we take that and send it to our partner, she can then import it into the original repository, even if more work has been done there in the meantime. +الآن لدينا ملف `commits.bundle` في دليلنا (directory). +إذا أخذنا ذلك وأرسلناه إلى شريكنا (partner)، يمكنها بعد ذلك استيراده (import it) إلى المستودع الأصلي (original repository)، حتى لو تم إنجاز المزيد من العمل هناك في غضون ذلك (in the meantime). -When she gets the bundle, she can inspect it to see what it contains before she imports it into her repository. -The first command is the `bundle verify` command that will make sure the file is actually a valid Git bundle and that you have all the necessary ancestors to reconstitute it properly. +عندما تحصل (gets) على الحزمة، يمكنها فحصها (inspect it) لمعرفة ما تحتويه (contains) قبل استيرادها إلى مستودعها. +الأمر الأول هو الأمر `bundle verify` الذي سيتأكد من أن الملف هو في الواقع حزمة Git صالحة (valid Git bundle) وأن لديك جميع الأسلاف (ancestors) الضرورية لإعادة تشكيلها (reconstitute it) بشكل صحيح. [source,console] ---- @@ -124,8 +124,8 @@ The bundle requires these 1 ref ../commits.bundle is okay ---- -If the bundler had created a bundle of just the last two commits they had done, rather than all three, the original repository would not be able to import it, since it is missing requisite history. -The `verify` command would have looked like this instead: +إذا كان المنشئ (bundler) قد أنشأ حزمة بآخر تأكيدين (last two commits) قاما بهما فقط، بدلاً من كل الثلاثة (all three)، فلن يتمكن المستودع الأصلي (original repository) من استيراده، لأنه يفتقر إلى السجل المطلوب (requisite history). +كان الأمر `verify` سيبدو كالتالي بدلاً من ذلك: [source,console] ---- @@ -134,8 +134,8 @@ error: Repository lacks these prerequisite commits: error: 7011d3d8fc200abe0ad561c011c3852a4b7bbe95 Third commit - second repo ---- -However, our first bundle is valid, so we can fetch in commits from it. -If you want to see what branches are in the bundle that can be imported, there is also a command to just list the heads: +ومع ذلك، فإن حزمتنا الأولى (first bundle) صالحة (valid)، لذا يمكننا الجلب (fetch) منها. +إذا كنت تريد معرفة (see) الفروع (branches) الموجودة في الحزمة والتي يمكن استيرادها (imported)، فهناك أيضاً أمر يسرد (list) الرؤوس (heads) فقط: [source,console] ---- @@ -143,9 +143,9 @@ $ git bundle list-heads ../commits.bundle 71b84daaf49abed142a373b6e5c59a22dc6560dc refs/heads/master ---- -The `verify` sub-command will tell you the heads as well. -The point is to see what can be pulled in, so you can use the `fetch` or `pull` commands to import commits from this bundle. -Here we'll fetch the `master` branch of the bundle to a branch named `other-master` in our repository: +سيخبرك الأمر الفرعي (sub-command) `verify` بالرؤوس (heads) أيضاً. +الهدف هو معرفة ما يمكن سحبه (pulled in)، حتى تتمكن من استخدام أوامر `fetch` أو `pull` لاستيراد (import) التأكيدات (commits) من هذه الحزمة. +هنا سنقوم بجلب الفرع `master` من الحزمة إلى فرع يسمى `other-master` في مستودعنا: [source,console] ---- @@ -154,7 +154,7 @@ From ../commits.bundle * [new branch] master -> other-master ---- -Now we can see that we have the imported commits on the `other-master` branch as well as any commits we've done in the meantime in our own `master` branch. +الآن يمكننا أن نرى أن لدينا التأكيدات المستوردة (imported commits) في فرع `other-master` بالإضافة إلى أي تأكيدات (commits) قمنا بها في غضون ذلك (in the meantime) في فرع `master` الخاص بنا. [source,console] ---- @@ -168,4 +168,4 @@ $ git log --oneline --decorate --graph --all * b1ec324 First commit ---- -So, `git bundle` can be really useful for sharing or doing network-type operations when you don't have the proper network or shared repository to do so. +لذا، يمكن أن يكون الأمر `git bundle` مفيداً حقاً للمشاركة (sharing) أو القيام بعمليات (operations) من نوع الشبكة (network-type) عندما لا تتوفر لديك الشبكة المناسبة (proper network) أو المستودع المشترك (shared repository) للقيام بذلك. diff --git a/book/07-git-tools/sections/credentials.asc b/book/07-git-tools/sections/credentials.asc index 7c7bc6ed5..454b5c552 100644 --- a/book/07-git-tools/sections/credentials.asc +++ b/book/07-git-tools/sections/credentials.asc @@ -1,50 +1,50 @@ [[_credential_caching]] -=== Credential Storage +=== Credential Storage (تخزين بيانات الاعتماد) (((credentials))) (((git commands, credential))) -If you use the SSH transport for connecting to remotes, it's possible for you to have a key without a passphrase, which allows you to securely transfer data without typing in your username and password. -However, this isn't possible with the HTTP protocols -- every connection needs a username and password. -This gets even harder for systems with two-factor authentication, where the token you use for a password is randomly generated and unpronounceable. - -Fortunately, Git has a credentials system that can help with this. -Git has a few options provided in the box: - -* The default is not to cache at all. - Every connection will prompt you for your username and password. -* The "`cache`" mode keeps credentials in memory for a certain period of time. - None of the passwords are ever stored on disk, and they are purged from the cache after 15 minutes. -* The "`store`" mode saves the credentials to a plain-text file on disk, and they never expire. - This means that until you change your password for the Git host, you won't ever have to type in your credentials again. - The downside of this approach is that your passwords are stored in cleartext in a plain file in your home directory. -* If you're using macOS, Git comes with an "`osxkeychain`" mode, which caches credentials in the secure keychain that's attached to your system account. - This method stores the credentials on disk, and they never expire, but they're encrypted with the same system that stores HTTPS certificates and Safari auto-fills. -* If you're using Windows, you can enable the *Git Credential Manager* feature when installing https://gitforwindows.org/[Git for Windows] or separately install https://github.com/git-ecosystem/git-credential-manager/releases/latest[the latest GCM] as a standalone service. - This is similar to the "`osxkeychain`" helper described above, but uses the Windows Credential Store to control sensitive information. - It can also serve credentials to WSL1 or WSL2. - See https://github.com/git-ecosystem/git-credential-manager#readme[GCM Install Instructions] for more information. - -You can choose one of these methods by setting a Git configuration value: +إذا كنت تستخدم بروتوكول SSH (SSH transport) للاتصال بالخوادم البعيدة (remotes)، فمن الممكن أن يكون لديك مفتاح (key) بدون عبارة مرور (passphrase)، مما يتيح لك نقل البيانات (transfer data) بشكل آمن دون كتابة اسم المستخدم (username) وكلمة المرور (password). +ومع ذلك، هذا غير ممكن مع بروتوكولات HTTP -- يتطلب كل اتصال (connection) اسم مستخدم وكلمة مرور. +يصبح هذا الأمر أكثر صعوبة للأنظمة التي تعتمد على المصادقة الثنائية (two-factor authentication)، حيث يكون الرمز (token) الذي تستخدمه ككلمة مرور يتم إنشاؤه عشوائياً (randomly generated) وغير قابل للنطق (unpronounceable). + +لحسن الحظ، لدى Git نظام بيانات اعتماد (credentials system) يمكنه المساعدة في ذلك. +يوفر Git بعض الخيارات (options) الجاهزة للاستخدام: + +* الافتراضي (default) هو عدم التخزين المؤقت (cache) على الإطلاق. + سيطالبك (prompt) كل اتصال باسم المستخدم وكلمة المرور. +* يحتفظ وضع "`التخزين المؤقت (cache)`" ببيانات الاعتماد في الذاكرة (memory) لفترة زمنية محددة. + لا يتم تخزين أي من كلمات المرور مطلقاً على القرص (disk)، ويتم مسحها (purged) من ذاكرة التخزين المؤقت بعد 15 دقيقة. +* يحفظ وضع "`التخزين (store)`" بيانات الاعتماد في ملف نصي عادي (plain-text file) على القرص، ولا تنتهي صلاحيتها (expire) أبداً. + هذا يعني أنه حتى تقوم بتغيير كلمة المرور الخاصة بك لمضيف Git (Git host)، فلن تضطر أبداً إلى كتابة بيانات الاعتماد الخاصة بك مرة أخرى. + الجانب السلبي (downside) لهذا النهج هو أن كلمات المرور الخاصة بك يتم تخزينها بنص واضح (cleartext) في ملف عادي (plain file) في الدليل الرئيسي (home directory) الخاص بك. +* إذا كنت تستخدم نظام macOS، فإن Git يأتي مزوداً بوضع "`osxkeychain`"، الذي يخزن بيانات الاعتماد مؤقتاً في سلسلة المفاتيح الآمنة (secure keychain) المرفقة (attached) بحساب النظام الخاص بك. + تخزن هذه الطريقة بيانات الاعتماد على القرص، ولا تنتهي صلاحيتها أبداً، ولكنها مشفرة (encrypted) بنفس النظام الذي يخزن شهادات HTTPS (HTTPS certificates) والملء التلقائي (auto-fills) في Safari. +* إذا كنت تستخدم نظام Windows، يمكنك تمكين (enable) ميزة *مدير بيانات الاعتماد الخاص بـ Git (Git Credential Manager)* عند تثبيت https://gitforwindows.org/[Git لنظام التشغيل Windows (Git for Windows)] أو تثبيت أحدث إصدار من https://github.com/git-ecosystem/git-credential-manager/releases/latest[GCM] كخدمة مستقلة (standalone service) بشكل منفصل. + هذا مشابه للمساعد "`osxkeychain`" الموضح أعلاه، ولكنه يستخدم مخزن بيانات الاعتماد الخاص بـ Windows (Windows Credential Store) للتحكم في المعلومات الحساسة (sensitive information). + يمكنه أيضاً تقديم بيانات الاعتماد (serve credentials) إلى WSL1 أو WSL2. + راجع https://github.com/git-ecosystem/git-credential-manager#readme[إرشادات تثبيت GCM (GCM Install Instructions)] لمزيد من المعلومات. + +يمكنك اختيار إحدى هذه الطرق (methods) عن طريق تعيين قيمة تكوين (configuration value) في Git: [source,console] ---- $ git config --global credential.helper cache ---- -Some of these helpers have options. -The "`store`" helper can take a `--file ` argument, which customizes where the plain-text file is saved (the default is `~/.git-credentials`). -The "`cache`" helper accepts the `--timeout ` option, which changes the amount of time its daemon is kept running (the default is "`900`", or 15 minutes). -Here's an example of how you'd configure the "`store`" helper with a custom file name: +تحتوي بعض هؤلاء المساعدين (helpers) على خيارات (options). +يمكن أن يأخذ المساعد "`store`" وسيطة (argument) `--file `، والتي تخصص (customizes) مكان حفظ الملف النصي العادي (الافتراضي هو `~/.git-credentials`). +يقبل المساعد "`cache`" الخيار `--timeout `، والذي يغير مقدار الوقت الذي يتم فيه إبقاء الخفي (daemon) الخاص به قيد التشغيل (الافتراضي هو "`900`"، أو 15 دقيقة). +إليك مثال على كيفية تكوين المساعد "`store`" باسم ملف مخصص (custom file name): [source,console] ---- $ git config --global credential.helper 'store --file ~/.my-credentials' ---- -Git even allows you to configure several helpers. -When looking for credentials for a particular host, Git will query them in order, and stop after the first answer is provided. -When saving credentials, Git will send the username and password to *all* of the helpers in the list, and they can choose what to do with them. -Here's what a `.gitconfig` would look like if you had a credentials file on a thumb drive, but wanted to use the in-memory cache to save some typing if the drive isn't plugged in: +يتيح لك Git حتى تكوين العديد من المساعدين (several helpers). +عند البحث عن بيانات اعتماد لمضيف معين (particular host)، سيستعلم (query) Git عنهم بالترتيب، ويتوقف بعد تقديم الإجابة الأولى. +عند حفظ بيانات الاعتماد، سيرسل Git اسم المستخدم وكلمة المرور إلى *جميع* المساعدين في القائمة، ويمكنهم اختيار ما يجب فعله بها. +إليك كيف سيبدو ملف `.gitconfig` إذا كان لديك ملف بيانات اعتماد على محرك أقراص محمول (thumb drive)، ولكنك أردت استخدام ذاكرة التخزين المؤقت في الذاكرة (in-memory cache) لتوفير بعض الكتابة إذا لم يكن محرك الأقراص موصلاً: [source,ini] ---- @@ -53,14 +53,14 @@ Here's what a `.gitconfig` would look like if you had a credentials file on a th helper = cache --timeout 30000 ---- -==== Under the Hood +==== Under the Hood (تحت الغطاء) -How does this all work? -Git's root command for the credential-helper system is `git credential`, which takes a command as an argument, and then more input through stdin. +كيف يعمل كل هذا؟ +أمر الجذر (root command) في Git لنظام مساعد بيانات الاعتماد (credential-helper system) هو `git credential`، والذي يأخذ أمراً كوسيطة (argument)، ثم المزيد من المدخلات (input) من خلال stdin. -This might be easier to understand with an example. -Let's say that a credential helper has been configured, and the helper has stored credentials for `mygithost`. -Here's a session that uses the "`fill`" command, which is invoked when Git is trying to find credentials for a host: +قد يكون هذا أسهل في الفهم من خلال مثال. +لنفترض أنه تم تكوين مساعد بيانات اعتماد، وقد قام المساعد بتخزين بيانات اعتماد لـ `mygithost`. +إليك جلسة (session) تستخدم الأمر "`fill`"، والذي يتم استدعاؤه (invoked) عندما يحاول Git العثور على بيانات اعتماد لمضيف (host): [source,console] ---- @@ -84,39 +84,39 @@ username=bob password=s3cre7 ---- -<1> This is the command line that initiates the interaction. -<2> Git-credential is then waiting for input on stdin. - We provide it with the things we know: the protocol and hostname. -<3> A blank line indicates that the input is complete, and the credential system should answer with what it knows. -<4> Git-credential then takes over, and writes to stdout with the bits of information it found. -<5> If credentials are not found, Git asks the user for the username and password, and provides them back to the invoking stdout (here they're attached to the same console). +<1> هذا هو سطر الأوامر (command line) الذي يبدأ التفاعل (interaction). +<2> ينتظر `git-credential` بعد ذلك الإدخال على stdin. + نحن نزوده بالأشياء التي نعرفها: البروتوكول (protocol) واسم المضيف (hostname). +<3> يشير السطر الفارغ (blank line) إلى اكتمال الإدخال، ويجب أن يجيب نظام بيانات الاعتماد بما يعرفه. +<4> يتولى `git-credential` الأمر بعد ذلك، ويكتب إلى stdout أجزاء المعلومات (information) التي وجدها. +<5> إذا لم يتم العثور على بيانات الاعتماد، يطلب Git من المستخدم اسم المستخدم وكلمة المرور، ويوفرها مرة أخرى لاستدعاء (invoking) stdout (هنا يتم إرفاقهما - attached - بنفس وحدة التحكم - console). -The credential system is actually invoking a program that's separate from Git itself; which one and how depends on the `credential.helper` configuration value. -There are several forms it can take: +يقوم نظام بيانات الاعتماد في الواقع باستدعاء برنامج (program) منفصل عن Git نفسه؛ أيهما وكيف يعتمد ذلك على قيمة التكوين `credential.helper`. +هناك عدة أشكال (forms) يمكن أن تتخذها: [options="header"] |====== -| Configuration Value | Behavior -| `foo` | Runs `git-credential-foo` -| `foo -a --opt=bcd` | Runs `git-credential-foo -a --opt=bcd` -| `/absolute/path/foo -xyz` | Runs `/absolute/path/foo -xyz` -| `!f() { echo "password=s3cre7"; }; f` | Code after `!` evaluated in shell +| Configuration Value (قيمة التكوين) | Behavior (السلوك) +| `foo` | Runs `git-credential-foo` (يشغل `git-credential-foo`) +| `foo -a --opt=bcd` | Runs `git-credential-foo -a --opt=bcd` (يشغل `git-credential-foo -a --opt=bcd`) +| `/absolute/path/foo -xyz` | Runs `/absolute/path/foo -xyz` (يشغل `/absolute/path/foo -xyz`) +| `!f() { echo "password=s3cre7"; }; f` | Code after `!` evaluated in shell (يتم تقييم الكود بعد `!` في القشرة - shell) |====== -So the helpers described above are actually named `git-credential-cache`, `git-credential-store`, and so on, and we can configure them to take command-line arguments. -The general form for this is "`git-credential-foo [args] .`" -The stdin/stdout protocol is the same as git-credential, but they use a slightly different set of actions: +لذا فإن المساعدين الموصوفين أعلاه يتم تسميتهم فعلياً `git-credential-cache`، `git-credential-store`، وهكذا، ويمكننا تكوينهم لأخذ وسيطات سطر الأوامر (command-line arguments). +الشكل العام لذلك هو "`git-credential-foo [args] .`" +بروتوكول stdin/stdout هو نفسه لـ git-credential، لكنهم يستخدمون مجموعة مختلفة قليلاً من الإجراءات (actions): -* `get` is a request for a username/password pair. -* `store` is a request to save a set of credentials in this helper's memory. -* `erase` purge the credentials for the given properties from this helper's memory. +* `get` (الحصول على) هو طلب للحصول على زوج (pair) من اسم المستخدم/كلمة المرور. +* `store` (تخزين) هو طلب لحفظ مجموعة (set) من بيانات الاعتماد في ذاكرة (memory) هذا المساعد. +* `erase` (مسح) يطهر (purge) بيانات الاعتماد للخصائص (properties) المحددة من ذاكرة هذا المساعد. -For the `store` and `erase` actions, no response is required (Git ignores it anyway). -For the `get` action, however, Git is very interested in what the helper has to say. -If the helper doesn't know anything useful, it can simply exit with no output, but if it does know, it should augment the provided information with the information it has stored. -The output is treated like a series of assignment statements; anything provided will replace what Git already knows. +بالنسبة لإجراءي `store` و `erase`، لا يلزم وجود استجابة (لا يبالي Git بها على أي حال - ignores it anyway). +ولكن بالنسبة لإجراء `get`، فإن Git مهتم جداً (very interested) بما سيقوله المساعد. +إذا كان المساعد لا يعرف أي شيء مفيد، فيمكنه ببساطة الخروج (exit) بدون مخرجات (output)، ولكن إذا كان يعرف، فيجب عليه إضافة (augment) المعلومات المخزنة لديه إلى المعلومات المقدمة. +يتم التعامل مع المخرجات (output) كسلسلة من عبارات التعيين (assignment statements)؛ وأي شيء يتم توفيره سيحل محل (replace) ما يعرفه Git بالفعل. -Here's the same example from above, but skipping `git-credential` and going straight for `git-credential-store`: +إليك نفس المثال من أعلى، ولكن بتخطي `git-credential` والانتقال مباشرة إلى `git-credential-store`: [source,console] ---- @@ -133,52 +133,52 @@ username=bob <3> password=s3cre7 ---- -<1> Here we tell `git-credential-store` to save some credentials: the username "`bob`" and the password "`s3cre7`" are to be used when `https://mygithost` is accessed. -<2> Now we'll retrieve those credentials. - We provide the parts of the connection we already know (`https://mygithost`), and an empty line. -<3> `git-credential-store` replies with the username and password we stored above. +<1> هنا نخبر `git-credential-store` بحفظ (save) بعض بيانات الاعتماد: اسم المستخدم "`bob`" وكلمة المرور "`s3cre7`" ليتم استخدامهما عند الوصول (accessed) إلى `https://mygithost`. +<2> الآن سنسترد (retrieve) بيانات الاعتماد هذه. + نحن نوفر أجزاء الاتصال (connection) التي نعرفها بالفعل (`https://mygithost`)، وسطر فارغ (empty line). +<3> يرد `git-credential-store` باسم المستخدم وكلمة المرور اللذين قمنا بتخزينهما (stored) أعلاه. -Here's what the `~/git.store` file looks like: +إليك شكل ملف `~/git.store`: [source,ini] ---- https://bob:s3cre7@mygithost ---- -It's just a series of lines, each of which contains a credential-decorated URL. -The `osxkeychain` and `wincred` helpers use the native format of their backing stores, while `cache` uses its own in-memory format (which no other process can read). +إنها مجرد سلسلة من الأسطر، يحتوي كل منها على عنوان URL مزين (decorated) ببيانات اعتماد. +يستخدم المساعدان `osxkeychain` و `wincred` التنسيق الأصلي (native format) لمخازنهما الأساسية (backing stores)، بينما يستخدم `cache` التنسيق الخاص به (own format) في الذاكرة (in-memory format) (والذي لا يمكن لأي عملية أخرى قراءته - no other process can read). -==== A Custom Credential Cache +==== A Custom Credential Cache (ذاكرة تخزين مؤقت لبيانات الاعتماد المخصصة) -Given that `git-credential-store` and friends are separate programs from Git, it's not much of a leap to realize that _any_ program can be a Git credential helper. -The helpers provided by Git cover many common use cases, but not all. -For example, let's say your team has some credentials that are shared with the entire team, perhaps for deployment. -These are stored in a shared directory, but you don't want to copy them to your own credential store, because they change often. -None of the existing helpers cover this case; let's see what it would take to write our own. -There are several key features this program needs to have: +نظراً لأن `git-credential-store` وأصدقاءه عبارة عن برامج منفصلة (separate programs) عن Git، فليس من الصعب إدراك أن _أي_ برنامج يمكن أن يكون مساعد بيانات اعتماد لـ Git. +تغطي (cover) المساعدات التي يوفرها Git العديد من حالات الاستخدام الشائعة (common use cases)، ولكن ليس كلها. +على سبيل المثال، لنفترض أن فريقك لديه بعض بيانات الاعتماد المشتركة (shared) مع الفريق بأكمله، ربما للنشر (deployment). +يتم تخزينها في دليل مشترك (shared directory)، ولكنك لا تريد نسخها (copy them) إلى مخزن بيانات الاعتماد (credential store) الخاص بك، لأنها تتغير غالباً. +لا يغطي أي من المساعدين الحاليين هذه الحالة؛ لنرى ما يتطلبه الأمر لكتابة (write) مساعدنا الخاص. +هناك عدة ميزات رئيسية (key features) يجب أن يتمتع بها هذا البرنامج: -. The only action we need to pay attention to is `get`; `store` and `erase` are write operations, so we'll just exit cleanly when they're received. -. The file format of the shared-credential file is the same as that used by `git-credential-store`. -. The location of that file is fairly standard, but we should allow the user to pass a custom path just in case. +. الإجراء الوحيد (only action) الذي نحتاج إلى الانتباه إليه هو `get`؛ `store` و `erase` هما عمليتا كتابة (write operations)، لذلك سنخرج بسلاسة (exit cleanly) عند استلامهما. +. تنسيق ملف بيانات الاعتماد المشتركة (shared-credential file) هو نفس التنسيق المستخدم بواسطة `git-credential-store`. +. موقع ذلك الملف قياسي (standard) إلى حد ما، لكن يجب أن نسمح للمستخدم بتمرير مسار مخصص (custom path) تحسباً (just in case). -Once again, we'll write this extension in Ruby, but any language will work so long as Git can execute the finished product. -Here's the full source code of our new credential helper: +مرة أخرى، سنكتب هذا الامتداد (extension) بلغة Ruby، ولكن أي لغة (any language) ستعمل طالما يمكن لـ Git تنفيذ (execute) المنتج النهائي (finished product). +إليك الكود المصدري الكامل (full source code) لمساعد بيانات الاعتماد الجديد الخاص بنا: [source,ruby] ---- include::../git-credential-read-only[] ---- -<1> Here we parse the command-line options, allowing the user to specify the input file. - The default is `~/.git-credentials`. -<2> This program only responds if the action is `get` and the backing-store file exists. -<3> This loop reads from stdin until the first blank line is reached. - The inputs are stored in the `known` hash for later reference. -<4> This loop reads the contents of the storage file, looking for matches. - If the protocol, host, and username from `known` match this line, the program prints the results to stdout and exits. +<1> هنا نقوم بتحليل (parse) خيارات سطر الأوامر (command-line options)، مما يسمح للمستخدم بتحديد ملف الإدخال (input file). + الافتراضي (default) هو `~/.git-credentials`. +<2> يستجيب (responds) هذا البرنامج فقط إذا كان الإجراء (action) هو `get` وملف المتجر الأساسي (backing-store file) موجوداً. +<3> تقرأ هذه الحلقة (loop) من stdin حتى يتم الوصول (reached) إلى السطر الفارغ (blank line) الأول. + يتم تخزين المدخلات (inputs) في تجزئة `known` (hash) للرجوع إليها لاحقاً. +<4> تقرأ هذه الحلقة محتويات (contents) ملف التخزين (storage file)، باحثة عن التطابقات (matches). + إذا كان البروتوكول والمضيف (host) واسم المستخدم من `known` يطابق هذا السطر، فإن البرنامج يطبع النتائج إلى stdout ويخرج. -We'll save our helper as `git-credential-read-only`, put it somewhere in our `PATH` and mark it executable. -Here's what an interactive session looks like: +سنحفظ مساعدنا (helper) كـ `git-credential-read-only`، ونضعه في مكان ما في `PATH` الخاص بنا ونضع علامة عليه كقابل للتنفيذ (executable). +إليك كيف تبدو الجلسة التفاعلية (interactive session): [source,console] ---- @@ -193,11 +193,11 @@ username=bob password=s3cre7 ---- -Since its name starts with "`git-`", we can use the simple syntax for the configuration value: +نظراً لأن اسمه يبدأ بـ "`git-`"، يمكننا استخدام البنية البسيطة (simple syntax) لقيمة التكوين (configuration value): [source,console] ---- $ git config --global credential.helper 'read-only --file /mnt/shared/creds' ---- -As you can see, extending this system is pretty straightforward, and can solve some common problems for you and your team. +كما ترى، فإن توسيع (extending) هذا النظام واضح ومباشر (pretty straightforward)، ويمكن أن يحل بعض المشكلات الشائعة لك ولفريقك. diff --git a/book/07-git-tools/sections/debugging.asc b/book/07-git-tools/sections/debugging.asc index dd615c1c7..3e6c66a9b 100644 --- a/book/07-git-tools/sections/debugging.asc +++ b/book/07-git-tools/sections/debugging.asc @@ -1,16 +1,16 @@ -=== Debugging with Git +=== Debugging with Git (التصحيح باستخدام Git) -In addition to being primarily for version control, Git also provides a couple commands to help you debug your source code projects. -Because Git is designed to handle nearly any type of content, these tools are pretty generic, but they can often help you hunt for a bug or culprit when things go wrong. +بالإضافة إلى كونه أساساً للتحكم في الإصدارات (version control)، يوفر Git أيضاً بعض الأوامر لمساعدتك في تصحيح (debug) مشاريع الكود المصدري (source code projects) الخاصة بك. +نظراً لأن Git مصمم للتعامل مع أي نوع تقريباً من المحتوى، فإن هذه الأدوات عامة جداً (generic)، ولكنها غالباً ما يمكن أن تساعدك في البحث (hunt) عن خطأ (bug) أو الجاني (culprit) عندما تسوء الأمور. [[_file_annotation]] -==== File Annotation +==== File Annotation (توضيح الملفات) -If you track down a bug in your code and want to know when it was introduced and why, file annotation is often your best tool. -It shows you what commit was the last to modify each line of any file. -So if you see that a method in your code is buggy, you can annotate the file with `git blame` to determine which commit was responsible for the introduction of that line. +إذا تتبعت خطأ في الكود الخاص بك وأردت معرفة متى تم إدخاله (introduced) ولماذا، فإن توضيح الملف (file annotation) غالباً ما يكون أفضل أداة لديك. +إنه يوضح لك التأكيد (commit) الذي كان آخر من قام بتعديل كل سطر من أي ملف. +لذا، إذا رأيت أن إحدى الطرق (method) في الكود الخاص بك بها أخطاء، فيمكنك توضيح الملف باستخدام `git blame` لتحديد التأكيد (commit) المسؤول عن إدخال ذلك السطر. -The following example uses `git blame` to determine which commit and committer was responsible for lines in the top-level Linux kernel `Makefile` and, further, uses the `-L` option to restrict the output of the annotation to lines 69 through 82 of that file: +يستخدم المثال التالي `git blame` لتحديد التأكيد (commit) والمؤكد (committer) المسؤولين عن الأسطر في مستوى القمة (top-level) لـ `Makefile` الخاص بنواة Linux (Linux kernel)، وعلاوة على ذلك، يستخدم الخيار `-L` لتقييد (restrict) مخرجات التوضيح (annotation) إلى الأسطر من 69 إلى 82 من ذلك الملف: [source,console] ---- @@ -31,18 +31,18 @@ b8b0618cf6fab (Cheng Renquan 2009-05-26 16:03:07 +0800 70) KBUILD_VERBOSE = $ 066b7ed955808 (Michal Marek 2014-07-04 14:29:30 +0200 82) endif ---- -Notice that the first field is the partial SHA-1 of the commit that last modified that line. -The next two fields are values extracted from that commit -- the author name and the authored date of that commit -- so you can easily see who modified that line and when. -After that come the line number and the content of the file. -Also note the `^1da177e4c3f4` commit lines, where the `^` prefix designates lines that were introduced in the repository's initial commit and have remained unchanged ever since. -This is a tad confusing, because now you've seen at least three different ways that Git uses the `^` to modify a commit SHA-1, but that is what it means here. +لاحظ أن الحقل الأول (first field) هو جزء من SHA-1 للتأكيد الذي قام بآخر تعديل لذلك السطر. +الحقلان التاليان هما قيمتان مستخرجتان (extracted) من ذلك التأكيد -- اسم المؤلف (author name) وتاريخ تأليف (authored date) ذلك التأكيد -- حتى تتمكن بسهولة من معرفة من قام بتعديل ذلك السطر ومتى. +بعد ذلك يأتي رقم السطر ومحتوى الملف. +لاحظ أيضاً أسطر التأكيد `^1da177e4c3f4`، حيث تشير البادئة (prefix) `^` إلى الأسطر التي تم إدخالها في التأكيد الأولي (initial commit) للمستودع وظلت دون تغيير (unchanged) منذ ذلك الحين. +هذا مربك (confusing) قليلاً، لأنك رأيت الآن ثلاث طرق مختلفة على الأقل يستخدم بها Git العلامة `^` لتعديل (modify) SHA-1 الخاص بالتأكيد، ولكن هذا هو ما يعنيه هنا. -Another cool thing about Git is that it doesn't track file renames explicitly. -It records the snapshots and then tries to figure out what was renamed implicitly, after the fact. -One of the interesting features of this is that you can ask it to figure out all sorts of code movement as well. -If you pass `-C` to `git blame`, Git analyzes the file you're annotating and tries to figure out where snippets of code within it originally came from if they were copied from elsewhere. -For example, say you are refactoring a file named `GITServerHandler.m` into multiple files, one of which is `GITPackUpload.m`. -By blaming `GITPackUpload.m` with the `-C` option, you can see where sections of the code originally came from: +شيء آخر رائع حول Git هو أنه لا يتتبع عمليات إعادة تسمية الملفات (file renames) بشكل صريح (explicitly). +إنه يسجل اللقطات (snapshots) ثم يحاول معرفة ما تمت إعادة تسميته بشكل ضمني (implicitly)، بعد حدوثه (after the fact). +إحدى الميزات المثيرة للاهتمام في هذا هي أنه يمكنك أن تطلب منه اكتشاف (figure out) جميع أنواع حركة الكود (code movement) أيضاً. +إذا قمت بتمرير `-C` إلى `git blame`، فسيقوم Git بتحليل (analyzes) الملف الذي تقوم بتوضيحه (annotating) ويحاول معرفة من أين جاءت مقتطفات (snippets) الكود داخله في الأصل إذا تم نسخها (copied) من مكان آخر. +على سبيل المثال، لنفترض أنك تقوم بإعادة هيكلة (refactoring) ملف باسم `GITServerHandler.m` إلى ملفات متعددة، أحدها `GITPackUpload.m`. +عن طريق استخدام الأمر `blame` على `GITPackUpload.m` مع الخيار `-C`، يمكنك معرفة من أين جاءت أقسام (sections) الكود في الأصل: [source,console] ---- @@ -62,22 +62,22 @@ ad11ac80 GITPackUpload.m (Scott 2009-03-24 150) 56ef2caf GITServerHandler.m (Scott 2009-01-05 153) ---- -This is really useful. -Normally, you get as the original commit the commit where you copied the code over, because that is the first time you touched those lines in this file. -Git tells you the original commit where you wrote those lines, even if it was in another file. +هذا مفيد حقاً (really useful). +عادة، تحصل على التأكيد الأصلي (original commit) كالتأكيد الذي نسخت الكود إليه، لأن تلك هي المرة الأولى التي لمست (touched) فيها تلك الأسطر في هذا الملف. +يخبرك Git بالتأكيد الأصلي حيث كتبت تلك الأسطر، حتى لو كان ذلك في ملف آخر (another file). [[_binary_search]] -==== Binary Search +==== Binary Search (البحث الثنائي) -Annotating a file helps if you know where the issue is to begin with. -If you don't know what is breaking, and there have been dozens or hundreds of commits since the last state where you know the code worked, you'll likely turn to `git bisect` for help. -The `bisect` command does a binary search through your commit history to help you identify as quickly as possible which commit introduced an issue. +يساعد توضيح الملف (Annotating a file) إذا كنت تعرف أين تكمن المشكلة في المقام الأول. +إذا كنت لا تعرف ما الذي يتعطل (breaking)، وكانت هناك العشرات أو المئات من التأكيدات (commits) منذ آخر حالة (last state) حيث كنت تعلم أن الكود يعمل، فمن المحتمل أن تلجأ (turn to) إلى `git bisect` للحصول على المساعدة. +يقوم الأمر `bisect` ببحث ثنائي (binary search) في سجل التأكيدات (commit history) الخاص بك لمساعدتك في تحديد (identify) التأكيد الذي أدخل (introduced) مشكلة في أسرع وقت ممكن. -Let's say you just pushed out a release of your code to a production environment, you're getting bug reports about something that wasn't happening in your development environment, and you can't imagine why the code is doing that. -You go back to your code, and it turns out you can reproduce the issue, but you can't figure out what is going wrong. -You can _bisect_ the code to find out. -First you run `git bisect start` to get things going, and then you use `git bisect bad` to tell the system that the current commit you're on is broken. -Then, you must tell bisect when the last known good state was, using `git bisect good `: +لنفترض أنك قمت للتو بدفع (pushed out) إصدار (release) من الكود الخاص بك إلى بيئة إنتاج (production environment)، وتتلقى تقارير أخطاء (bug reports) حول شيء لم يكن يحدث في بيئة التطوير (development environment) الخاصة بك، ولا يمكنك تخيل سبب قيام الكود بذلك. +تعود إلى الكود الخاص بك، ويتضح أنه يمكنك إعادة إنتاج (reproduce) المشكلة، ولكن لا يمكنك معرفة الخطأ (what is going wrong). +يمكنك _تشريح_ (_bisect_) الكود لمعرفة ذلك. +أولاً تقوم بتشغيل `git bisect start` لبدء تشغيل الأشياء، ثم تستخدم `git bisect bad` لإخبار النظام أن التأكيد (commit) الحالي الذي أنت عليه مكسور (broken). +بعد ذلك، يجب أن تخبر bisect متى كانت آخر حالة جيدة معروفة (last known good state)، باستخدام `git bisect good `: [source,console] ---- @@ -88,10 +88,10 @@ Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] Error handling on repo ---- -Git figured out that about 12 commits came between the commit you marked as the last good commit (v1.0) and the current bad version, and it checked out the middle one for you. -At this point, you can run your test to see if the issue exists as of this commit. -If it does, then it was introduced sometime before this middle commit; if it doesn't, then the problem was introduced sometime after the middle commit. -It turns out there is no issue here, and you tell Git that by typing `git bisect good` and continue your journey: +اكتشف (figured out) Git أن هناك حوالي 12 تأكيداً قد جاءت بين التأكيد الذي حددته كآخر تأكيد جيد (last good commit) (v1.0) والإصدار السيئ الحالي (current bad version)، وقد قام بالتحقق (checked out) من التأكيد الأوسط نيابة عنك. +في هذه المرحلة، يمكنك تشغيل الاختبار (test) الخاص بك لمعرفة ما إذا كانت المشكلة موجودة اعتباراً من هذا التأكيد. +إذا كان الأمر كذلك، فقد تم إدخالها في وقت ما قبل هذا التأكيد الأوسط (middle commit)؛ وإذا لم يكن كذلك، فقد تم إدخال المشكلة في وقت ما بعد التأكيد الأوسط. +اتضح أنه لا توجد مشكلة هنا، وأنت تخبر Git بذلك عن طريق كتابة `git bisect good` وتواصل رحلتك: [source,console] ---- @@ -100,8 +100,8 @@ Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] Secure this thing ---- -Now you're on another commit, halfway between the one you just tested and your bad commit. -You run your test again and find that this commit is broken, so you tell Git that with `git bisect bad`: +أنت الآن في تأكيد آخر، في منتصف الطريق بين التأكيد الذي اختبرته للتو وتأكيدك السيئ. +تقوم بتشغيل الاختبار الخاص بك مرة أخرى وتجد أن هذا التأكيد مكسور (broken)، لذلك تخبر Git بذلك باستخدام `git bisect bad`: [source,console] ---- @@ -110,8 +110,8 @@ Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] Drop exceptions table ---- -This commit is fine, and now Git has all the information it needs to determine where the issue was introduced. -It tells you the SHA-1 of the first bad commit and shows some of the commit information and which files were modified in that commit so you can figure out what happened that may have introduced this bug: +هذا التأكيد لا بأس به، والآن يمتلك Git جميع المعلومات (information) التي يحتاجها لتحديد (determine) مكان إدخال المشكلة. +إنه يخبرك بـ SHA-1 لأول تأكيد سيئ (first bad commit) ويعرض بعض معلومات التأكيد (commit information) والملفات التي تم تعديلها في ذلك التأكيد حتى تتمكن من معرفة ما حدث والذي قد يكون أدخل هذا الخطأ (bug): [source,console] ---- @@ -127,17 +127,17 @@ Date: Tue Jan 27 14:48:32 2009 -0800 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config ---- -When you're finished, you should run `git bisect reset` to reset your HEAD to where you were before you started, or you'll end up in a weird state: +عند الانتهاء، يجب عليك تشغيل `git bisect reset` لإعادة تعيين HEAD الخاص بك إلى حيث كنت قبل أن تبدأ، وإلا سينتهي بك الأمر في حالة غريبة (weird state): [source,console] ---- $ git bisect reset ---- -This is a powerful tool that can help you check hundreds of commits for an introduced bug in minutes. -In fact, if you have a script that will exit 0 if the project is good or non-0 if the project is bad, you can fully automate `git bisect`. -First, you again tell it the scope of the bisect by providing the known bad and good commits. -You can do this by listing them with the `bisect start` command if you want, listing the known bad commit first and the known good commit second: +هذه أداة قوية (powerful tool) يمكن أن تساعدك في التحقق من مئات التأكيدات بحثاً عن خطأ (bug) تم إدخاله في دقائق. +في الواقع، إذا كان لديك برنامج نصي (script) سيخرج (exit) بقيمة 0 إذا كان المشروع جيداً أو قيمة غير الصفر (non-0) إذا كان المشروع سيئاً، فيمكنك أتمتة (automate) `git bisect` بالكامل. +أولاً، تخبره مرة أخرى بنطاق (scope) الـ bisect من خلال توفير التأكيدات السيئة والجيدة المعروفة (known bad and good commits). +يمكنك القيام بذلك عن طريق سردها باستخدام الأمر `bisect start` إذا أردت، وسرد التأكيد السيئ المعروف أولاً والتأكيد الجيد المعروف ثانياً: [source,console] ---- @@ -145,5 +145,5 @@ $ git bisect start HEAD v1.0 $ git bisect run test-error.sh ---- -Doing so automatically runs `test-error.sh` on each checked-out commit until Git finds the first broken commit. -You can also run something like `make` or `make tests` or whatever you have that runs automated tests for you. +يؤدي القيام بذلك تلقائياً إلى تشغيل `test-error.sh` على كل تأكيد (checked-out commit) تم التحقق منه حتى يعثر Git على أول تأكيد مكسور (first broken commit). +يمكنك أيضاً تشغيل شيء مثل `make` أو `make tests` أو أي شيء يقوم بتشغيل اختبارات آلية (automated tests) من أجلك. diff --git a/book/07-git-tools/sections/interactive-staging.asc b/book/07-git-tools/sections/interactive-staging.asc index 1f7a5635d..25afbc7df 100644 --- a/book/07-git-tools/sections/interactive-staging.asc +++ b/book/07-git-tools/sections/interactive-staging.asc @@ -1,11 +1,11 @@ [[_interactive_staging]] -=== Interactive Staging +=== Interactive Staging (التجهيز التفاعلي) -In this section, you'll look at a few interactive Git commands that can help you craft your commits to include only certain combinations and parts of files. -These tools are helpful if you modify a number of files extensively, then decide that you want those changes to be partitioned into several focused commits rather than one big messy commit. -This way, you can make sure your commits are logically separate changesets and can be reviewed easily by the developers working with you. +في هذا القسم، ستلقي نظرة على عدد قليل من أوامر (commands) Git التفاعلية (interactive) التي يمكن أن تساعدك في صياغة عمليات التأكيد (craft your commits) الخاصة بك لتضمين مجموعات (combinations) وأجزاء معينة (parts) فقط من الملفات. +تكون هذه الأدوات (tools) مفيدة إذا قمت بتعديل عدد من الملفات (files) على نطاق واسع، ثم قررت أنك تريد تقسيم (partitioned) تلك التغييرات إلى عدة عمليات تأكيد (commits) مركزة بدلاً من تأكيد واحد كبير فوضوي (messy). +بهذه الطريقة، يمكنك التأكد من أن عمليات التأكيد (commits) الخاصة بك هي مجموعات تغييرات (changesets) منفصلة منطقياً (logically separate) ويمكن مراجعتها (reviewed) بسهولة من قبل المطورين (developers) الذين يعملون معك. -If you run `git add` with the `-i` or `--interactive` option, Git enters an interactive shell mode, displaying something like this: +إذا قمت بتشغيل `git add` مع الخيار `-i` أو `--interactive`، فإن Git يدخل في وضع قشرة تفاعلية (interactive shell mode)، ويعرض شيئاً كالتالي: [source,console] ---- @@ -21,14 +21,14 @@ $ git add -i What now> ---- -You can see that this command shows you a much different view of your staging area than you're probably used to -- basically, the same information you get with `git status` but a bit more succinct and informative. -It lists the changes you've staged on the left and unstaged changes on the right. +يمكنك أن ترى أن هذا الأمر (command) يعرض لك طريقة عرض مختلفة (different view) لمنطقة التجهيز (staging area) الخاصة بك عما اعتدت عليه على الأرجح -- بشكل أساسي، نفس المعلومات التي تحصل عليها من خلال `git status` ولكن بشكل أكثر إيجازاً (succinct) وغنى بالمعلومات (informative). +إنه يسرد التغييرات التي قمت بتجهيزها (staged) على اليسار والتغييرات غير المجهزة (unstaged) على اليمين. -After this comes a "`Commands`" section, which allows you to do a number of things like staging and unstaging files, staging parts of files, adding untracked files, and displaying diffs of what has been staged. +بعد ذلك يأتي قسم "`Commands`" (الأوامر)، والذي يسمح لك بالقيام بعدد من الأشياء مثل تجهيز وإلغاء تجهيز الملفات (staging and unstaging files)، وتجهيز أجزاء من الملفات (staging parts of files)، وإضافة ملفات غير متتبعة (adding untracked files)، وعرض الفروق (diffs) لما تم تجهيزه. -==== Staging and Unstaging Files +==== Staging and Unstaging Files (تجهيز وإلغاء تجهيز الملفات) -If you type `u` or `2` (for update) at the `What now>` prompt, you're prompted for which files you want to stage: +إذا قمت بكتابة `u` أو `2` (للتحديث - update) في موجّه (prompt) `What now>`، فستتم مطالبتك بالملفات التي تريد تجهيزها (stage): [source,console] ---- @@ -40,7 +40,7 @@ What now> u Update>> ---- -To stage the `TODO` and `index.html` files, you can type the numbers: +لتجهيز (stage) الملفين `TODO` و `index.html`، يمكنك كتابة الأرقام: [source,console] ---- @@ -52,8 +52,8 @@ Update>> 1,2 Update>> ---- -The `*` next to each file means the file is selected to be staged. -If you press Enter after typing nothing at the `Update>>` prompt, Git takes anything selected and stages it for you: +تعني العلامة `*` المجاورة لكل ملف أن الملف محدد (selected) ليتم تجهيزه. +إذا ضغطت على Enter بعد عدم كتابة أي شيء في موجّه `Update>>`، فسيأخذ Git أي شيء محدد ويجهزه لك: [source,console] ---- @@ -70,8 +70,8 @@ What now> s 3: unchanged +5/-1 lib/simplegit.rb ---- -Now you can see that the `TODO` and `index.html` files are staged and the `simplegit.rb` file is still unstaged. -If you want to unstage the `TODO` file at this point, you use the `r` or `3` (for revert) option: +الآن يمكنك أن ترى أن الملفين `TODO` و `index.html` مجهزان (staged) ولا يزال الملف `simplegit.rb` غير مجهز (unstaged). +إذا كنت ترغب في إلغاء تجهيز (unstage) ملف `TODO` في هذه المرحلة، فاستخدم الخيار `r` أو `3` (للتراجع - revert): [source,console] ---- @@ -92,7 +92,7 @@ Revert>> [enter] reverted one path ---- -Looking at your Git status again, you can see that you've unstaged the `TODO` file: +بالنظر إلى حالة Git (Git status) الخاصة بك مرة أخرى، يمكنك أن ترى أنك قمت بإلغاء تجهيز (unstaged) ملف `TODO`: [source,console] ---- @@ -106,9 +106,9 @@ What now> s 3: unchanged +5/-1 lib/simplegit.rb ---- -To see the diff of what you've staged, you can use the `d` or `6` (for diff) command. -It shows you a list of your staged files, and you can select the ones for which you would like to see the staged diff. -This is much like specifying `git diff --cached` on the command line: +لرؤية فرق (diff) ما قمت بتجهيزه، يمكنك استخدام الأمر (command) `d` أو `6` (للفرق - diff). +يعرض لك قائمة بملفاتك المجهزة (staged files)، ويمكنك تحديد الملفات التي ترغب في رؤية الفرق المجهز لها (staged diff). +يشبه هذا إلى حد كبير تحديد `git diff --cached` في سطر الأوامر (command line): [source,console] ---- @@ -133,14 +133,14 @@ index 4d07108..4335f49 100644