Repository: ArslanBilal/Git-Cheat-Sheet Branch: main Commit: 4098de6b02a1 Files: 15 Total size: 162.3 KB Directory structure: gitextract_qqdf3dce/ ├── .gitignore ├── .travis.yml ├── README.md ├── _config.yml └── other-sheets/ ├── git-cheat-sheet-ar.md ├── git-cheat-sheet-bn.md ├── git-cheat-sheet-de.md ├── git-cheat-sheet-el.md ├── git-cheat-sheet-es.md ├── git-cheat-sheet-hi.md ├── git-cheat-sheet-ko.md ├── git-cheat-sheet-pl.md ├── git-cheat-sheet-pt_BR.md ├── git-cheat-sheet-tr.md └── git-cheat-sheet-zh.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ .DS_Store .idea ================================================ FILE: .travis.yml ================================================ language: ruby rvm: - 2.2 before_script: - gem install awesome_bot script: - awesome_bot README.md --white-list travis-ci,gitflow-installer.sh,domain.com/user/repo.git ================================================ FILE: README.md ================================================ # Git and Git Flow Cheat Sheet [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)

Git

--- ## 📖 About This comprehensive Git cheat sheet helps you master Git commands without memorizing everything. Whether you're a beginner or an experienced developer, this guide provides quick reference to essential Git operations. **Contributions Welcome!** Feel free to: - Fix grammar mistakes - Add new commands - Translate to your language - Improve explanations --- ## 📋 Table of Contents - [🔧 Setup](#-setup) - [⚙️ Configuration Files](#️-configuration-files) - [🆕 Create Repository](#-create-repository) - [📝 Local Changes](#-local-changes) - [🔍 Search](#-search) - [📖 Commit History](#-commit-history) - [📁 Move / Rename](#-move--rename) - [🌿 Branches & Tags](#-branches--tags) - [🔄 Update & Publish](#-update--publish) - [🔀 Merge & Rebase](#-merge--rebase) - [↩️ Undo](#️-undo) - [🌊 Git Flow](#-git-flow) - [🌍 Other Languages](#-other-languages) --- ## 🔧 Setup ### View Configuration **Show current configuration:** ```bash git config --list ``` **Show repository configuration:** ```bash git config --local --list ``` **Show global configuration:** ```bash git config --global --list ``` **Show system configuration:** ```bash git config --system --list ``` ### User Configuration **Set your name for version history:** ```bash git config --global user.name "[firstname lastname]" ``` **Set your email address:** ```bash git config --global user.email "[valid-email]" ``` ### Display & Editor Settings **Enable automatic command line coloring:** ```bash git config --global color.ui auto ``` **Set global editor for commits:** ```bash git config --global core.editor vi ``` --- ## ⚙️ Configuration Files | Scope | Location | Command Flag | |-------|----------|--------------| | **Repository** | `/.git/config` | `--local` | | **User** | `~/.gitconfig` | `--global` | | **System** | `/etc/gitconfig` | `--system` | --- ## 🆕 Create Repository ### Clone Existing Repository **Via SSH:** ```bash git clone ssh://user@domain.com/repo.git ``` **Via HTTPS:** ```bash git clone https://domain.com/user/repo.git ``` ### Initialize New Repository **Create repository in current directory:** ```bash git init ``` **Create repository in specific directory:** ```bash git init ``` --- ## 📝 Local Changes ### Check Status & Differences **View working directory status:** ```bash git status ``` **Show changes to tracked files:** ```bash git diff ``` **Show changes in specific file:** ```bash git diff ``` ### Staging Changes **Add all current changes:** ```bash git add . ``` **Add specific files:** ```bash git add ``` **Interactively add parts of a file:** ```bash git add -p ``` ### Committing Changes **Commit all tracked file changes:** ```bash git commit -a ``` **Commit staged changes:** ```bash git commit ``` **Commit with message:** ```bash git commit -m 'message here' ``` **Skip staging and commit with message:** ```bash git commit -am 'message here' ``` **Commit with specific date:** ```bash git commit --date="`date --date='n day ago'`" -am "" ``` ### Modify Last Commit > ⚠️ **Warning:** Don't amend published commits! **Amend last commit:** ```bash git commit -a --amend ``` **Amend without changing commit message:** ```bash git commit --amend --no-edit ``` **Change committer date:** ```bash GIT_COMMITTER_DATE="date" git commit --amend ``` **Change author date:** ```bash git commit --amend --date="date" ``` ### Stashing Changes **Save current changes temporarily:** ```bash git stash ``` **Apply last stashed changes:** ```bash git stash apply ``` **Apply specific stash:** ```bash git stash apply stash@{stash_number} ``` > Use `git stash list` to see available stashes **Remove last stash:** ```bash git stash drop ``` **Move uncommitted changes to another branch:** ```bash git stash git checkout branch2 git stash pop ``` --- ## 🔍 Search ### Text Search **Search for text in all files:** ```bash git grep "Hello" ``` **Search in specific version:** ```bash git grep "Hello" v2.5 ``` ### Commit Search **Find commits that introduced specific keyword:** ```bash git log -S 'keyword' ``` **Search with regular expression:** ```bash git log -S 'keyword' --pickaxe-regex ``` --- ## 📖 Commit History ### Basic History **Show all commits (detailed):** ```bash git log ``` **Show commits (one line each):** ```bash git log --oneline ``` **Show commits by specific author:** ```bash git log --author="username" ``` **Show changes for specific file:** ```bash git log -p ``` ### Advanced History **Compare branches:** ```bash git log --oneline .. --left-right ``` **Show who changed what and when:** ```bash git blame ``` ### Reference Logs **Show reference log:** ```bash git reflog show ``` **Delete reference log:** ```bash git reflog delete ``` --- ## 📁 Move / Rename **Rename a file:** ```bash git mv Index.txt Index.html ``` --- ## 🌿 Branches & Tags ### List Branches **List local branches:** ```bash git branch ``` **List all branches (local + remote):** ```bash git branch -a ``` **List remote branches:** ```bash git branch -r ``` **List merged branches:** ```bash git branch --merged ``` ### Switch & Create Branches **Switch to existing branch:** ```bash git checkout ``` **Create and switch to new branch:** ```bash git checkout -b ``` **Switch to previous branch:** ```bash git checkout - ``` **Create branch from existing branch:** ```bash git checkout -b ``` **Create branch from specific commit:** ```bash git checkout -b ``` **Create branch without switching:** ```bash git branch ``` **Create tracking branch:** ```bash git branch --track ``` ### Branch Operations **Checkout single file from different branch:** ```bash git checkout -- ``` **Apply specific commit from another branch:** ```bash git cherry-pick ``` **Rename current branch:** ```bash git branch -m ``` **Delete local branch:** ```bash git branch -d ``` **Force delete local branch:** ```bash git branch -D ``` > ⚠️ **Warning:** You will lose unmerged changes! ### Tags **Create tag at HEAD:** ```bash git tag ``` **Create annotated tag:** ```bash git tag -a ``` **Create tag with message:** ```bash git tag -am 'message here' ``` **List all tags:** ```bash git tag ``` **List tags with messages:** ```bash git tag -n ``` --- ## 🔄 Update & Publish ### Remote Management **List configured remotes:** ```bash git remote -v ``` **Show remote information:** ```bash git remote show ``` **Add new remote:** ```bash git remote add ``` **Rename remote:** ```bash git remote rename ``` **Remove remote:** ```bash git remote rm ``` > ℹ️ **Note:** This only removes the remote reference locally, not the remote repository itself. ### Fetch & Pull **Download changes without merging:** ```bash git fetch ``` **Download and merge changes:** ```bash git pull ``` **Get changes from main branch:** ```bash git pull origin master ``` **Pull with rebase:** ```bash git pull --rebase ``` ### Push & Publish **Publish local changes:** ```bash git push ``` **Delete remote branch:** ```bash # Git v1.7.0+ git push --delete # Git v1.5.0+ git push : ``` **Publish tags:** ```bash git push --tags ``` --- ## 🔀 Merge & Rebase ### Merge Operations **Merge branch into current HEAD:** ```bash git merge ``` **Configure merge tool globally:** ```bash git config --global merge.tool meld ``` **Use configured merge tool:** ```bash git mergetool ``` ### Rebase Operations > ⚠️ **Warning:** Don't rebase published commits! **Rebase current HEAD onto branch:** ```bash git rebase ``` **Abort rebase:** ```bash git rebase --abort ``` **Continue rebase after resolving conflicts:** ```bash git rebase --continue ``` ### Conflict Resolution **Mark file as resolved:** ```bash git add ``` **Remove resolved file:** ```bash git rm ``` ### Squashing Commits **Interactive rebase for squashing:** ```bash git rebase -i ``` **Example squash configuration:** ``` # Before pick pick pick # After (squash commit_id2 and commit_id3 into commit_id) pick squash squash ``` --- ## ↩️ Undo ### Discard Changes **Discard all local changes:** ```bash git reset --hard HEAD ``` **Unstage all files:** ```bash git reset HEAD ``` **Discard changes in specific file:** ```bash git checkout HEAD ``` ### Reset Operations **Reset to previous commit (discard all changes):** ```bash git reset --hard ``` **Reset to remote branch state:** ```bash git reset --hard # Example: git reset --hard upstream/master ``` **Reset preserving changes as unstaged:** ```bash git reset ``` **Reset preserving uncommitted local changes:** ```bash git reset --keep ``` ### Revert Commits **Revert commit (create new commit with opposite changes):** ```bash git revert ``` ### Clean Ignored Files **Remove accidentally committed files that should be ignored:** ```bash git rm -r --cached . git add . git commit -m "remove ignored files" ``` --- ## 🌊 Git Flow **Improved Git-flow:** [git-flow-avh](https://github.com/petervanderdoes/gitflow-avh) ### 📋 Table of Contents - [🔧 Setup](#setup-1) - [🚀 Getting Started](#getting-started) - [✨ Features](#features) - [🎁 Make a Release](#make-a-release) - [🔥 Hotfixes](#hotfixes) - [📊 Commands Overview](#commands-overview) --- ### 🔧 Setup {#setup-1} > **Prerequisite:** Working Git installation required. Git-flow works on macOS, Linux, and Windows. **macOS (Homebrew):** ```bash brew install git-flow-avh ``` **macOS (MacPorts):** ```bash port install git-flow ``` **Linux (Debian-based):** ```bash sudo apt-get install git-flow ``` **Windows (Cygwin):** > Requires wget and util-linux ```bash wget -q -O - --no-check-certificate https://raw.githubusercontent.com/petervanderdoes/gitflow/develop/contrib/gitflow-installer.sh install | bash ``` --- ### 🚀 Getting Started Git-flow needs initialization to customize your project setup. **Initialize (interactive):** ```bash git flow init ``` > You'll answer questions about branch naming conventions. Default values are recommended. **Initialize (use defaults):** ```bash git flow init -d ``` --- ### ✨ Features Features are for developing new functionality for upcoming releases. They typically exist only in developer repositories. **Start new feature:** ```bash git flow feature start MYFEATURE ``` > Creates feature branch based on 'develop' and switches to it **Finish feature:** ```bash git flow feature finish MYFEATURE ``` > This will: > 1. Merge MYFEATURE into 'develop' > 2. Remove the feature branch > 3. Switch back to 'develop' **Publish feature (for collaboration):** ```bash git flow feature publish MYFEATURE ``` **Get published feature:** ```bash git flow feature pull origin MYFEATURE ``` **Track origin feature:** ```bash git flow feature track MYFEATURE ``` --- ### 🎁 Make a Release Releases support preparation of new production releases, allowing minor bug fixes and preparing meta-data. **Start release:** ```bash git flow release start RELEASE [BASE] ``` > Creates release branch from 'develop'. Optionally specify [BASE] commit SHA-1. **Publish release:** ```bash git flow release publish RELEASE ``` **Track remote release:** ```bash git flow release track RELEASE ``` **Finish release:** ```bash git flow release finish RELEASE ``` > This will: > 1. Merge release branch into 'master' > 2. Tag the release > 3. Back-merge release into 'develop' > 4. Remove release branch > 💡 **Don't forget:** Push your tags with `git push --tags` --- ### 🔥 Hotfixes Hotfixes address critical issues in live production versions. They branch off from the corresponding tag on master. **Start hotfix:** ```bash git flow hotfix start VERSION [BASENAME] ``` **Finish hotfix:** ```bash git flow hotfix finish VERSION ``` > Merges back into both 'develop' and 'master', and tags the master merge --- ### 📊 Commands Overview

Git Flow Commands

### 🌊 Git Flow Schema

Git Flow Schema

--- ## 🌍 Other Languages This cheat sheet is available in multiple languages: | Language | Link | |----------|------| | 🇸🇦 Arabic | [git-cheat-sheet-ar.md](./other-sheets/git-cheat-sheet-ar.md) | | 🇧🇩 Bengali | [git-cheat-sheet-bn.md](./other-sheets/git-cheat-sheet-bn.md) | | 🇧🇷 Brazilian Portuguese | [git-cheat-sheet-pt_BR.md](./other-sheets/git-cheat-sheet-pt_BR.md) | | 🇨🇳 Chinese | [git-cheat-sheet-zh.md](./other-sheets/git-cheat-sheet-zh.md) | | 🇩🇪 German | [git-cheat-sheet-de.md](./other-sheets/git-cheat-sheet-de.md) | | 🇬🇷 Greek | [git-cheat-sheet-el.md](./other-sheets/git-cheat-sheet-el.md) | | 🇮🇳 Hindi | [git-cheat-sheet-hi.md](./other-sheets/git-cheat-sheet-hi.md) | | 🇰🇷 Korean | [git-cheat-sheet-ko.md](./other-sheets/git-cheat-sheet-ko.md) | | 🇵🇱 Polish | [git-cheat-sheet-pl.md](./other-sheets/git-cheat-sheet-pl.md) | | 🇪🇸 Spanish | [git-cheat-sheet-es.md](./other-sheets/git-cheat-sheet-es.md) | | 🇹🇷 Turkish | [git-cheat-sheet-tr.md](./other-sheets/git-cheat-sheet-tr.md) | --- ## 🤝 Contributing We welcome contributions! You can: - 🐛 Report bugs or typos - ✨ Add new Git commands - 🌍 Translate to new languages - 💡 Improve explanations - 📝 Enhance formatting **How to contribute:** 1. Fork this repository 2. Create your feature branch (`git checkout -b feature/AmazingFeature`) 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) 4. Push to the branch (`git push origin feature/AmazingFeature`) 5. Open a Pull Request --- ## 📄 License This project is open source and available under the [MIT License](LICENSE). ---

⭐ Star this repository if you found it helpful!

================================================ FILE: _config.yml ================================================ theme: jekyll-theme-hacker ================================================ FILE: other-sheets/git-cheat-sheet-ar.md ================================================ # Git Cheat Sheet العربية ![Git Logo](../Img/git-logo.png) دليل مرجعي سريع لأكثر أوامر Git استخداماً، منظم حسب الفئات لسهولة الاستخدام. --- ## 📖 حول هذا الدليل هذا الدليل المرجعي لـ Git هو مرجع شامل لكل من يريد تحسين سير عمله مع Git. من المبتدئين الذين يبدؤون رحلتهم مع Git إلى المطورين ذوي الخبرة، يوفر هذا الدليل أوامر منظمة ومصنفة لتسريع رحلة التطوير الخاصة بك. ### الميزات الرئيسية: - **فئات منظمة**: الأوامر مرتبة في مجموعات واضحة ومنطقية - **أمثلة عملية**: مع حالات استخدام من العالم الحقيقي - **مناسب للمبتدئين**: مع شروحات واضحة ونصائح - **مرجع فوري**: وصول سريع للأوامر الأساسية --- ## 📑 جدول المحتويات - [🔧 الإعداد الأولي](#الإعداد-الأولي) - [⚙️ ملفات الإعداد](#ملفات-الإعداد) - [📁 إعداد المستودع](#إعداد-المستودع) - [📊 أوامر الحالة](#أوامر-الحالة) - [📝 إدارة الملفات](#إدارة-الملفات) - [💾 التثبيتات (Commits)](#التثبيتات-commits) - [🌿 الفروع (Branches)](#الفروع-branches) - [🔀 الدمج (Merge)](#الدمج-merge) - [🌐 المستودعات البعيدة](#المستودعات-البعيدة) - [📚 السجل والتاريخ](#السجل-والتاريخ) - [🔍 البحث](#البحث) - [📋 النقل/إعادة التسمية](#النقل-إعادة-التسمية) - [🏷️ العلامات (Tags)](#العلامات-tags) - [↩️ التراجع عن التغييرات](#التراجع-عن-التغييرات) - [📦 المخزن المؤقت (Stash)](#المخزن-المؤقت-stash) - [🌊 Git Flow](#git-flow) - [💡 نصائح مفيدة](#نصائح-مفيدة) - [🌍 لغات أخرى](#لغات-أخرى) - [🤝 المساهمة](#المساهمة) - [📄 الترخيص](#الترخيص) - [📖 مصادر إضافية](#مصادر-إضافية) --- ## 🔧 الإعداد الأولي إعداد Git بمعلوماتك الشخصية: ```bash # إعداد اسم المستخدم git config --global user.name "اسمك" # إعداد البريد الإلكتروني git config --global user.email "email@example.com" # عرض الإعدادات الحالية git config --list # إعداد المحرر الافتراضي git config --global core.editor "nano" # إعداد أداة المقارنة git config --global merge.tool vimdiff ``` --- ## ⚙️ ملفات الإعداد يتم تخزين إعدادات Git على ثلاثة مستويات: | المستوى | موقع الملف | الأمر | الوصف | |---------|------------|-------|--------| | **System** | `/etc/gitconfig` | `--system` | إعدادات على مستوى النظام لجميع المستخدمين | | **Global** | `~/.gitconfig` أو `~/.config/git/config` | `--global` | إعدادات للمستخدم الحالي | | **Local** | `.git/config` | `--local` (افتراضي) | إعدادات للمستودع الحالي | ```bash # عرض مستوى الإعداد git config --show-origin user.name # تعيين إعداد على مستوى محدد git config --local user.name "اسم المشروع" git config --global user.email "global@example.com" ``` --- ## 📁 إعداد المستودع ### إنشاء مستودع جديد: ```bash # إنشاء مستودع Git جديد git init # نسخ مستودع موجود git clone <رابط-المستودع> # نسخ إلى مجلد محدد git clone <رابط-المستودع> <اسم-المجلد> ``` --- ## 📊 أوامر الحالة ### فحص حالة المستودع: ```bash # عرض الحالة الحالية للمستودع git status # عرض الحالة بصيغة مختصرة git status -s # عرض الحالة متجاهلاً الملفات غير المتتبعة git status --ignored # عرض الاختلافات في الملفات المعدلة git diff # عرض الاختلافات في منطقة التحضير git diff --staged # عرض الاختلافات بين الفروع git diff <فرع1> <فرع2> ``` --- ## 📝 إدارة الملفات ### إضافة وحذف الملفات: ```bash # إضافة ملف محدد لمنطقة التحضير git add <ملف> # إضافة جميع الملفات المعدلة git add . # إضافة جميع الملفات من نوع محدد git add *.txt # إضافة تفاعلية git add -i # حذف ملف من المستودع ومجلد العمل git rm <ملف> # حذف ملف من المستودع فقط (الاحتفاظ به في المجلد) git rm --cached <ملف> # نقل/إعادة تسمية ملف git mv <ملف-المصدر> <ملف-الوجهة> ``` --- ## 💾 التثبيتات (Commits) ### حفظ التغييرات في المستودع: ```bash # تثبيت مع رسالة git commit -m "رسالة التثبيت" # تثبيت مع إضافة جميع الملفات المعدلة git commit -am "رسالة التثبيت" # تعديل التثبيت الأخير git commit --amend # تثبيت فارغ (مفيد لـ CI/CD) git commit --allow-empty -m "تشغيل CI" # تثبيت مع رسالة مفصلة (يفتح المحرر) git commit ``` --- ## 🌿 الفروع (Branches) ### العمل مع الفروع: ```bash # عرض جميع الفروع git branch # عرض الفروع البعيدة git branch -r # عرض جميع الفروع (محلية وبعيدة) git branch -a # إنشاء فرع جديد git branch <اسم-الفرع> # التبديل إلى فرع git checkout <اسم-الفرع> # إنشاء والتبديل إلى فرع جديد git checkout -b <اسم-الفرع> # إنشاء فرع من تثبيت محدد git checkout -b <اسم-الفرع> <هاش-التثبيت> # حذف فرع git branch -d <اسم-الفرع> # حذف فرع بالقوة git branch -D <اسم-الفرع> # إعادة تسمية الفرع الحالي git branch -m <الاسم-الجديد> # إعادة تسمية فرع محدد git branch -m <الاسم-القديم> <الاسم-الجديد> ``` --- ## 🔀 الدمج (Merge) ### دمج التغييرات بين الفروع: ```bash # دمج فرع في الفرع الحالي git merge <اسم-الفرع> # دمج بدون fast-forward (إنشاء تثبيت دمج) git merge --no-ff <اسم-الفرع> # دمج فقط إذا كان fast-forward git merge --ff-only <اسم-الفرع> # إلغاء عملية الدمج الجارية git merge --abort # متابعة الدمج بعد حل التعارضات git merge --continue ``` --- ## 🌐 المستودعات البعيدة ### إدارة المستودعات البعيدة: ```bash # عرض المستودعات البعيدة git remote # عرض المستودعات البعيدة مع الروابط git remote -v # إضافة مستودع بعيد git remote add <اسم> <رابط> # تغيير رابط المستودع البعيد git remote set-url <اسم> <رابط-جديد> # حذف مستودع بعيد git remote remove <اسم> # رفع التغييرات للمستودع البعيد git push <بعيد> <فرع> # رفع فرع وتعيين التتبع git push -u <بعيد> <فرع> # رفع جميع الفروع git push --all # رفع العلامات git push --tags # تحميل التغييرات من المستودع البعيد git pull <بعيد> <فرع> # تحميل التغييرات بدون دمج git fetch <بعيد> # تحميل جميع الفروع البعيدة git fetch --all ``` --- ## 📚 السجل والتاريخ ### استكشاف تاريخ التثبيتات: ```bash # عرض تاريخ التثبيتات git log # عرض التاريخ في سطر واحد لكل تثبيت git log --oneline # عرض التاريخ مع رسم بياني git log --graph # عرض تاريخ ملف محدد git log <ملف> # عرض إحصائيات التثبيتات git log --stat # عرض التغييرات في كل تثبيت git log -p # عرض آخر N تثبيت git log -n <عدد> # عرض التثبيتات بين تواريخ git log --since="2023-01-01" --until="2023-12-31" # عرض التثبيتات حسب المؤلف git log --author="اسم المؤلف" # البحث في رسائل التثبيت git log --grep="كلمة مفتاحية" ``` --- ## 🔍 البحث ### البحث في الملفات والتثبيتات: ```bash # البحث عن نص في الملفات git grep "النص المطلوب" # البحث في أنواع ملفات محددة git grep "النمط" -- "*.js" # البحث في رسائل التثبيت git log --grep="الرسالة" # البحث في تغييرات التثبيتات git log -S "نص الكود" # البحث عن أسماء الملفات git ls-files | grep "النمط" # البحث عن ملفات في الفرع git ls-tree -r --name-only <اسم-الفرع> ``` --- ## 📋 النقل/إعادة التسمية ### نقل وإعادة تسمية الملفات: ```bash # نقل/إعادة تسمية ملف git mv <الاسم-القديم> <الاسم-الجديد> # نقل مجلد git mv <المجلد-القديم> <المجلد-الجديد> # بعد نقل الملف يدوياً mv <الاسم-القديم> <الاسم-الجديد> git rm <الاسم-القديم> git add <الاسم-الجديد> # نقل ملفات متعددة git mv *.txt <المجلد-الجديد>/ # تتبع تاريخ مسار الملف git log --follow <اسم-الملف> ``` --- ## 🏷️ العلامات (Tags) ### إدارة علامات الإصدارات: ```bash # عرض جميع العلامات git tag # إنشاء علامة خفيفة git tag <اسم-العلامة> # إنشاء علامة مشروحة git tag -a <اسم-العلامة> -m "رسالة العلامة" # إنشاء علامة على تثبيت محدد git tag -a <اسم-العلامة> <هاش-التثبيت> # عرض معلومات علامة git show <اسم-العلامة> # حذف علامة محلية git tag -d <اسم-العلامة> # حذف علامة بعيدة git push --delete <بعيد> <اسم-العلامة> # رفع علامة محددة git push <بعيد> <اسم-العلامة> # رفع جميع العلامات git push <بعيد> --tags ``` --- ## ↩️ التراجع عن التغييرات ### التراجع عن التعديلات: ```bash # إلغاء التغييرات في ملف محدد git checkout <ملف> # إلغاء جميع التغييرات غير المثبتة git checkout . # إرجاع ملف لإصدار محدد git checkout <هاش-التثبيت> <ملف> # إزالة ملف من منطقة التحضير git reset <ملف> # إزالة جميع الملفات من منطقة التحضير git reset # التراجع للتثبيت السابق (الاحتفاظ بالتغييرات) git reset --soft HEAD~1 # التراجع للتثبيت السابق (إلغاء التغييرات) git reset --hard HEAD~1 # التراجع لتثبيت محدد git reset --hard <هاش-التثبيت> # إنشاء تثبيت يلغي تثبيت آخر git revert <هاش-التثبيت> # إلغاء تثبيتات متعددة git revert <هاش-من>..<هاش-إلى> ``` --- ## 📦 المخزن المؤقت (Stash) ### حفظ العمل مؤقتاً: ```bash # حفظ التغييرات الحالية في المخزن المؤقت git stash # حفظ مع رسالة وصفية git stash save "رسالة وصفية" # عرض جميع المخازن المؤقتة git stash list # تطبيق آخر مخزن مؤقت git stash apply # تطبيق مخزن مؤقت محدد git stash apply stash@{0} # تطبيق وحذف آخر مخزن مؤقت git stash pop # حذف مخزن مؤقت محدد git stash drop stash@{0} # حذف جميع المخازن المؤقتة git stash clear # عرض التغييرات في مخزن مؤقت git stash show stash@{0} # إنشاء فرع من مخزن مؤقت git stash branch <اسم-الفرع> stash@{0} ``` --- ## 🌊 Git Flow Git Flow هو نموذج تفريع يحدد سير عمل صارم مصمم حول إطلاق المشروع. ### الفروع الرئيسية: - **master/main**: كود الإنتاج - **develop**: فرع التطوير الرئيسي ### فروع الدعم: - **feature**: للميزات الجديدة - **release**: لتحضير إصدارات جديدة - **hotfix**: للإصلاحات العاجلة في الإنتاج ### أوامر Git Flow: ```bash # تهيئة git flow git flow init # بدء ميزة جديدة git flow feature start <اسم-الميزة> # إنهاء الميزة git flow feature finish <اسم-الميزة> # نشر الميزة git flow feature publish <اسم-الميزة> # بدء إصدار git flow release start <إصدار> # إنهاء الإصدار git flow release finish <إصدار> # بدء إصلاح عاجل git flow hotfix start <إصدار> # إنهاء الإصلاح العاجل git flow hotfix finish <إصدار> ``` ### سير العمل بدون Git Flow: ![Git Flow Commands](../Img/git-flow-commands-without-flow.png) ```bash # إنشاء فرع الميزة git checkout develop git checkout -b feature/ميزة-جديدة # العمل على الميزة git add . git commit -m "إضافة ميزة جديدة" # دمج الميزة في develop git checkout develop git merge --no-ff feature/ميزة-جديدة git branch -d feature/ميزة-جديدة # إنشاء فرع الإصدار git checkout develop git checkout -b release/1.0.0 # إنهاء الإصدار git checkout master git merge --no-ff release/1.0.0 git tag -a 1.0.0 -m "الإصدار 1.0.0" git checkout develop git merge --no-ff release/1.0.0 git branch -d release/1.0.0 ``` --- ## 💡 نصائح مفيدة ### اختصارات مفيدة: ```bash # إعداد اختصارات مفيدة git config --global alias.st status git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.unstage 'reset HEAD --' git config --global alias.last 'log -1 HEAD' git config --global alias.visual '!gitk' ``` ### ملفات .gitignore: ```bash # إنشاء ملف .gitignore echo "node_modules/" >> .gitignore echo "*.log" >> .gitignore echo ".env" >> .gitignore # تجاهل ملفات متتبعة بالفعل git rm --cached <ملف> echo "<ملف>" >> .gitignore git add .gitignore git commit -m "إضافة ملف إلى .gitignore" ``` --- ## 🌍 لغات أخرى هذا الدليل المرجعي لـ Git متوفر باللغات التالية: - 🇺🇸 [English](../README.md) - 🇸🇦 **العربية** (الحالي) - 🇧🇩 [বাংলা](git-cheat-sheet-bn.md) - 🇩🇪 [Deutsch](git-cheat-sheet-de.md) - 🇬🇷 [Ελληνικά](git-cheat-sheet-el.md) - 🇪🇸 [Español](git-cheat-sheet-es.md) - 🇮🇳 [हिन्दी](git-cheat-sheet-hi.md) - 🇰🇷 [한국어](git-cheat-sheet-ko.md) - 🇵🇱 [Polski](git-cheat-sheet-pl.md) - 🇧🇷 [Português](git-cheat-sheet-pt_BR.md) - 🇹🇷 [Türkçe](git-cheat-sheet-tr.md) - 🇨🇳 [中文](git-cheat-sheet-zh.md) --- ## 🤝 المساهمة نرحب بالمساهمات! للمساعدة في تحسين هذا المشروع: 1. **أبلغ عن المشاكل**: شارك الأخطاء أو اقتراحات التحسين 2. **أضف لغات جديدة**: أنشئ ترجمات أو حسّن الموجودة 3. **حسّن المحتوى**: أضف أوامر جديدة أو أمثلة أو شروحات 4. **قدم ملاحظات**: شارك تجاربك واقتراحاتك ### كيفية المساهمة: - [افتح مشكلة على GitHub](https://github.com/arslanbilal/git-cheat-sheet/issues) - أرسل طلب سحب (Pull Request) - اقترح تحسينات على الوثائق --- ## 📄 الترخيص هذا المشروع مرخص تحت رخصة MIT. راجع ملف [LICENSE](../LICENSE) لمزيد من التفاصيل. --- ## 📖 مصادر إضافية - [الوثائق الرسمية لـ Git](https://git-scm.com/doc) - [دروس Git من Atlassian](https://www.atlassian.com/git/tutorials) - [ورقة مرجعية لـ Git من GitHub](https://education.github.com/git-cheat-sheet-education.pdf) - [دروس Git التفاعلية](https://learngitbranching.js.org/) ---
⭐ إذا كان هذا الدليل مفيداً، امنحه نجمة!
برمجة سعيدة مع Git! 🚀
================================================ FILE: other-sheets/git-cheat-sheet-bn.md ================================================ # Git Cheat Sheet বাংলা ![Git Logo](../Img/git-logo.png) সবচেয়ে বেশি ব্যবহৃত Git কমান্ডগুলির একটি দ্রুত রেফারেন্স গাইড, সহজ ব্যবহারের জন্য বিভাগ অনুযায়ী সংগঠিত। --- ## 📖 এই গাইড সম্পর্কে এই Git রেফারেন্স গাইডটি একটি সম্পূর্ণ রেফারেন্স যা Git এর সাথে কাজের প্রবাহ উন্নত করতে চান এমন সবার জন্য। যারা Git এর সাথে তাদের যাত্রা শুরু করছেন এমন শিক্ষানবিস থেকে শুরু করে অভিজ্ঞ ডেভেলপারদের জন্য, এই গাইডটি আপনার ডেভেলপমেন্ট যাত্রাকে ত্বরান্বিত করতে সংগঠিত এবং শ্রেণীবদ্ধ কমান্ড প্রদান করে। ### মূল বৈশিষ্ট্য: - **সংগঠিত বিভাগ**: কমান্ডগুলি স্পষ্ট এবং যৌক্তিক গ্রুপে সাজানো - **ব্যবহারিক উদাহরণ**: বাস্তব বিশ্বের ব্যবহারের ক্ষেত্রে সহ - **শিক্ষানবিস-বান্ধব**: স্পষ্ট ব্যাখ্যা এবং টিপস সহ - **দ্রুত রেফারেন্স**: প্রয়োজনীয় কমান্ডগুলিতে দ্রুত অ্যাক্সেস --- ## 📑 সূচিপত্র - [🔧 প্রাথমিক সেটআপ](#প্রাথমিক-সেটআপ) - [⚙️ কনফিগারেশন ফাইল](#কনফিগারেশন-ফাইল) - [📁 রিপোজিটরি সেটআপ](#রিপোজিটরি-সেটআপ) - [📊 স্ট্যাটাস কমান্ড](#স্ট্যাটাস-কমান্ড) - [📝 ফাইল ম্যানেজমেন্ট](#ফাইল-ম্যানেজমেন্ট) - [💾 কমিট](#কমিট) - [🌿 ব্রাঞ্চ](#ব্রাঞ্চ) - [🔀 মার্জ](#মার্জ) - [🌐 রিমোট রিপোজিটরি](#রিমোট-রিপোজিটরি) - [📚 হিস্ট্রি এবং লগ](#হিস্ট্রি-এবং-লগ) - [🔍 অনুসন্ধান](#অনুসন্ধান) - [📁 সরানো/নাম পরিবর্তন](#সরানো-নাম-পরিবর্তন) - [🏷️ ট্যাগ](#ট্যাগ) - [↩️ পরিবর্তন পূর্বাবস্থায় ফেরানো](#পরিবর্তন-পূর্বাবস্থায়-ফেরানো) - [📦 স্ট্যাশ](#স্ট্যাশ) - [🌊 Git Flow](#git-flow) - [💡 উপযোগী টিপস](#উপযোগী-টিপস) - [🌍 অন্যান্য ভাষা](#অন্যান্য-ভাষা) - [🤝 অবদান](#অবদান) - [📄 লাইসেন্স](#লাইসেন্স) - [📖 অতিরিক্ত সম্পদ](#অতিরিক্ত-সম্পদ) --- ## 🔧 প্রাথমিক সেটআপ আপনার ব্যক্তিগত তথ্য দিয়ে Git কনফিগার করুন: ```bash # ব্যবহারকারীর নাম সেট করুন git config --global user.name "আপনার নাম" # ইমেইল সেট করুন git config --global user.email "email@example.com" # বর্তমান কনফিগারেশন দেখুন git config --list # ডিফল্ট এডিটর সেট করুন git config --global core.editor "nano" # মার্জ টুল সেট করুন git config --global merge.tool vimdiff ``` --- ## ⚙️ কনফিগারেশন ফাইল Git ব্যবহারকারী এবং রিপোজিটরি পছন্দ সংরক্ষণের জন্য কনফিগারেশন ফাইল ব্যবহার করে: ### কনফিগারেশন স্তর: ```bash # সিস্টেম (সব ব্যবহারকারী) git config --system # ব্যবহারকারী (বর্তমান ব্যবহারকারী) git config --global # রিপোজিটরি (নির্দিষ্ট প্রকল্প) git config --local ``` ### সাধারণ কনফিগারেশন: ```bash # ব্যবহারকারীর পরিচয় git config --global user.name "আপনার নাম" git config --global user.email "email@example.com" # টেক্সট এডিটর git config --global core.editor nano # মার্জ টুল git config --global merge.tool vimdiff # আউটপুটে রঙ git config --global color.ui auto # কনফিগারেশন দেখুন git config --list ``` --- ## 📁 রিপোজিটরি সেটআপ ### নতুন রিপোজিটরি তৈরি করুন: ```bash # নতুন Git রিপোজিটরি তৈরি করুন git init # বিদ্যমান রিপোজিটরি ক্লোন করুন git clone <রিপোজিটরি-url> # নির্দিষ্ট ডিরেক্টরিতে ক্লোন করুন git clone <রিপোজিটরি-url> <ডিরেক্টরি-নাম> ``` --- ## 📊 স্ট্যাটাস কমান্ড ### আপনার রিপোজিটরির অবস্থা পরীক্ষা করুন: ```bash # রিপোজিটরির বর্তমান অবস্থা দেখুন git status # সংক্ষিপ্ত ফরম্যাটে অবস্থা দেখুন git status -s # ট্র্যাক না করা ফাইল উপেক্ষা করে অবস্থা দেখুন git status --ignored # পরিবর্তিত ফাইলের পার্থক্য দেখুন git diff # স্টেজিং এরিয়ার পার্থক্য দেখুন git diff --staged # ব্রাঞ্চের মধ্যে পার্থক্য দেখুন git diff <ব্রাঞ্চ১> <ব্রাঞ্চ২> ``` --- ## 📝 ফাইল ম্যানেজমেন্ট ### ফাইল যোগ এবং অপসারণ: ```bash # নির্দিষ্ট ফাইল স্টেজিং এরিয়ায় যোগ করুন git add <ফাইল> # সব পরিবর্তিত ফাইল যোগ করুন git add . # নির্দিষ্ট ধরনের সব ফাইল যোগ করুন git add *.txt # ইন্টারঅ্যাক্টিভভাবে যোগ করুন git add -i # রিপোজিটরি এবং ওয়ার্কিং ডিরেক্টরি থেকে ফাইল মুছুন git rm <ফাইল> # শুধু রিপোজিটরি থেকে ফাইল মুছুন (ডিরেক্টরিতে রাখুন) git rm --cached <ফাইল> # ফাইল সরান/নাম পরিবর্তন করুন git mv <উৎস-ফাইল> <গন্তব্য-ফাইল> ``` --- ## 💾 কমিট ### রিপোজিটরিতে পরিবর্তন সংরক্ষণ করুন: ```bash # বার্তা সহ কমিট করুন git commit -m "কমিট বার্তা" # সব পরিবর্তিত ফাইল যোগ করে কমিট করুন git commit -am "কমিট বার্তা" # শেষ কমিট সংশোধন করুন git commit --amend # খালি কমিট করুন (CI/CD ট্রিগারের জন্য উপযোগী) git commit --allow-empty -m "CI ট্রিগার" # বিস্তারিত বার্তা সহ কমিট করুন (এডিটর খুলবে) git commit ``` --- ## 🌿 ব্রাঞ্চ ### ব্রাঞ্চের সাথে কাজ করুন: ```bash # সব ব্রাঞ্চ দেখুন git branch # রিমোট ব্রাঞ্চ দেখুন git branch -r # সব ব্রাঞ্চ দেখুন (লোকাল এবং রিমোট) git branch -a # নতুন ব্রাঞ্চ তৈরি করুন git branch <ব্রাঞ্চ-নাম> # ব্রাঞ্চ পরিবর্তন করুন git checkout <ব্রাঞ্চ-নাম> # নতুন ব্রাঞ্চ তৈরি করে সুইচ করুন git checkout -b <ব্রাঞ্চ-নাম> # নির্দিষ্ট কমিট থেকে ব্রাঞ্চ তৈরি করুন git checkout -b <ব্রাঞ্চ-নাম> <কমিট-হ্যাশ> # ব্রাঞ্চ মুছুন git branch -d <ব্রাঞ্চ-নাম> # জোর করে ব্রাঞ্চ মুছুন git branch -D <ব্রাঞ্চ-নাম> # বর্তমান ব্রাঞ্চের নাম পরিবর্তন করুন git branch -m <নতুন-নাম> # নির্দিষ্ট ব্রাঞ্চের নাম পরিবর্তন করুন git branch -m <পুরানো-নাম> <নতুন-নাম> ``` --- ## 🔀 মার্জ ### ব্রাঞ্চের মধ্যে পরিবর্তন মার্জ করুন: ```bash # বর্তমান ব্রাঞ্চে অন্য ব্রাঞ্চ মার্জ করুন git merge <ব্রাঞ্চ-নাম> # ফাস্ট-ফরওয়ার্ড ছাড়া মার্জ করুন (মার্জ কমিট তৈরি করুন) git merge --no-ff <ব্রাঞ্চ-নাম> # শুধু ফাস্ট-ফরওয়ার্ড হলে মার্জ করুন git merge --ff-only <ব্রাঞ্চ-নাম> # চলমান মার্জ বাতিল করুন git merge --abort # কনফ্লিক্ট সমাধানের পর মার্জ চালিয়ে যান git merge --continue ``` --- ## 🌐 রিমোট রিপোজিটরি ### রিমোট রিপোজিটরি পরিচালনা: ```bash # রিমোট রিপোজিটরি দেখুন git remote # URL সহ রিমোট রিপোজিটরি দেখুন git remote -v # রিমোট রিপোজিটরি যোগ করুন git remote add <নাম> # রিমোট রিপোজিটরির URL পরিবর্তন করুন git remote set-url <নাম> <নতুন-url> # রিমোট রিপোজিটরি মুছুন git remote remove <নাম> # রিমোট রিপোজিটরিতে পরিবর্তন পুশ করুন git push <রিমোট> <ব্রাঞ্চ> # ব্রাঞ্চ পুশ করে ট্র্যাকিং সেট করুন git push -u <রিমোট> <ব্রাঞ্চ> # সব ব্রাঞ্চ পুশ করুন git push --all # ট্যাগ পুশ করুন git push --tags # রিমোট রিপোজিটরি থেকে পরিবর্তন ডাউনলোড করুন git pull <রিমোট> <ব্রাঞ্চ> # মার্জ ছাড়া পরিবর্তন ডাউনলোড করুন git fetch <রিমোট> # সব রিমোট ব্রাঞ্চ ডাউনলোড করুন git fetch --all ``` --- ## 📚 হিস্ট্রি এবং লগ ### কমিট ইতিহাস অন্বেষণ করুন: ```bash # কমিট ইতিহাস দেখুন git log # প্রতি কমিটের জন্য এক লাইনে ইতিহাস দেখুন git log --oneline # গ্রাফ সহ ইতিহাস দেখুন git log --graph # নির্দিষ্ট ফাইলের ইতিহাস দেখুন git log <ফাইল> # কমিট পরিসংখ্যান দেখুন git log --stat # প্রতি কমিটের পরিবর্তন দেখুন git log -p # শেষ N কমিট দেখুন git log -n <সংখ্যা> # তারিখের মধ্যে কমিট দেখুন git log --since="2023-01-01" --until="2023-12-31" # লেখক অনুযায়ী কমিট দেখুন git log --author="লেখকের নাম" # কমিট বার্তায় অনুসন্ধান করুন git log --grep="কীওয়ার্ড" ``` --- ## 🔍 অনুসন্ধান ### ইতিহাস এবং বিষয়বস্তুতে অনুসন্ধান: ```bash # কমিট বার্তায় অনুসন্ধান করুন git log --grep="কীওয়ার্ড" # কোডের পরিবর্তনে অনুসন্ধান করুন git log -S "কোডের অংশ" # কাজের ফাইলে অনুসন্ধান করুন git grep "প্যাটার্ন" # নির্দিষ্ট কমিটে অনুসন্ধান করুন git grep "প্যাটার্ন" <কমিট-হ্যাশ> # বড়/ছোট হাতের অক্ষর উপেক্ষা করে অনুসন্ধান git grep -i "প্যাটার্ন" # পূর্ণ শব্দ অনুসন্ধান git grep -w "শব্দ" # লাইন নম্বর দেখান git grep -n "প্যাটার্ন" ``` --- ## 📁 সরানো/নাম পরিবর্তন ### ফাইল সরানো এবং নাম পরিবর্তন: ```bash # ফাইলের নাম পরিবর্তন করুন git mv পুরানো_নাম.txt নতুন_নাম.txt # ফাইল ফোল্ডারে সরান git mv ফাইল.txt ফোল্ডার/ # ফোল্ডারের নাম পরিবর্তন করুন git mv পুরানো_ফোল্ডার নতুন_ফোল্ডার # git mv ছাড়া নাম পরিবর্তনের প্রক্রিয়া mv পুরানো_নাম.txt নতুন_নাম.txt git add নতুন_নাম.txt git rm পুরানো_নাম.txt # লগে নাম পরিবর্তন খুঁজুন git log --follow ফাইল.txt # সরানো ট্র্যাক করুন git log --stat -M ``` --- ## 🏷️ ট্যাগ ### ভার্সন ট্যাগ পরিচালনা: ```bash # সব ট্যাগ দেখুন git tag # হালকা ট্যাগ তৈরি করুন git tag <ট্যাগ-নাম> # টীকাযুক্ত ট্যাগ তৈরি করুন git tag -a <ট্যাগ-নাম> -m "ট্যাগ বার্তা" # নির্দিষ্ট কমিটে ট্যাগ তৈরি করুন git tag -a <ট্যাগ-নাম> <কমিট-হ্যাশ> # ট্যাগের তথ্য দেখুন git show <ট্যাগ-নাম> # লোকাল ট্যাগ মুছুন git tag -d <ট্যাগ-নাম> # রিমোট ট্যাগ মুছুন git push --delete <রিমোট> <ট্যাগ-নাম> # নির্দিষ্ট ট্যাগ পুশ করুন git push <রিমোট> <ট্যাগ-নাম> # সব ট্যাগ পুশ করুন git push <রিমোট> --tags ``` --- ## ↩️ পরিবর্তন পূর্বাবস্থায় ফেরানো ### পরিবর্তন ফিরিয়ে আনুন: ```bash # নির্দিষ্ট ফাইলের পরিবর্তন বাতিল করুন git checkout <ফাইল> # সব অকমিট পরিবর্তন বাতিল করুন git checkout . # নির্দিষ্ট ভার্সনে ফাইল ফিরিয়ে আনুন git checkout <কমিট-হ্যাশ> <ফাইল> # স্টেজিং এরিয়া থেকে ফাইল সরান git reset <ফাইল> # স্টেজিং এরিয়া থেকে সব ফাইল সরান git reset # পূর্ববর্তী কমিটে ফিরে যান (পরিবর্তন রাখুন) git reset --soft HEAD~1 # পূর্ববর্তী কমিটে ফিরে যান (পরিবর্তন বাতিল করুন) git reset --hard HEAD~1 # নির্দিষ্ট কমিটে ফিরে যান git reset --hard <কমিট-হ্যাশ> # অন্য কমিট বাতিল করে নতুন কমিট তৈরি করুন git revert <কমিট-হ্যাশ> # একাধিক কমিট বাতিল করুন git revert <হ্যাশ-থেকে>..<হ্যাশ-পর্যন্ত> ``` --- ## 📦 স্ট্যাশ ### অস্থায়ীভাবে কাজ সংরক্ষণ করুন: ```bash # বর্তমান পরিবর্তন স্ট্যাশে সংরক্ষণ করুন git stash # বর্ণনামূলক বার্তা সহ সংরক্ষণ করুন git stash save "বর্ণনামূলক বার্তা" # সব স্ট্যাশ দেখুন git stash list # শেষ স্ট্যাশ প্রয়োগ করুন git stash apply # নির্দিষ্ট স্ট্যাশ প্রয়োগ করুন git stash apply stash@{0} # শেষ স্ট্যাশ প্রয়োগ করে মুছে ফেলুন git stash pop # নির্দিষ্ট স্ট্যাশ মুছুন git stash drop stash@{0} # সব স্ট্যাশ মুছুন git stash clear # স্ট্যাশের পরিবর্তন দেখুন git stash show stash@{0} # স্ট্যাশ থেকে ব্রাঞ্চ তৈরি করুন git stash branch <ব্রাঞ্চ-নাম> stash@{0} ``` --- ## 🌊 Git Flow Git Flow একটি ব্রাঞ্চিং মডেল যা প্রজেক্ট রিলিজের চারপাশে ডিজাইন করা কঠোর ওয়ার্কফ্লো সংজ্ঞায়িত করে। ### মূল ব্রাঞ্চ: - **master/main**: প্রোডাকশন কোড - **develop**: মূল ডেভেলপমেন্ট ব্রাঞ্চ ### সাপোর্ট ব্রাঞ্চ: - **feature**: নতুন ফিচারের জন্য - **release**: নতুন ভার্সন প্রস্তুতির জন্য - **hotfix**: প্রোডাকশনে জরুরি সংশোধনের জন্য ### Git Flow কমান্ড: ```bash # git flow শুরু করুন git flow init # নতুন ফিচার শুরু করুন git flow feature start <ফিচার-নাম> # ফিচার শেষ করুন git flow feature finish <ফিচার-নাম> # ফিচার প্রকাশ করুন git flow feature publish <ফিচার-নাম> # রিলিজ শুরু করুন git flow release start <ভার্সন> # রিলিজ শেষ করুন git flow release finish <ভার্সন> # হটফিক্স শুরু করুন git flow hotfix start <ভার্সন> # হটফিক্স শেষ করুন git flow hotfix finish <ভার্সন> ``` ### Git Flow ছাড়া ওয়ার্কফ্লো: ![Git Flow Commands](../Img/git-flow-commands-without-flow.png) ```bash # ফিচার ব্রাঞ্চ তৈরি করুন git checkout develop git checkout -b feature/নতুন-ফিচার # ফিচারে কাজ করুন git add . git commit -m "নতুন ফিচার যোগ করুন" # develop এ ফিচার মার্জ করুন git checkout develop git merge --no-ff feature/নতুন-ফিচার git branch -d feature/নতুন-ফিচার # রিলিজ ব্রাঞ্চ তৈরি করুন git checkout develop git checkout -b release/1.0.0 # রিলিজ সম্পন্ন করুন git checkout master git merge --no-ff release/1.0.0 git tag -a 1.0.0 -m "ভার্সন 1.0.0" git checkout develop git merge --no-ff release/1.0.0 git branch -d release/1.0.0 ``` --- ## 💡 উপযোগী টিপস ### উপযোগী অ্যালিয়াস: ```bash # উপযোগী অ্যালিয়াস সেট করুন git config --global alias.st status git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.unstage 'reset HEAD --' git config --global alias.last 'log -1 HEAD' git config --global alias.visual '!gitk' ``` ### .gitignore ফাইল: ```bash # .gitignore ফাইল তৈরি করুন echo "node_modules/" >> .gitignore echo "*.log" >> .gitignore echo ".env" >> .gitignore # ইতিমধ্যে ট্র্যাক করা ফাইল উপেক্ষা করুন git rm --cached <ফাইল> echo "<ফাইল>" >> .gitignore git add .gitignore git commit -m ".gitignore এ ফাইল যোগ করুন" ``` --- ## 🌍 অন্যান্য ভাষা এই Git চিট শিট নিম্নলিখিত ভাষায় উপলব্ধ: - 🇺🇸 [English](../README.md) - 🇸🇦 [العربية](git-cheat-sheet-ar.md) - 🇧🇩 **বাংলা** (বর্তমান) - 🇩🇪 [Deutsch](git-cheat-sheet-de.md) - 🇬🇷 [Ελληνικά](git-cheat-sheet-el.md) - 🇪🇸 [Español](git-cheat-sheet-es.md) - 🇮🇳 [हिन्दी](git-cheat-sheet-hi.md) - 🇰🇷 [한국어](git-cheat-sheet-ko.md) - 🇵🇱 [Polski](git-cheat-sheet-pl.md) - 🇧🇷 [Português](git-cheat-sheet-pt_BR.md) - 🇹🇷 [Türkçe](git-cheat-sheet-tr.md) - 🇨🇳 [中文](git-cheat-sheet-zh.md) --- ## 🤝 অবদান আমরা অবদানকে স্বাগত জানাই! এই প্রকল্পটি উন্নত করতে সাহায্য করুন: 1. **সমস্যা রিপোর্ট করুন**: ত্রুটি বা উন্নতির পরামর্শ শেয়ার করুন 2. **নতুন ভাষা যোগ করুন**: অনুবাদ তৈরি করুন বা বিদ্যমান উন্নত করুন 3. **বিষয়বস্তু উন্নত করুন**: নতুন কমান্ড, উদাহরণ বা ব্যাখ্যা যোগ করুন 4. **প্রতিক্রিয়া দিন**: আপনার অভিজ্ঞতা এবং পরামর্শ শেয়ার করুন ### কিভাবে অবদান রাখবেন: - [GitHub এ ইস্যু খুলুন](https://github.com/arslanbilal/git-cheat-sheet/issues) - Pull request জমা দিন - ডকুমেন্টেশন উন্নতির পরামর্শ দিন --- ## 📄 লাইসেন্স এই প্রকল্পটি MIT লাইসেন্সের অধীনে লাইসেন্সপ্রাপ্ত। বিস্তারিত জানতে [LICENSE](../LICENSE) ফাইল দেখুন। --- ## 📖 অতিরিক্ত সম্পদ - [Git অফিসিয়াল ডকুমেন্টেশন](https://git-scm.com/doc) - [Atlassian Git টিউটোরিয়াল](https://www.atlassian.com/git/tutorials) - [GitHub Git চিট শিট](https://education.github.com/git-cheat-sheet-education.pdf) - [ইন্টারঅ্যাক্টিভ Git টিউটোরিয়াল](https://learngitbranching.js.org/) ---
⭐ এই চিট শিট যদি উপকারী হয় তাহলে এটিকে স্টার দিন!
Git এর সাথে হ্যাপি কোডিং! 🚀
================================================ FILE: other-sheets/git-cheat-sheet-de.md ================================================ # Git Cheat Sheet Deutsch ![Git Logo](../Img/git-logo.png) Dieses umfassende Git-Cheat-Sheet hilft Ihnen dabei, Git-Befehle zu beherrschen, ohne alles auswendig zu lernen. Egal, ob Sie Anfänger oder erfahrener Entwickler sind, dieser Leitfaden bietet eine schnelle Referenz für wichtige Git-Operationen. --- ## 📖 Über Dieses umfassende Git-Cheat-Sheet hilft Ihnen dabei, Git-Befehle zu beherrschen, ohne alles auswendig zu lernen. Egal, ob Sie Anfänger oder erfahrener Entwickler sind, dieser Leitfaden bietet eine schnelle Referenz für wichtige Git-Operationen. **Beiträge willkommen!** Fühlen Sie sich frei: - Grammatikfehler zu korrigieren - Neue Befehle hinzuzufügen - In Ihre Sprache zu übersetzen - Erklärungen zu verbessern --- ## 📋 Inhaltsverzeichnis - [📖 Über](#-Über) - [🔧 Setup](#-setup) - [⚙️ Konfigurationsdateien](#️-konfigurationsdateien) - [🆕 Repository erstellen](#-repository-erstellen) - [📝 Lokale Änderungen](#-lokale-änderungen) - [🔍 Suchen](#-suchen) - [📖 Commit-Historie](#-commit-historie) - [📁 Verschieben / Umbenennen](#-verschieben--umbenennen) - [🌿 Branches & Tags](#-branches--tags) - [🔄 Aktualisieren & Veröffentlichen](#-aktualisieren--veröffentlichen) - [🔀 Merge & Rebase](#-merge--rebase) - [↩️ Rückgängig machen](#️-rückgängig-machen) - [📦 Zwischenspeichern (Stash)](#-zwischenspeichern-stash) - [🌊 Git Flow](#-git-flow) - [💡 Nützliche Tipps](#-nützliche-tipps) - [🌍 Andere Sprachen](#-andere-sprachen) - [🤝 Beitragen](#-beitragen) - [📄 Lizenz](#-lizenz) - [📖 Zusätzliche Ressourcen](#-zusätzliche-ressourcen) --- ## 🔧 Setup ### Konfiguration anzeigen **Aktuelle Konfiguration anzeigen:** ```bash git config --list ``` **Repository-Konfiguration anzeigen:** ```bash git config --local --list ``` **Globale Konfiguration anzeigen:** ```bash git config --global --list ``` **System-Konfiguration anzeigen:** ```bash git config --system --list ``` ### Benutzer-Konfiguration **Namen für Versionsverlauf festlegen:** ```bash git config --global user.name "[Vorname Nachname]" ``` **E-Mail-Adresse festlegen:** ```bash git config --global user.email "[gültige-email]" ``` ### Anzeige- & Editor-Einstellungen **Automatische Befehlszeilen-Farbgebung aktivieren:** ```bash git config --global color.ui auto ``` **Globalen Editor für Commits festlegen:** ```bash git config --global core.editor vi ``` --- ## ⚙️ Konfigurationsdateien | Bereich | Ort | Befehlsflag | |---------|-----|-------------| | **Repository** | `/.git/config` | `--local` | | **Benutzer** | `~/.gitconfig` | `--global` | | **System** | `/etc/gitconfig` | `--system` | --- ## 🆕 Repository erstellen ### Existierendes Repository klonen **Über SSH:** ```bash git clone ssh://benutzer@domain.com/repo.git ``` **Über HTTPS:** ```bash git clone https://domain.com/benutzer/repo.git ``` ### Neues Repository initialisieren **Repository im aktuellen Verzeichnis erstellen:** ```bash git init ``` **Repository in spezifischem Verzeichnis erstellen:** ```bash git init ``` --- ## 📝 Lokale Änderungen ### Status & Unterschiede prüfen **Arbeitsverzeichnis-Status anzeigen:** ```bash git status ``` **Änderungen in verfolgten Dateien anzeigen:** ```bash git diff ``` **Änderungen in spezifischer Datei anzeigen:** ```bash git diff ``` ### Änderungen bereitstellen **Alle aktuellen Änderungen hinzufügen:** ```bash git add . ``` **Spezifische Dateien hinzufügen:** ```bash git add ``` **Interaktiv Teile einer Datei hinzufügen:** ```bash git add -p ``` ### Änderungen committen **Alle verfolgten Dateiänderungen committen:** ```bash git commit -a ``` **Bereitgestellte Änderungen committen:** ```bash git commit ``` **Mit Nachricht committen:** ```bash git commit -m 'Nachricht hier' ``` **Bereitstellung überspringen und mit Nachricht committen:** ```bash git commit -am 'Nachricht hier' ``` **Mit spezifischem Datum committen:** ```bash git commit --date="`date --date='n day ago'`" -am "" ``` ### Letzten Commit ändern > ⚠️ **Warnung:** Veröffentlichte Commits nicht ändern! **Letzten Commit ergänzen:** ```bash git commit -a --amend ``` **Ergänzen ohne Commit-Nachricht zu ändern:** ```bash git commit --amend --no-edit ``` **Committer-Datum ändern:** ```bash GIT_COMMITTER_DATE="datum" git commit --amend ``` **Autor-Datum ändern:** ```bash git commit --amend --date="datum" ``` ### Änderungen zwischenspeichern **Aktuelle Änderungen temporär speichern:** ```bash git stash ``` **Letzte gespeicherte Änderungen anwenden:** ```bash git stash apply ``` **Spezifischen Stash anwenden:** ```bash git stash apply stash@{stash_nummer} ``` > Verwenden Sie `git stash list`, um verfügbare Stashes zu sehen **Letzten Stash entfernen:** ```bash git stash drop ``` **Nicht committete Änderungen zu anderem Branch verschieben:** ```bash git stash git checkout branch2 git stash pop ``` --- ## 🔍 Suchen ### Text-Suche **Text in allen Dateien suchen:** ```bash git grep "Hallo" ``` **In spezifischer Version suchen:** ```bash git grep "Hallo" v2.5 ``` ### Commit-Suche **Commits finden, die spezifisches Schlüsselwort eingeführt haben:** ```bash git log -S 'schlüsselwort' ``` **Mit regulärem Ausdruck suchen:** ```bash git log -S 'schlüsselwort' --pickaxe-regex ``` --- ## 📖 Commit-Historie ### Basis-Historie **Alle Commits anzeigen (detailliert):** ```bash git log ``` **Commits anzeigen (eine Zeile je Commit):** ```bash git log --oneline ``` **Commits von spezifischem Autor anzeigen:** ```bash git log --author="benutzername" ``` **Änderungen für spezifische Datei anzeigen:** ```bash git log -p ``` ### Erweiterte Historie **Branches vergleichen:** ```bash git log --oneline .. --left-right ``` **Anzeigen, wer was wann geändert hat:** ```bash git blame ``` ### Referenz-Logs **Referenz-Log anzeigen:** ```bash git reflog show ``` **Referenz-Log löschen:** ```bash git reflog delete ``` --- ## 📁 Verschieben / Umbenennen **Datei umbenennen:** ```bash git mv Index.txt Index.html ``` --- ## 🌿 Branches & Tags ### Branches auflisten **Lokale Branches auflisten:** ```bash git branch ``` **Alle Branches auflisten (lokal + remote):** ```bash git branch -a ``` **Remote Branches auflisten:** ```bash git branch -r ``` **Zusammengeführte Branches auflisten:** ```bash git branch --merged ``` ### Branches wechseln & erstellen **Zu existierendem Branch wechseln:** ```bash git checkout ``` **Neuen Branch erstellen und dorthin wechseln:** ```bash git checkout -b ``` **Zum vorherigen Branch wechseln:** ```bash git checkout - ``` **Branch von existierendem Branch erstellen:** ```bash git checkout -b ``` **Branch von spezifischem Commit erstellen:** ```bash git checkout -b ``` **Branch ohne Wechsel erstellen:** ```bash git branch ``` **Tracking-Branch erstellen:** ```bash git branch --track ``` ### Branch-Operationen **Einzelne Datei von anderem Branch abrufen:** ```bash git checkout -- ``` **Spezifischen Commit von anderem Branch anwenden:** ```bash git cherry-pick ``` **Aktuellen Branch umbenennen:** ```bash git branch -m ``` **Lokalen Branch löschen:** ```bash git branch -d ``` **Lokalen Branch erzwungen löschen:** ```bash git branch -D ``` > ⚠️ **Warnung:** Sie verlieren nicht zusammengeführte Änderungen! ### Tags **Tag am HEAD erstellen:** ```bash git tag ``` **Annotierten Tag erstellen:** ```bash git tag -a ``` **Tag mit Nachricht erstellen:** ```bash git tag -am 'Nachricht hier' ``` **Alle Tags auflisten:** ```bash git tag ``` **Tags mit Nachrichten auflisten:** ```bash git tag -n ``` --- ## 🔄 Aktualisieren & Veröffentlichen ### Remote-Verwaltung **Konfigurierte Remotes auflisten:** ```bash git remote -v ``` **Remote-Informationen anzeigen:** ```bash git remote show ``` **Neuen Remote hinzufügen:** ```bash git remote add ``` **Remote umbenennen:** ```bash git remote rename ``` **Remote entfernen:** ```bash git remote rm ``` > ℹ️ **Hinweis:** Dies entfernt nur die Remote-Referenz lokal, nicht das Remote-Repository selbst. ### Fetch & Pull **Änderungen ohne Merge herunterladen:** ```bash git fetch ``` **Änderungen herunterladen und mergen:** ```bash git pull ``` **Änderungen vom Haupt-Branch abrufen:** ```bash git pull origin master ``` **Mit Rebase pullen:** ```bash git pull --rebase ``` ### Push & Veröffentlichen **Lokale Änderungen veröffentlichen:** ```bash git push ``` **Remote Branch löschen:** ```bash # Git v1.7.0+ git push --delete # Git v1.5.0+ git push : ``` **Tags veröffentlichen:** ```bash git push --tags ``` --- ## 🔀 Merge & Rebase ### Merge-Operationen **Branch in aktuellen HEAD mergen:** ```bash git merge ``` **Merge-Tool global konfigurieren:** ```bash git config --global merge.tool meld ``` **Konfiguriertes Merge-Tool verwenden:** ```bash git mergetool ``` ### Rebase-Operationen > ⚠️ **Warnung:** Veröffentlichte Commits nicht rebasen! **Aktuellen HEAD auf Branch rebasen:** ```bash git rebase ``` **Rebase abbrechen:** ```bash git rebase --abort ``` **Rebase nach Konfliktlösung fortsetzen:** ```bash git rebase --continue ``` ### Konfliktlösung **Datei als gelöst markieren:** ```bash git add ``` **Gelöste Datei entfernen:** ```bash git rm ``` ### Commits zusammenfassen **Interaktives Rebase zum Zusammenfassen:** ```bash git rebase -i ``` **Beispiel-Konfiguration zum Zusammenfassen:** ``` # Vorher pick pick pick # Nachher (commit_id2 und commit_id3 in commit_id zusammenfassen) pick squash squash ``` --- ## ↩️ Rückgängig machen ### Änderungen verwerfen **Alle lokalen Änderungen verwerfen:** ```bash git reset --hard HEAD ``` **Alle Dateien aus der Staging-Area entfernen:** ```bash git reset HEAD ``` **Änderungen in spezifischer Datei verwerfen:** ```bash git checkout HEAD ``` ### Reset-Operationen **Zu vorherigem Commit zurücksetzen (alle Änderungen verwerfen):** ```bash git reset --hard ``` **Zu Remote Branch-Zustand zurücksetzen:** ```bash git reset --hard # Beispiel: git reset --hard upstream/master ``` **Reset mit Änderungen als unstaged beibehalten:** ```bash git reset ``` **Reset mit lokalen uncommitted Änderungen beibehalten:** ```bash git reset --keep ``` ### Commits rückgängig machen **Commit rückgängig machen (neuen Commit mit gegenteiligen Änderungen erstellen):** ```bash git revert ``` ### Ignorierte Dateien bereinigen **Versehentlich committete Dateien entfernen, die ignoriert werden sollten:** ```bash git rm -r --cached . git add . git commit -m "ignorierte Dateien entfernen" ``` --- ## 📦 Zwischenspeichern (Stash) ### Änderungen temporär speichern **Aktuelle Änderungen zwischenspeichern:** ```bash git stash ``` **Mit beschreibender Nachricht zwischenspeichern:** ```bash git stash save "Beschreibende Nachricht" ``` **Alle Stashes anzeigen:** ```bash git stash list ``` **Letzten Stash anwenden:** ```bash git stash apply ``` **Spezifischen Stash anwenden:** ```bash git stash apply stash@{0} ``` **Letzten Stash anwenden und entfernen:** ```bash git stash pop ``` **Spezifischen Stash entfernen:** ```bash git stash drop stash@{0} ``` **Alle Stashes entfernen:** ```bash git stash clear ``` **Änderungen in einem Stash anzeigen:** ```bash git stash show stash@{0} ``` **Branch aus Stash erstellen:** ```bash git stash branch stash@{0} ``` --- ## 🌊 Git Flow **Verbesserter Git-flow:** [git-flow-avh](https://github.com/petervanderdoes/gitflow-avh) ### 📋 Inhaltsverzeichnis - [🔧 Setup](#setup-1) - [🚀 Erste Schritte](#erste-schritte) - [✨ Features](#features) - [🎁 Release erstellen](#release-erstellen) - [🔥 Hotfixes](#hotfixes) - [📊 Befehls-Übersicht](#befehls-übersicht) --- ### 🔧 Setup {#setup-1} > **Voraussetzung:** Funktionierende Git-Installation erforderlich. Git-flow funktioniert auf macOS, Linux und Windows. **macOS (Homebrew):** ```bash brew install git-flow-avh ``` **macOS (MacPorts):** ```bash port install git-flow ``` **Linux (Debian-basiert):** ```bash sudo apt-get install git-flow ``` **Windows (Cygwin):** > Benötigt wget und util-linux ```bash wget -q -O - --no-check-certificate https://raw.githubusercontent.com/petervanderdoes/gitflow/develop/contrib/gitflow-installer.sh install | bash ``` --- ### 🚀 Erste Schritte Git-flow benötigt Initialisierung, um Ihre Projekt-Konfiguration anzupassen. **Initialisieren (interaktiv):** ```bash git flow init ``` > Sie beantworten Fragen zu Branch-Namenskonventionen. Standardwerte werden empfohlen. **Initialisieren (Standardwerte verwenden):** ```bash git flow init -d ``` --- ### ✨ Features Features sind für die Entwicklung neuer Funktionalität für kommende Releases. Sie existieren typischerweise nur in Entwickler-Repositories. **Neues Feature starten:** ```bash git flow feature start MEINFEATURE ``` > Erstellt Feature-Branch basierend auf 'develop' und wechselt dorthin **Feature beenden:** ```bash git flow feature finish MEINFEATURE ``` > Dies wird: > 1. MEINFEATURE in 'develop' mergen > 2. Den Feature-Branch entfernen > 3. Zurück zu 'develop' wechseln **Feature veröffentlichen (für Zusammenarbeit):** ```bash git flow feature publish MEINFEATURE ``` **Veröffentlichtes Feature abrufen:** ```bash git flow feature pull origin MEINFEATURE ``` **Origin Feature verfolgen:** ```bash git flow feature track MEINFEATURE ``` --- ### 🎁 Release erstellen Releases unterstützen die Vorbereitung neuer Produktions-Releases, erlauben kleinere Bugfixes und bereiten Meta-Daten vor. **Release starten:** ```bash git flow release start RELEASE [BASE] ``` > Erstellt Release-Branch von 'develop'. Optional [BASE] Commit SHA-1 angeben. **Release veröffentlichen:** ```bash git flow release publish RELEASE ``` **Remote Release verfolgen:** ```bash git flow release track RELEASE ``` **Release beenden:** ```bash git flow release finish RELEASE ``` > Dies wird: > 1. Release-Branch in 'master' mergen > 2. Das Release taggen > 3. Release zurück in 'develop' mergen > 4. Release-Branch entfernen > 💡 **Nicht vergessen:** Tags mit `git push --tags` pushen --- ### 🔥 Hotfixes Hotfixes addressieren kritische Probleme in Live-Produktionsversionen. Sie zweigen vom entsprechenden Tag auf master ab. **Hotfix starten:** ```bash git flow hotfix start VERSION [BASENAME] ``` **Hotfix beenden:** ```bash git flow hotfix finish VERSION ``` > Mergt zurück in 'develop' und 'master', und taggt den Master-Merge --- ### 📊 Befehls-Übersicht

Git Flow Befehle

### 🌊 Git Flow Schema

Git Flow Schema

--- ## 💡 Nützliche Tipps ### Nützliche Aliases **Nützliche Aliases konfigurieren:** ```bash git config --global alias.st status git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.unstage 'reset HEAD --' git config --global alias.last 'log -1 HEAD' git config --global alias.visual '!gitk' ``` ### .gitignore Dateien **.gitignore Datei erstellen:** ```bash echo "node_modules/" >> .gitignore echo "*.log" >> .gitignore echo ".env" >> .gitignore # Bereits verfolgte Dateien ignorieren git rm --cached echo "" >> .gitignore git add .gitignore git commit -m "Datei zu .gitignore hinzufügen" ``` ### Git Hooks **Lokale Hooks konfigurieren:** ```bash # Pre-commit Hook (Beispiel) cat > .git/hooks/pre-commit << 'EOF' #!/bin/sh # Tests vor jedem Commit ausführen npm test EOF chmod +x .git/hooks/pre-commit ``` --- ## 🌍 Andere Sprachen Dieses Cheat-Sheet ist in mehreren Sprachen verfügbar: | Sprache | Link | |---------|------| | 🇺🇸 Englisch | [README.md](../README.md) | | 🇸🇦 Arabisch | [git-cheat-sheet-ar.md](./git-cheat-sheet-ar.md) | | 🇧🇩 Bengali | [git-cheat-sheet-bn.md](./git-cheat-sheet-bn.md) | | 🇧🇷 Brasilianisches Portugiesisch | [git-cheat-sheet-pt_BR.md](./git-cheat-sheet-pt_BR.md) | | 🇨🇳 Chinesisch | [git-cheat-sheet-zh.md](./git-cheat-sheet-zh.md) | | 🇪🇸 Spanisch | [git-cheat-sheet-es.md](./git-cheat-sheet-es.md) | | 🇬🇷 Griechisch | [git-cheat-sheet-el.md](./git-cheat-sheet-el.md) | | 🇮🇳 Hindi | [git-cheat-sheet-hi.md](./git-cheat-sheet-hi.md) | | 🇰🇷 Koreanisch | [git-cheat-sheet-ko.md](./git-cheat-sheet-ko.md) | | 🇵🇱 Polnisch | [git-cheat-sheet-pl.md](./git-cheat-sheet-pl.md) | | 🇹🇷 Türkisch | [git-cheat-sheet-tr.md](./git-cheat-sheet-tr.md) | --- ## 🤝 Beitragen Wir begrüßen Beiträge! Sie können: - 🐛 Fehler oder Tippfehler melden - ✨ Neue Git-Befehle hinzufügen - 🌍 In neue Sprachen übersetzen - 💡 Erklärungen verbessern - 📝 Formatierung verbessern **Wie Sie beitragen:** 1. Forken Sie dieses Repository 2. Erstellen Sie Ihren Feature-Branch (`git checkout -b feature/FantastischesFeature`) 3. Committen Sie Ihre Änderungen (`git commit -m 'Fantastisches Feature hinzufügen'`) 4. Pushen Sie zum Branch (`git push origin feature/FantastischesFeature`) 5. Öffnen Sie einen Pull Request --- ## 📄 Lizenz Dieses Projekt ist Open Source und unter der [MIT-Lizenz](LICENSE) verfügbar. --- ## 📖 Zusätzliche Ressourcen - [Offizielle Git-Dokumentation](https://git-scm.com/doc) - [Atlassian Git-Tutorials](https://www.atlassian.com/git/tutorials) - [GitHub Git Cheat Sheet](https://education.github.com/git-cheat-sheet-education.pdf) - [Interaktives Git-Tutorial](https://learngitbranching.js.org/) - [Pro Git Buch (kostenlos)](https://git-scm.com/book/de/v2) - [Git Workflows](https://www.atlassian.com/git/tutorials/comparing-workflows) ---

⭐ Geben Sie diesem Repository einen Stern, wenn es hilfreich war!

================================================ FILE: other-sheets/git-cheat-sheet-el.md ================================================ # Git Cheat Sheet Ελληνικά ![Git Logo](../Img/git-logo.png) Ένας γρήγορος οδηγός αναφοράς για τις πιο χρησιμοποιούμενες εντολές Git, οργανωμένες σε κατηγορίες για εύκολη χρήση. --- ## 📖 Σχετικά με τον Οδηγό Αυτός ο περιεκτικός οδηγός αναφοράς Git είναι μια πλήρης αναφορά για όλους όσους θέλουν να βελτιώσουν τη ροή εργασίας τους με το Git. Από αρχάριους που ξεκινούν το ταξίδι τους με το Git μέχρι έμπειρους προγραμματιστές, αυτός ο οδηγός παρέχει οργανωμένες και κατηγοριοποιημένες εντολές για να επιταχύνει το ταξίδι ανάπτυξής σας. ### Βασικά Χαρακτηριστικά: - **Οργανωμένες κατηγορίες**: Οι εντολές είναι ταξινομημένες σε σαφείς και λογικές ομάδες - **Πρακτικά παραδείγματα**: Με περιπτώσεις χρήσης από τον πραγματικό κόσμο - **Φιλικό προς αρχάριους**: Με σαφείς εξηγήσεις και συμβουλές - **Γρήγορη αναφορά**: Γρήγορη πρόσβαση στις απαραίτητες εντολές --- ## 📑 Πίνακας Περιεχομένων - [📖 Σχετικά με τον Οδηγό](#σχετικά-με-τον-οδηγό) - [🔧 Αρχική Ρύθμιση](#αρχική-ρύθμιση) - [📁 Ρύθμιση Αποθετηρίου](#ρύθμιση-αποθετηρίου) - [📊 Εντολές Κατάστασης](#εντολές-κατάστασης) - [📝 Διαχείριση Αρχείων](#διαχείριση-αρχείων) - [💾 Υποβολές (Commits)](#υποβολές-commits) - [🌿 Κλάδοι (Branches)](#κλάδοι-branches) - [🔀 Συγχώνευση (Merge)](#συγχώνευση-merge) - [🌐 Απομακρυσμένα Αποθετήρια](#απομακρυσμένα-αποθετήρια) - [📚 Ιστορικό και Αρχεία](#ιστορικό-και-αρχεία) - [🏷️ Ετικέτες (Tags)](#ετικέτες-tags) - [↩️ Αναίρεση Αλλαγών](#αναίρεση-αλλαγών) - [📦 Αποθήκευση (Stash)](#αποθήκευση-stash) - [🌊 Git Flow](#git-flow) - [⚙️ Αρχεία Ρυθμίσεων](#αρχεία-ρυθμίσεων) - [🔍 Αναζήτηση](#αναζήτηση) - [📁 Μετακίνηση/Μετονομασία](#μετακίνησημετονομασία) - [💡 Χρήσιμες Συμβουλές](#χρήσιμες-συμβουλές) - [🌍 Άλλες Γλώσσες](#άλλες-γλώσσες) - [🤝 Συνεισφορά](#συνεισφορά) - [📄 Άδεια Χρήσης](#άδεια-χρήσης) - [📖 Επιπλέον Πόροι](#επιπλέον-πόροι) --- ## 🔧 Αρχική Ρύθμιση Ρυθμίστε το Git με τις προσωπικές σας πληροφορίες: ```bash # Ρύθμιση ονόματος χρήστη git config --global user.name "Το Όνομά Σας" # Ρύθμιση email git config --global user.email "email@example.com" # Προβολή τρεχουσών ρυθμίσεων git config --list # Ρύθμιση προεπιλεγμένου επεξεργαστή git config --global core.editor "nano" # Ρύθμιση εργαλείου συγχώνευσης git config --global merge.tool vimdiff ``` --- ## 📁 Ρύθμιση Αποθετηρίου ### Δημιουργία νέου αποθετηρίου: ```bash # Δημιουργία νέου Git αποθετηρίου git init # Κλωνοποίηση υπάρχοντος αποθετηρίου git clone # Κλωνοποίηση σε συγκεκριμένο φάκελο git clone <όνομα-φακέλου> ``` --- ## 📊 Εντολές Κατάστασης ### Έλεγχος κατάστασης του αποθετηρίου σας: ```bash # Προβολή τρέχουσας κατάστασης αποθετηρίου git status # Προβολή κατάστασης σε σύντομη μορφή git status -s # Προβολή κατάστασης αγνοώντας μη παρακολουθούμενα αρχεία git status --ignored # Προβολή διαφορών σε τροποποιημένα αρχεία git diff # Προβολή διαφορών στην περιοχή staging git diff --staged # Προβολή διαφορών μεταξύ κλάδων git diff <κλάδος1> <κλάδος2> ``` --- ## 📝 Διαχείριση Αρχείων ### Προσθήκη και αφαίρεση αρχείων: ```bash # Προσθήκη συγκεκριμένου αρχείου στην περιοχή staging git add <αρχείο> # Προσθήκη όλων των τροποποιημένων αρχείων git add . # Προσθήκη όλων των αρχείων συγκεκριμένου τύπου git add *.txt # Διαδραστική προσθήκη git add -i # Αφαίρεση αρχείου από αποθετήριο και φάκελο εργασίας git rm <αρχείο> # Αφαίρεση αρχείου μόνο από αποθετήριο (διατήρηση στον φάκελο) git rm --cached <αρχείο> # Μετακίνηση/μετονομασία αρχείου git mv <αρχείο-πηγής> <αρχείο-προορισμού> ``` --- ## 💾 Υποβολές (Commits) ### Αποθήκευση αλλαγών στο αποθετήριο: ```bash # Υποβολή με μήνυμα git commit -m "Μήνυμα υποβολής" # Υποβολή προσθέτοντας όλα τα τροποποιημένα αρχεία git commit -am "Μήνυμα υποβολής" # Τροποποίηση της τελευταίας υποβολής git commit --amend # Κενή υποβολή (χρήσιμη για CI/CD triggers) git commit --allow-empty -m "Trigger CI" # Υποβολή με λεπτομερές μήνυμα (ανοίγει επεξεργαστή) git commit ``` --- ## 🌿 Κλάδοι (Branches) ### Εργασία με κλάδους: ```bash # Προβολή όλων των κλάδων git branch # Προβολή απομακρυσμένων κλάδων git branch -r # Προβολή όλων των κλάδων (τοπικών και απομακρυσμένων) git branch -a # Δημιουργία νέου κλάδου git branch <όνομα-κλάδου> # Μετάβαση σε κλάδο git checkout <όνομα-κλάδου> # Δημιουργία και μετάβαση σε νέο κλάδο git checkout -b <όνομα-κλάδου> # Δημιουργία κλάδου από συγκεκριμένη υποβολή git checkout -b <όνομα-κλάδου> # Διαγραφή κλάδου git branch -d <όνομα-κλάδου> # Βίαιη διαγραφή κλάδου git branch -D <όνομα-κλάδου> # Μετονομασία τρέχοντος κλάδου git branch -m <νέο-όνομα> # Μετονομασία συγκεκριμένου κλάδου git branch -m <παλιό-όνομα> <νέο-όνομα> ``` --- ## 🔀 Συγχώνευση (Merge) ### Συγχώνευση αλλαγών μεταξύ κλάδων: ```bash # Συγχώνευση κλάδου στον τρέχοντα κλάδο git merge <όνομα-κλάδου> # Συγχώνευση χωρίς fast-forward (δημιουργία merge commit) git merge --no-ff <όνομα-κλάδου> # Συγχώνευση μόνο αν είναι fast-forward git merge --ff-only <όνομα-κλάδου> # Ακύρωση τρέχουσας συγχώνευσης git merge --abort # Συνέχιση συγχώνευσης μετά την επίλυση συγκρούσεων git merge --continue ``` --- ## 🌐 Απομακρυσμένα Αποθετήρια ### Διαχείριση απομακρυσμένων αποθετηρίων: ```bash # Προβολή απομακρυσμένων αποθετηρίων git remote # Προβολή απομακρυσμένων αποθετηρίων με URLs git remote -v # Προσθήκη απομακρυσμένου αποθετηρίου git remote add <όνομα> # Αλλαγή URL απομακρυσμένου αποθετηρίου git remote set-url <όνομα> <νέο-url> # Αφαίρεση απομακρυσμένου αποθετηρίου git remote remove <όνομα> # Αποστολή αλλαγών στο απομακρυσμένο αποθετήριο git push <απομακρυσμένο> <κλάδος> # Αποστολή κλάδου και ρύθμιση παρακολούθησης git push -u <απομακρυσμένο> <κλάδος> # Αποστολή όλων των κλάδων git push --all # Αποστολή ετικετών git push --tags # Λήψη αλλαγών από απομακρυσμένο αποθετήριο git pull <απομακρυσμένο> <κλάδος> # Λήψη αλλαγών χωρίς συγχώνευση git fetch <απομακρυσμένο> # Λήψη όλων των απομακρυσμένων κλάδων git fetch --all ``` --- ## 📚 Ιστορικό και Αρχεία ### Εξερεύνηση ιστορικού υποβολών: ```bash # Προβολή ιστορικού υποβολών git log # Προβολή ιστορικού σε μία γραμμή ανά υποβολή git log --oneline # Προβολή ιστορικού με γράφημα git log --graph # Προβολή ιστορικού συγκεκριμένου αρχείου git log <αρχείο> # Προβολή στατιστικών υποβολών git log --stat # Προβολή αλλαγών σε κάθε υποβολή git log -p # Προβολή τελευταίων N υποβολών git log -n <αριθμός> # Προβολή υποβολών μεταξύ ημερομηνιών git log --since="2023-01-01" --until="2023-12-31" # Προβολή υποβολών ανά συγγραφέα git log --author="Όνομα Συγγραφέα" # Αναζήτηση σε μηνύματα υποβολών git log --grep="λέξη κλειδί" ``` --- ## 🏷️ Ετικέτες (Tags) ### Διαχείριση ετικετών έκδοσης: ```bash # Προβολή όλων των ετικετών git tag # Δημιουργία ελαφριάς ετικέτας git tag <όνομα-ετικέτας> # Δημιουργία σχολιασμένης ετικέτας git tag -a <όνομα-ετικέτας> -m "Μήνυμα ετικέτας" # Δημιουργία ετικέτας σε συγκεκριμένη υποβολή git tag -a <όνομα-ετικέτας> # Προβολή πληροφοριών ετικέτας git show <όνομα-ετικέτας> # Διαγραφή τοπικής ετικέτας git tag -d <όνομα-ετικέτας> # Διαγραφή απομακρυσμένης ετικέτας git push --delete <απομακρυσμένο> <όνομα-ετικέτας> # Αποστολή συγκεκριμένης ετικέτας git push <απομακρυσμένο> <όνομα-ετικέτας> # Αποστολή όλων των ετικετών git push <απομακρυσμένο> --tags ``` --- ## ↩️ Αναίρεση Αλλαγών ### Επαναφορά τροποποιήσεων: ```bash # Ακύρωση αλλαγών σε συγκεκριμένο αρχείο git checkout <αρχείο> # Ακύρωση όλων των μη υποβληθεισών αλλαγών git checkout . # Επαναφορά αρχείου σε συγκεκριμένη έκδοση git checkout <αρχείο> # Αφαίρεση αρχείου από την περιοχή staging git reset <αρχείο> # Αφαίρεση όλων των αρχείων από την περιοχή staging git reset # Επιστροφή στην προηγούμενη υποβολή (διατήρηση αλλαγών) git reset --soft HEAD~1 # Επιστροφή στην προηγούμενη υποβολή (ακύρωση αλλαγών) git reset --hard HEAD~1 # Επιστροφή σε συγκεκριμένη υποβολή git reset --hard # Δημιουργία υποβολής που ακυρώνει άλλη υποβολή git revert # Ακύρωση πολλαπλών υποβολών git revert .. ``` --- ## 📦 Αποθήκευση (Stash) ### Προσωρινή αποθήκευση εργασίας: ```bash # Αποθήκευση τρεχουσών αλλαγών στο stash git stash # Αποθήκευση με περιγραφικό μήνυμα git stash save "Περιγραφικό μήνυμα" # Προβολή όλων των stashes git stash list # Εφαρμογή του τελευταίου stash git stash apply # Εφαρμογή συγκεκριμένου stash git stash apply stash@{0} # Εφαρμογή και διαγραφή του τελευταίου stash git stash pop # Διαγραφή συγκεκριμένου stash git stash drop stash@{0} # Διαγραφή όλων των stashes git stash clear # Προβολή αλλαγών σε stash git stash show stash@{0} # Δημιουργία κλάδου από stash git stash branch <όνομα-κλάδου> stash@{0} ``` --- ## 🌊 Git Flow Το Git Flow είναι ένα μοντέλο διακλάδωσης που ορίζει μια αυστηρή ροή εργασίας σχεδιασμένη γύρω από την έκδοση του έργου. ### Κύριοι κλάδοι: - **master/main**: Κώδικας παραγωγής - **develop**: Κύριος κλάδος ανάπτυξης ### Κλάδοι υποστήριξης: - **feature**: Για νέες λειτουργίες - **release**: Για προετοιμασία νέων εκδόσεων - **hotfix**: Για επείγουσες διορθώσεις στην παραγωγή ### Εντολές Git Flow: ```bash # Αρχικοποίηση git flow git flow init # Έναρξη νέας λειτουργίας git flow feature start <όνομα-λειτουργίας> # Ολοκλήρωση λειτουργίας git flow feature finish <όνομα-λειτουργίας> # Δημοσίευση λειτουργίας git flow feature publish <όνομα-λειτουργίας> # Έναρξη έκδοσης git flow release start <έκδοση> # Ολοκλήρωση έκδοσης git flow release finish <έκδοση> # Έναρξη hotfix git flow hotfix start <έκδοση> # Ολοκλήρωση hotfix git flow hotfix finish <έκδοση> ``` ### Ροή εργασίας χωρίς Git Flow: ![Git Flow Commands](../Img/git-flow-commands-without-flow.png) ```bash # Δημιουργία κλάδου λειτουργίας git checkout develop git checkout -b feature/νέα-λειτουργία # Εργασία στη λειτουργία git add . git commit -m "Προσθήκη νέας λειτουργίας" # Συγχώνευση λειτουργίας στο develop git checkout develop git merge --no-ff feature/νέα-λειτουργία git branch -d feature/νέα-λειτουργία # Δημιουργία κλάδου έκδοσης git checkout develop git checkout -b release/1.0.0 # Ολοκλήρωση έκδοσης git checkout master git merge --no-ff release/1.0.0 git tag -a 1.0.0 -m "Έκδοση 1.0.0" git checkout develop git merge --no-ff release/1.0.0 git branch -d release/1.0.0 ``` --- ## 💡 Χρήσιμες Συμβουλές ### Χρήσιμα aliases: ```bash # Ρύθμιση χρήσιμων aliases git config --global alias.st status git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.unstage 'reset HEAD --' git config --global alias.last 'log -1 HEAD' git config --global alias.visual '!gitk' ``` ### Αρχεία .gitignore: ```bash # Δημιουργία αρχείου .gitignore echo "node_modules/" >> .gitignore echo "*.log" >> .gitignore echo ".env" >> .gitignore # Αγνόηση ήδη παρακολουθούμενων αρχείων git rm --cached <αρχείο> echo "<αρχείο>" >> .gitignore git add .gitignore git commit -m "Προσθήκη αρχείου στο .gitignore" ``` --- ## ⚙️ Αρχεία Ρυθμίσεων Το Git χρησιμοποιεί αρχεία ρυθμίσεων για την αποθήκευση προτιμήσεων χρήστη και αποθετηρίου: ### Επίπεδα ρυθμίσεων: ```bash # Συστήματος (όλοι οι χρήστες) git config --system # Χρήστη (τρέχων χρήστης) git config --global # Αποθετηρίου (συγκεκριμένο έργο) git config --local ``` ### Κοινές ρυθμίσεις: ```bash # Ταυτότητα χρήστη git config --global user.name "Το Όνομά σας" git config --global user.email "email@example.com" # Επεξεργαστής κειμένου git config --global core.editor nano # Εργαλείο συγχώνευσης git config --global merge.tool vimdiff # Χρώματα στην έξοδο git config --global color.ui auto # Προβολή ρυθμίσεων git config --list ``` --- ## 🔍 Αναζήτηση ### Αναζήτηση στο ιστορικό και περιεχόμενο: ```bash # Αναζήτηση στα μηνύματα υποβολών git log --grep="λέξη-κλειδί" # Αναζήτηση αλλαγών στον κώδικα git log -S "κομμάτι κώδικα" # Αναζήτηση σε αρχεία εργασίας git grep "μοτίβο" # Αναζήτηση σε συγκεκριμένη υποβολή git grep "μοτίβο" # Αναζήτηση με αγνόηση πεζών/κεφαλαίων git grep -i "μοτίβο" # Αναζήτηση ολόκληρων λέξεων git grep -w "λέξη" # Εμφάνιση αριθμών γραμμών git grep -n "μοτίβο" ``` --- ## 📁 Μετακίνηση/Μετονομασία ### Μετακίνηση και μετονομασία αρχείων: ```bash # Μετονομασία αρχείου git mv παλιό_όνομα.txt νέο_όνομα.txt # Μετακίνηση αρχείου σε φάκελο git mv αρχείο.txt φάκελος/ # Μετονομασία φακέλου git mv παλιός_φάκελος νέος_φάκελος # Διαδικασία μετονομασίας χωρίς git mv mv παλιό_όνομα.txt νέο_όνομα.txt git add νέο_όνομα.txt git rm παλιό_όνομα.txt # Εντοπισμός μετονομασιών στο log git log --follow αρχείο.txt # Παρακολούθηση μετακινήσεων git log --stat -M ``` --- ## 🌍 Άλλες Γλώσσες Αυτό το Git cheat sheet είναι διαθέσιμο σε διάφορες γλώσσες: | Γλώσσα | Αρχείο | |--------|---------| | 🇺🇸 English | [README.md](../README.md) | | 🇸🇦 العربية | [git-cheat-sheet-ar.md](git-cheat-sheet-ar.md) | | 🇧🇩 বাংলা | [git-cheat-sheet-bn.md](git-cheat-sheet-bn.md) | | 🇩🇪 Deutsch | [git-cheat-sheet-de.md](git-cheat-sheet-de.md) | | 🇬🇷 **Ελληνικά** | [git-cheat-sheet-el.md](git-cheat-sheet-el.md) | | 🇪🇸 Español | [git-cheat-sheet-es.md](git-cheat-sheet-es.md) | | 🇮🇳 हिन्दी | [git-cheat-sheet-hi.md](git-cheat-sheet-hi.md) | | 🇰🇷 한국어 | [git-cheat-sheet-ko.md](git-cheat-sheet-ko.md) | | 🇵🇱 Polski | [git-cheat-sheet-pl.md](git-cheat-sheet-pl.md) | | 🇧🇷 Português (Brasil) | [git-cheat-sheet-pt_BR.md](git-cheat-sheet-pt_BR.md) | | 🇹🇷 Türkçe | [git-cheat-sheet-tr.md](git-cheat-sheet-tr.md) | | 🇨🇳 中文 | [git-cheat-sheet-zh.md](git-cheat-sheet-zh.md) | --- ## 🤝 Συνεισφορά Οι συνεισφορές είναι ευπρόσδεκτες! Αν θέλετε να βελτιώσετε αυτό το cheat sheet: 1. Κάντε Fork το αποθετήριο 2. Δημιουργήστε έναν κλάδο λειτουργίας (`git checkout -b feature/βελτίωση`) 3. Κάντε commit τις αλλαγές σας (`git commit -am 'Προσθήκη νέας λειτουργίας'`) 4. Κάντε Push στον κλάδο (`git push origin feature/βελτίωση`) 5. Δημιουργήστε ένα Pull Request Παρακαλούμε ακολουθήστε τις οδηγίες συνεισφοράς και διασφαλίστε ότι ο κώδικάς σας ακολουθεί τα υπάρχοντα πρότυπα. --- ## 📄 Άδεια Χρήσης Αυτό το έργο αδειοδοτείται με την [MIT License](https://opensource.org/licenses/MIT). Μπορείτε ελεύθερα να χρησιμοποιήσετε, τροποποιήσετε και διανείμετε αυτό το cheat sheet σύμφωνα με τους όρους της άδειας MIT. --- ## 📖 Επιπλέον Πόροι - [Επίσημη Τεκμηρίωση Git](https://git-scm.com/doc) - [Atlassian Git Tutorials](https://www.atlassian.com/git/tutorials) - [GitHub Git Cheat Sheet](https://education.github.com/git-cheat-sheet-education.pdf) - [Διαδραστικό Git Tutorial](https://learngitbranching.js.org/) --- **Σημείωση**: Αυτό το cheat sheet καλύπτει τις πιο συνηθισμένες εντολές Git. Για πιο προχωρημένες χρήσεις, συμβουλευτείτε την επίσημη τεκμηρίωση του Git. ================================================ FILE: other-sheets/git-cheat-sheet-es.md ================================================ # Git Cheat Sheet Español ![Git Logo](../Img/git-logo.png) Una guía de referencia rápida para los comandos de Git más utilizados, organizados por categorías para facilitar su consulta. --- ## 📖 Acerca de esta Guía Esta guía completa de referencia de Git es un recurso integral para cualquiera que busque mejorar su flujo de trabajo con Git. Desde principiantes que comienzan su viaje con Git hasta desarrolladores experimentados, esta guía proporciona comandos organizados y categorizados para acelerar tu proceso de desarrollo. ### Características Principales: - **Categorías organizadas**: Los comandos están organizados en grupos claros y lógicos - **Ejemplos prácticos**: Con casos de uso del mundo real - **Amigable para principiantes**: Con explicaciones claras y consejos - **Referencia rápida**: Acceso rápido a comandos esenciales --- ## 📑 Tabla de Contenidos - [� Acerca de esta Guía](#acerca-de-esta-guía) - [�🔧 Configuración Inicial](#configuración-inicial) - [📁 Configuración de Repositorio](#configuración-de-repositorio) - [📊 Comandos de Estado](#comandos-de-estado) - [📝 Gestión de Archivos](#gestión-de-archivos) - [💾 Commits](#commits) - [🌿 Ramas (Branches)](#ramas-branches) - [🔀 Fusión (Merge)](#fusión-merge) - [🌐 Remotos](#remotos) - [📚 Historial y Logs](#historial-y-logs) - [🏷️ Etiquetas (Tags)](#etiquetas-tags) - [↩️ Deshacer Cambios](#deshacer-cambios) - [📦 Stash](#stash) - [🌊 Git Flow](#git-flow) - [⚙️ Archivos de Configuración](#archivos-de-configuración) - [🔍 Búsqueda](#búsqueda) - [📁 Mover/Renombrar](#moverrenombrar) - [💡 Consejos Útiles](#consejos-útiles) - [🌍 Otros Idiomas](#otros-idiomas) - [🤝 Contribuir](#contribuir) - [📄 Licencia](#licencia) - [📖 Recursos Adicionales](#recursos-adicionales) --- ## 🔧 Configuración Inicial Configurar Git con tu información personal: ```bash # Configurar nombre de usuario git config --global user.name "Tu Nombre" # Configurar email git config --global user.email "tuemail@ejemplo.com" # Ver configuración actual git config --list # Configurar editor por defecto git config --global core.editor "nano" # Configurar herramienta de diff git config --global merge.tool vimdiff ``` --- ## 📁 Configuración de Repositorio ### Inicializar un nuevo repositorio: ```bash # Crear un nuevo repositorio Git git init # Clonar un repositorio existente git clone # Clonar a un directorio específico git clone ``` --- ## 📊 Comandos de Estado ### Verificar el estado de tu repositorio: ```bash # Mostrar estado actual del repositorio git status # Mostrar estado en formato corto git status -s # Mostrar estado ignorando archivos no rastreados git status --ignored # Mostrar diferencias en archivos modificados git diff # Mostrar diferencias en el área de preparación git diff --staged # Mostrar diferencias entre ramas git diff ``` --- ## 📝 Gestión de Archivos ### Agregar y remover archivos: ```bash # Agregar archivo específico al área de preparación git add # Agregar todos los archivos modificados git add . # Agregar todos los archivos de un tipo específico git add *.txt # Agregar interactivamente git add -i # Remover archivo del repositorio y del directorio de trabajo git rm # Remover archivo solo del repositorio (mantener en directorio) git rm --cached # Mover/renombrar archivo git mv ``` --- ## 💾 Commits ### Guardar cambios en el repositorio: ```bash # Hacer commit con mensaje git commit -m "Mensaje del commit" # Hacer commit agregando todos los archivos modificados git commit -am "Mensaje del commit" # Modificar el último commit git commit --amend # Hacer commit vacío (útil para triggers de CI/CD) git commit --allow-empty -m "Trigger CI" # Hacer commit con mensaje detallado (abre editor) git commit ``` --- ## 🌿 Ramas (Branches) ### Trabajar con ramas: ```bash # Listar todas las ramas git branch # Listar ramas remotas git branch -r # Listar todas las ramas (locales y remotas) git branch -a # Crear nueva rama git branch # Cambiar a una rama git checkout # Crear y cambiar a nueva rama git checkout -b # Crear rama desde un commit específico git checkout -b # Eliminar rama git branch -d # Eliminar rama forzadamente git branch -D # Renombrar rama actual git branch -m # Renombrar rama específica git branch -m ``` --- ## 🔀 Fusión (Merge) ### Fusionar cambios entre ramas: ```bash # Fusionar rama en la rama actual git merge # Fusionar sin fast-forward (crear commit de merge) git merge --no-ff # Fusionar solo si es fast-forward git merge --ff-only # Abortar fusión en curso git merge --abort # Continuar fusión después de resolver conflictos git merge --continue ``` --- ## 🌐 Remotos ### Gestionar repositorios remotos: ```bash # Listar repositorios remotos git remote # Listar repositorios remotos con URLs git remote -v # Agregar repositorio remoto git remote add # Cambiar URL de repositorio remoto git remote set-url # Eliminar repositorio remoto git remote remove # Subir cambios al repositorio remoto git push # Subir rama y establecer tracking git push -u # Subir todas las ramas git push --all # Subir etiquetas git push --tags # Descargar cambios del repositorio remoto git pull # Descargar cambios sin fusionar git fetch # Descargar todas las ramas remotas git fetch --all ``` --- ## 📚 Historial y Logs ### Explorar el historial de commits: ```bash # Mostrar historial de commits git log # Mostrar historial en una línea por commit git log --oneline # Mostrar historial con gráfico git log --graph # Mostrar historial de un archivo específico git log # Mostrar estadísticas de commits git log --stat # Mostrar cambios en cada commit git log -p # Mostrar últimos N commits git log -n # Mostrar commits entre fechas git log --since="2023-01-01" --until="2023-12-31" # Mostrar commits por autor git log --author="Nombre del Autor" # Buscar en mensajes de commit git log --grep="palabra clave" ``` --- ## 🏷️ Etiquetas (Tags) ### Gestionar etiquetas de versión: ```bash # Listar todas las etiquetas git tag # Crear etiqueta ligera git tag # Crear etiqueta anotada git tag -a -m "Mensaje de la etiqueta" # Crear etiqueta en commit específico git tag -a # Mostrar información de una etiqueta git show # Eliminar etiqueta local git tag -d # Eliminar etiqueta remota git push --delete # Subir etiqueta específica git push # Subir todas las etiquetas git push --tags ``` --- ## ↩️ Deshacer Cambios ### Revertir modificaciones: ```bash # Descartar cambios en archivo específico git checkout # Descartar todos los cambios no confirmados git checkout . # Revertir archivo a versión específica git checkout # Quitar archivo del área de preparación git reset # Quitar todos los archivos del área de preparación git reset # Revertir al commit anterior (mantener cambios) git reset --soft HEAD~1 # Revertir al commit anterior (descartar cambios) git reset --hard HEAD~1 # Revertir a commit específico git reset --hard # Crear commit que revierte otro commit git revert # Revertir múltiples commits git revert .. ``` --- ## 📦 Stash ### Guardar trabajo temporalmente: ```bash # Guardar cambios actuales en stash git stash # Guardar con mensaje descriptivo git stash save "Mensaje descriptivo" # Listar todos los stashes git stash list # Aplicar el último stash git stash apply # Aplicar stash específico git stash apply stash@{0} # Aplicar y eliminar el último stash git stash pop # Eliminar stash específico git stash drop stash@{0} # Eliminar todos los stashes git stash clear # Mostrar cambios en un stash git stash show stash@{0} # Crear rama desde un stash git stash branch stash@{0} ``` --- ## 🌊 Git Flow Git Flow es un modelo de ramificación que define un flujo de trabajo estricto diseñado alrededor del lanzamiento del proyecto. ### Ramas principales: - **master/main**: Código de producción - **develop**: Rama de desarrollo principal ### Ramas de soporte: - **feature**: Para nuevas características - **release**: Para preparar nuevas versiones - **hotfix**: Para correcciones urgentes en producción ### Comandos Git Flow: ```bash # Inicializar git flow git flow init # Iniciar nueva característica git flow feature start # Finalizar característica git flow feature finish # Publicar característica git flow feature publish # Iniciar release git flow release start # Finalizar release git flow release finish # Iniciar hotfix git flow hotfix start # Finalizar hotfix git flow hotfix finish ``` ### Flujo de trabajo sin Git Flow: ![Git Flow Commands](../Img/git-flow-commands-without-flow.png) ```bash # Crear rama de característica git checkout develop git checkout -b feature/nueva-caracteristica # Trabajar en la característica git add . git commit -m "Agregar nueva característica" # Fusionar característica en develop git checkout develop git merge --no-ff feature/nueva-caracteristica git branch -d feature/nueva-caracteristica # Crear rama de release git checkout develop git checkout -b release/1.0.0 # Finalizar release git checkout master git merge --no-ff release/1.0.0 git tag -a 1.0.0 -m "Versión 1.0.0" git checkout develop git merge --no-ff release/1.0.0 git branch -d release/1.0.0 ``` --- ## ⚙️ Archivos de Configuración Git utiliza archivos de configuración para almacenar preferencias de usuario y repositorio: ### Niveles de configuración: ```bash # Sistema (todos los usuarios) git config --system # Usuario (usuario actual) git config --global # Repositorio (proyecto específico) git config --local ``` ### Configuraciones comunes: ```bash # Identidad del usuario git config --global user.name "Tu Nombre" git config --global user.email "email@ejemplo.com" # Editor de texto git config --global core.editor nano # Herramienta de merge git config --global merge.tool vimdiff # Colores en la salida git config --global color.ui auto # Ver configuraciones git config --list ``` --- ## 🔍 Búsqueda ### Buscar en el historial y contenido: ```bash # Buscar en mensajes de commit git log --grep="palabra-clave" # Buscar cambios en el código git log -S "fragmento de código" # Buscar en archivos de trabajo git grep "patrón" # Buscar en commit específico git grep "patrón" # Buscar ignorando mayúsculas/minúsculas git grep -i "patrón" # Buscar palabras completas git grep -w "palabra" # Mostrar números de línea git grep -n "patrón" ``` --- ## 📁 Mover/Renombrar ### Mover y renombrar archivos: ```bash # Renombrar archivo git mv archivo_viejo.txt archivo_nuevo.txt # Mover archivo a carpeta git mv archivo.txt carpeta/ # Renombrar carpeta git mv carpeta_vieja carpeta_nueva # Proceso de renombrado sin git mv mv archivo_viejo.txt archivo_nuevo.txt git add archivo_nuevo.txt git rm archivo_viejo.txt # Rastrear renombrados en el log git log --follow archivo.txt # Detectar movimientos git log --stat -M ``` --- ## 💡 Consejos Útiles ### Alias útiles: ```bash # Configurar alias útiles git config --global alias.st status git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.unstage 'reset HEAD --' git config --global alias.last 'log -1 HEAD' git config --global alias.visual '!gitk' ``` ### Archivos .gitignore: ```bash # Crear archivo .gitignore echo "node_modules/" >> .gitignore echo "*.log" >> .gitignore echo ".env" >> .gitignore # Ignorar archivos ya rastreados git rm --cached echo "" >> .gitignore git add .gitignore git commit -m "Agregar archivo a .gitignore" ``` --- ## 🌍 Otros Idiomas Esta hoja de referencia está disponible en los siguientes idiomas: - 🇺🇸 [English](../README.md) - 🇸🇦 [العربية](git-cheat-sheet-ar.md) - 🇧🇩 [বাংলা](git-cheat-sheet-bn.md) - 🇩🇪 [Deutsch](git-cheat-sheet-de.md) - 🇬🇷 [Ελληνικά](git-cheat-sheet-el.md) - 🇪🇸 **Español** (actual) - 🇮🇳 [हिन्दी](git-cheat-sheet-hi.md) - 🇰🇷 [한국어](git-cheat-sheet-ko.md) - 🇵🇱 [Polski](git-cheat-sheet-pl.md) - 🇧🇷 [Português](git-cheat-sheet-pt_BR.md) - 🇹🇷 [Türkçe](git-cheat-sheet-tr.md) - 🇨🇳 [中文](git-cheat-sheet-zh.md) --- ## 🤝 Contribuir ¡Las contribuciones son bienvenidas! Para ayudar a mejorar este proyecto: 1. **Reportar problemas**: Comparte errores o sugerencias de mejora 2. **Agregar nuevos idiomas**: Crea traducciones o mejora las existentes 3. **Mejorar contenido**: Agrega nuevos comandos, ejemplos o explicaciones 4. **Dar retroalimentación**: Comparte tus experiencias y sugerencias ### Cómo contribuir: - [Abrir un issue en GitHub](https://github.com/arslanbilal/git-cheat-sheet/issues) - Enviar un pull request - Sugerir mejoras de documentación --- ## 📄 Licencia Este proyecto está licenciado bajo la Licencia MIT. Consulta el archivo [LICENSE](../LICENSE) para más detalles. --- ## 📖 Recursos Adicionales - [Documentación Oficial de Git](https://git-scm.com/doc) - [Tutoriales de Git de Atlassian](https://www.atlassian.com/git/tutorials) - [Hoja de Referencia de Git de GitHub](https://education.github.com/git-cheat-sheet-education.pdf) - [Tutorial Interactivo de Git](https://learngitbranching.js.org/) - [Libro Pro Git (gratuito)](https://git-scm.com/book/es/v2) - [Flujos de Trabajo con Git](https://www.atlassian.com/git/tutorials/comparing-workflows) ---
⭐ ¡Si esta hoja de referencia es útil, dale una estrella!
¡Feliz codificación con Git! 🚀
================================================ FILE: other-sheets/git-cheat-sheet-hi.md ================================================ # Git Cheat Sheet हिन्दी ![Git Logo](../Img/git-logo.png) सबसे अधिक उपयोग किए जाने वाले Git कमांड का एक त्वरित संदर्भ गाइड, आसान उपयोग के लिए श्रेणियों में व्यवस्थित। --- ## 📖 इस गाइड के बारे में यह व्यापक Git संदर्भ गाइड उन सभी के लिए एक संपूर्ण संसाधन है जो Git के साथ अपने वर्कफ़्लो को बेहतर बनाना चाहते हैं। Git के साथ अपनी यात्रा शुरू करने वाले शुरुआती लोगों से लेकर अनुभवी डेवलपर्स तक, यह गाइड आपकी विकास यात्रा को तेज़ करने के लिए व्यवस्थित और वर्गीकृत कमांड प्रदान करता है। ### मुख्य विशेषताएं: - **व्यवस्थित श्रेणियां**: कमांड स्पष्ट और तर्कसंगत समूहों में व्यवस्थित हैं - **व्यावहारिक उदाहरण**: वास्तविक दुनिया के उपयोग के मामलों के साथ - **शुरुआती-अनुकूल**: स्पष्ट व्याख्या और सुझावों के साथ - **त्वरित संदर्भ**: आवश्यक कमांड तक त्वरित पहुंच --- ## 📑 विषय सूची - [📖 इस गाइड के बारे में](#इस-गाइड-के-बारे-में) - [🔧 प्रारंभिक सेटअप](#प्रारंभिक-सेटअप) - [⚙️ कॉन्फ़िगरेशन फ़ाइलें](#कॉन्फ़िगरेशन-फ़ाइलें) - [📁 रिपॉजिटरी सेटअप](#रिपॉजिटरी-सेटअप) - [📊 स्थिति कमांड](#स्थिति-कमांड) - [📝 फ़ाइल प्रबंधन](#फ़ाइल-प्रबंधन) - [💾 कमिट](#कमिट) - [🌿 ब्रांच](#ब्रांच) - [🔀 मर्ज](#मर्ज) - [🌐 रिमोट रिपॉजिटरी](#रिमोट-रिपॉजिटरी) - [📚 इतिहास और लॉग](#इतिहास-और-लॉग) - [🔍 खोज](#खोज) - [📁 स्थानांतरित/नाम बदलें](#स्थानांतरितनाम-बदलें) - [🏷️ टैग](#टैग) - [↩️ परिवर्तन पूर्ववत करना](#परिवर्तन-पूर्ववत-करना) - [📦 स्टैश](#स्टैश) - [🌊 Git Flow](#git-flow) - [💡 उपयोगी सुझाव](#उपयोगी-सुझाव) - [🌍 अन्य भाषाएं](#अन्य-भाषाएं) - [🤝 योगदान](#योगदान) - [📄 लाइसेंस](#लाइसेंस) - [📖 अतिरिक्त संसाधन](#अतिरिक्त-संसाधन) --- ## 🔧 प्रारंभिक सेटअप अपनी व्यक्तिगत जानकारी के साथ Git कॉन्फ़िगर करें: ```bash # उपयोगकर्ता नाम सेट करें git config --global user.name "आपका नाम" # ईमेल सेट करें git config --global user.email "email@example.com" # वर्तमान कॉन्फ़िगरेशन देखें git config --list # डिफ़ॉल्ट एडिटर सेट करें git config --global core.editor "nano" # मर्ज टूल सेट करें git config --global merge.tool vimdiff ``` --- ## ⚙️ कॉन्फ़िगरेशन फ़ाइलें Git उपयोगकर्ता और रिपॉजिटरी प्राथमिकताएं संग्रहीत करने के लिए कॉन्फ़िगरेशन फ़ाइलों का उपयोग करता है: ### कॉन्फ़िगरेशन स्तर: ```bash # सिस्टम (सभी उपयोगकर्ता) git config --system # उपयोगकर्ता (वर्तमान उपयोगकर्ता) git config --global # रिपॉजिटरी (विशिष्ट प्रोजेक्ट) git config --local ``` ### सामान्य कॉन्फ़िगरेशन: ```bash # उपयोगकर्ता पहचान git config --global user.name "आपका नाम" git config --global user.email "email@example.com" # टेक्स्ट एडिटर git config --global core.editor nano # मर्ज टूल git config --global merge.tool vimdiff # आउटपुट में रंग git config --global color.ui auto # कॉन्फ़िगरेशन देखें git config --list ``` --- ## 📁 रिपॉजिटरी सेटअप ### नई रिपॉजिटरी बनाएं: ```bash # नई Git रिपॉजिटरी बनाएं git init # मौजूदा रिपॉजिटरी को क्लोन करें git clone <रिपॉजिटरी-url> # विशिष्ट डायरेक्टरी में क्लोन करें git clone <रिपॉजिटरी-url> <डायरेक्टरी-नाम> ``` --- ## 📊 स्थिति कमांड ### अपनी रिपॉजिटरी की स्थिति जांचें: ```bash # रिपॉजिटरी की वर्तमान स्थिति दिखाएं git status # संक्षिप्त प्रारूप में स्थिति दिखाएं git status -s # अनट्रैक की गई फ़ाइलों को अनदेखा करके स्थिति दिखाएं git status --ignored # संशोधित फ़ाइलों में अंतर दिखाएं git diff # स्टेजिंग क्षेत्र में अंतर दिखाएं git diff --staged # ब्रांच के बीच अंतर दिखाएं git diff <ब्रांच1> <ब्रांच2> ``` --- ## 📝 फ़ाइल प्रबंधन ### फ़ाइलें जोड़ना और हटाना: ```bash # विशिष्ट फ़ाइल को स्टेजिंग क्षेत्र में जोड़ें git add <फ़ाइल> # सभी संशोधित फ़ाइलें जोड़ें git add . # विशिष्ट प्रकार की सभी फ़ाइलें जोड़ें git add *.txt # इंटरैक्टिव रूप से जोड़ें git add -i # रिपॉजिटरी और कार्य डायरेक्टरी से फ़ाइल हटाएं git rm <फ़ाइल> # केवल रिपॉजिटरी से फ़ाइल हटाएं (डायरेक्टरी में रखें) git rm --cached <फ़ाइल> # फ़ाइल स्थानांतरित/नाम बदलें git mv <स्रोत-फ़ाइल> <गंतव्य-फ़ाइल> ``` --- ## 💾 कमिट ### रिपॉजिटरी में परिवर्तन सहेजें: ```bash # संदेश के साथ कमिट करें git commit -m "कमिट संदेश" # सभी संशोधित फ़ाइलें जोड़कर कमिट करें git commit -am "कमिट संदेश" # अंतिम कमिट को संशोधित करें git commit --amend # खाली कमिट करें (CI/CD ट्रिगर के लिए उपयोगी) git commit --allow-empty -m "CI ट्रिगर" # विस्तृत संदेश के साथ कमिट करें (एडिटर खुलेगा) git commit ``` --- ## 🌿 ब्रांच ### ब्रांच के साथ काम करना: ```bash # सभी ब्रांच दिखाएं git branch # रिमोट ब्रांच दिखाएं git branch -r # सभी ब्रांच दिखाएं (स्थानीय और रिमोट) git branch -a # नई ब्रांच बनाएं git branch <ब्रांच-नाम> # ब्रांच पर स्विच करें git checkout <ब्रांच-नाम> # नई ब्रांच बनाकर स्विच करें git checkout -b <ब्रांच-नाम> # विशिष्ट कमिट से ब्रांच बनाएं git checkout -b <ब्रांच-नाम> <कमिट-हैश> # ब्रांच हटाएं git branch -d <ब्रांच-नाम> # जबरदस्ती ब्रांच हटाएं git branch -D <ब्रांच-नाम> # वर्तमान ब्रांच का नाम बदलें git branch -m <नया-नाम> # विशिष्ट ब्रांच का नाम बदलें git branch -m <पुराना-नाम> <नया-नाम> ``` --- ## 🔀 मर्ज ### ब्रांच के बीच परिवर्तन मर्ज करना: ```bash # वर्तमान ब्रांच में अन्य ब्रांच मर्ज करें git merge <ब्रांच-नाम> # फास्ट-फॉरवर्ड के बिना मर्ज करें (मर्ज कमिट बनाएं) git merge --no-ff <ब्रांच-नाम> # केवल फास्ट-फॉरवर्ड होने पर मर्ज करें git merge --ff-only <ब्रांच-नाम> # चालू मर्ज को रद्द करें git merge --abort # संघर्ष समाधान के बाद मर्ज जारी रखें git merge --continue ``` --- ## 🌐 रिमोट रिपॉजिटरी ### रिमोट रिपॉजिटरी प्रबंधन: ```bash # रिमोट रिपॉजिटरी दिखाएं git remote # URL के साथ रिमोट रिपॉजिटरी दिखाएं git remote -v # रिमोट रिपॉजिटरी जोड़ें git remote add <नाम> # रिमोट रिपॉजिटरी URL बदलें git remote set-url <नाम> <नया-url> # रिमोट रिपॉजिटरी हटाएं git remote remove <नाम> # रिमोट रिपॉजिटरी में परिवर्तन पुश करें git push <रिमोट> <ब्रांच> # ब्रांच पुश करके ट्रैकिंग सेट करें git push -u <रिमोट> <ब्रांच> # सभी ब्रांच पुश करें git push --all # टैग पुश करें git push --tags # रिमोट रिपॉजिटरी से परिवर्तन डाउनलोड करें git pull <रिमोट> <ब्रांच> # मर्ज के बिना परिवर्तन डाउनलोड करें git fetch <रिमोट> # सभी रिमोट ब्रांच डाउनलोड करें git fetch --all ``` --- ## 📚 इतिहास और लॉग ### कमिट इतिहास का अन्वेषण: ```bash # कमिट इतिहास दिखाएं git log # प्रति कमिट एक लाइन में इतिहास दिखाएं git log --oneline # ग्राफ के साथ इतिहास दिखाएं git log --graph # विशिष्ट फ़ाइल का इतिहास दिखाएं git log <फ़ाइल> # कमिट आंकड़े दिखाएं git log --stat # प्रत्येक कमिट में परिवर्तन दिखाएं git log -p # अंतिम N कमिट दिखाएं git log -n <संख्या> # तारीखों के बीच कमिट दिखाएं git log --since="2023-01-01" --until="2023-12-31" # लेखक के अनुसार कमिट दिखाएं git log --author="लेखक का नाम" # कमिट संदेश में खोजें git log --grep="कीवर्ड" ``` --- ## 🔍 खोज ### इतिहास और सामग्री में खोज: ```bash # कमिट संदेशों में खोजें git log --grep="कीवर्ड" # कोड में परिवर्तनों को खोजें git log -S "कोड का हिस्सा" # कार्य फ़ाइलों में खोजें git grep "पैटर्न" # विशिष्ट कमिट में खोजें git grep "पैटर्न" <कमिट-हैश> # केस को अनदेखा करके खोजें git grep -i "पैटर्न" # पूरे शब्द खोजें git grep -w "शब्द" # लाइन नंबर दिखाएं git grep -n "पैटर्न" ``` --- ## 📁 स्थानांतरित/नाम बदलें ### फ़ाइल स्थानांतरित और नाम बदलना: ```bash # फ़ाइल का नाम बदलें git mv पुराना_नाम.txt नया_नाम.txt # फ़ाइल को फ़ोल्डर में स्थानांतरित करें git mv फ़ाइल.txt फ़ोल्डर/ # फ़ोल्डर का नाम बदलें git mv पुराना_फ़ोल्डर नया_फ़ोल्डर # git mv के बिना नाम बदलने की प्रक्रिया mv पुराना_नाम.txt नया_नाम.txt git add नया_नाम.txt git rm पुराना_नाम.txt # लॉग में नाम बदलाव खोजें git log --follow फ़ाइल.txt # स्थानांतरण ट्रैक करें git log --stat -M ``` --- ## 🏷️ टैग ### संस्करण टैग प्रबंधन: ```bash # सभी टैग दिखाएं git tag # हल्का टैग बनाएं git tag <टैग-नाम> # एनोटेटेड टैग बनाएं git tag -a <टैग-नाम> -m "टैग संदेश" # विशिष्ट कमिट पर टैग बनाएं git tag -a <टैग-नाम> <कमिट-हैश> # टैग की जानकारी दिखाएं git show <टैग-नाम> # स्थानीय टैग हटाएं git tag -d <टैग-नाम> # रिमोट टैग हटाएं git push --delete <रिमोट> <टैग-नाम> # विशिष्ट टैग पुश करें git push <रिमोट> <टैग-नाम> # सभी टैग पुश करें git push <रिमोट> --tags ``` --- ## ↩️ परिवर्तन पूर्ववत करना ### संशोधन वापस करना: ```bash # विशिष्ट फ़ाइल में परिवर्तन रद्द करें git checkout <फ़ाइल> # सभी गैर-कमिट किए गए परिवर्तन रद्द करें git checkout . # विशिष्ट संस्करण में फ़ाइल वापस करें git checkout <कमिट-हैश> <फ़ाइल> # स्टेजिंग क्षेत्र से फ़ाइल हटाएं git reset <फ़ाइल> # स्टेजिंग क्षेत्र से सभी फ़ाइलें हटाएं git reset # पिछले कमिट पर वापस जाएं (परिवर्तन रखें) git reset --soft HEAD~1 # पिछले कमिट पर वापस जाएं (परिवर्तन रद्द करें) git reset --hard HEAD~1 # विशिष्ट कमिट पर वापस जाएं git reset --hard <कमिट-हैश> # दूसरे कमिट को रद्द करने वाला नया कमिट बनाएं git revert <कमिट-हैश> # कई कमिट रद्द करें git revert <हैश-से>..<हैश-तक> ``` --- ## 📦 स्टैश ### अस्थायी रूप से काम सहेजना: ```bash # वर्तमान परिवर्तन स्टैश में सहेजें git stash # वर्णनात्मक संदेश के साथ सहेजें git stash save "वर्णनात्मक संदेश" # सभी स्टैश दिखाएं git stash list # अंतिम स्टैश लागू करें git stash apply # विशिष्ट स्टैश लागू करें git stash apply stash@{0} # अंतिम स्टैश लागू करके हटाएं git stash pop # विशिष्ट स्टैश हटाएं git stash drop stash@{0} # सभी स्टैश हटाएं git stash clear # स्टैश में परिवर्तन दिखाएं git stash show stash@{0} # स्टैश से ब्रांच बनाएं git stash branch <ब्रांच-नाम> stash@{0} ``` --- ## 🌊 Git Flow Git Flow एक ब्रांचिंग मॉडल है जो प्रोजेक्ट रिलीज के चारों ओर डिज़ाइन किए गए सख्त वर्कफ़्लो को परिभाषित करता है। ### मुख्य ब्रांच: - **master/main**: प्रोडक्शन कोड - **develop**: मुख्य डेवलपमेंट ब्रांच ### सहायक ब्रांच: - **feature**: नई सुविधाओं के लिए - **release**: नए संस्करणों की तैयारी के लिए - **hotfix**: प्रोडक्शन में तत्काल सुधार के लिए ### Git Flow कमांड: ```bash # git flow शुरू करें git flow init # नई सुविधा शुरू करें git flow feature start <सुविधा-नाम> # सुविधा समाप्त करें git flow feature finish <सुविधा-नाम> # सुविधा प्रकाशित करें git flow feature publish <सुविधा-नाम> # रिलीज शुरू करें git flow release start <संस्करण> # रिलीज समाप्त करें git flow release finish <संस्करण> # हॉटफिक्स शुरू करें git flow hotfix start <संस्करण> # हॉटफिक्स समाप्त करें git flow hotfix finish <संस्करण> ``` ### Git Flow के बिना वर्कफ़्लो: ![Git Flow Commands](../Img/git-flow-commands-without-flow.png) ```bash # सुविधा ब्रांच बनाएं git checkout develop git checkout -b feature/नई-सुविधा # सुविधा पर काम करें git add . git commit -m "नई सुविधा जोड़ें" # develop में सुविधा मर्ज करें git checkout develop git merge --no-ff feature/नई-सुविधा git branch -d feature/नई-सुविधा # रिलीज ब्रांच बनाएं git checkout develop git checkout -b release/1.0.0 # रिलीज पूरा करें git checkout master git merge --no-ff release/1.0.0 git tag -a 1.0.0 -m "संस्करण 1.0.0" git checkout develop git merge --no-ff release/1.0.0 git branch -d release/1.0.0 ``` --- ## 💡 उपयोगी सुझाव ### उपयोगी उपनाम: ```bash # उपयोगी उपनाम सेट करें git config --global alias.st status git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.unstage 'reset HEAD --' git config --global alias.last 'log -1 HEAD' git config --global alias.visual '!gitk' ``` ### .gitignore फ़ाइलें: ```bash # .gitignore फ़ाइल बनाएं echo "node_modules/" >> .gitignore echo "*.log" >> .gitignore echo ".env" >> .gitignore # पहले से ट्रैक की गई फ़ाइलों को अनदेखा करें git rm --cached <फ़ाइल> echo "<फ़ाइल>" >> .gitignore git add .gitignore git commit -m ".gitignore में फ़ाइल जोड़ें" ``` --- ## 🌍 अन्य भाषाएं यह Git चीट शीट निम्नलिखित भाषाओं में उपलब्ध है: - 🇺🇸 [English](../README.md) - 🇸🇦 [العربية](git-cheat-sheet-ar.md) - 🇧🇩 [বাংলা](git-cheat-sheet-bn.md) - 🇩🇪 [Deutsch](git-cheat-sheet-de.md) - 🇬🇷 [Ελληνικά](git-cheat-sheet-el.md) - 🇪🇸 [Español](git-cheat-sheet-es.md) - 🇮🇳 **हिन्दी** (वर्तमान) - 🇰🇷 [한국어](git-cheat-sheet-ko.md) - 🇵🇱 [Polski](git-cheat-sheet-pl.md) - 🇧🇷 [Português](git-cheat-sheet-pt_BR.md) - 🇹🇷 [Türkçe](git-cheat-sheet-tr.md) - 🇨🇳 [中文](git-cheat-sheet-zh.md) --- ## 🤝 योगदान हम योगदान का स्वागत करते हैं! इस परियोजना को बेहतर बनाने में मदद करने के लिए: 1. **मुद्दे रिपोर्ट करें**: गलतियां या सुधार के सुझाव साझा करें 2. **नई भाषाएं जोड़ें**: अनुवाद बनाएं या मौजूदा को बेहतर बनाएं 3. **सामग्री सुधारें**: नए कमांड, उदाहरण या व्याख्याएं जोड़ें 4. **प्रतिक्रिया दें**: आपके अनुभव और सुझाव साझा करें ### योगदान करने के लिए: - [GitHub पर इश्यू खोलें](https://github.com/arslanbilal/git-cheat-sheet/issues) - Pull request सबमिट करें - दस्तावेज़ीकरण में सुधार सुझाएं --- ## 📄 लाइसेंस यह परियोजना MIT लाइसेंस के तहत लाइसेंसीकृत है। अधिक विवरण के लिए [LICENSE](../LICENSE) फ़ाइल देखें। --- ## 📖 अतिरिक्त संसाधन - [Git आधिकारिक दस्तावेज़ीकरण](https://git-scm.com/doc) - [Atlassian Git ट्यूटोरियल](https://www.atlassian.com/git/tutorials) - [GitHub Git चीट शीट](https://education.github.com/git-cheat-sheet-education.pdf) - [इंटरैक्टिव Git ट्यूटोरियल](https://learngitbranching.js.org/) - [Pro Git पुस्तक (निःशुल्क)](https://git-scm.com/book/hi/v2) - [Git वर्कफ़्लो](https://www.atlassian.com/git/tutorials/comparing-workflows) ---
⭐ अगर यह चीट शीट उपयोगी है तो इसे स्टार करें!
Git के साथ हैप्पी कोडिंग! 🚀
================================================ FILE: other-sheets/git-cheat-sheet-ko.md ================================================ # Git Cheat Sheet 한국어 ![Git Logo](../Img/git-logo.png) 가장 많이 사용되는 Git 명령어들의 빠른 참조 가이드, 쉬운 사용을 위해 카테고리별로 정리되었습니다. ## 📖 소개 이 Git 치트 시트는 개발자들이 가장 자주 사용하는 Git 명령어들을 빠르게 찾아볼 수 있도록 구성되었습니다. 초보자부터 숙련된 개발자까지, 모든 수준의 사용자가 Git 워크플로우를 효율적으로 관리할 수 있도록 도와줍니다. --- ## 📖 이 가이드에 대해 이 포괄적인 Git 참조 가이드는 Git 워크플로우를 개선하고자 하는 모든 사람들을 위한 완전한 리소스입니다. Git 여정을 시작하는 초보자부터 숙련된 개발자까지, 이 가이드는 개발 과정을 가속화하기 위해 체계적이고 분류된 명령어를 제공합니다. ### 주요 특징: - **체계적인 카테고리**: 명령어들이 명확하고 논리적인 그룹으로 정리됨 - **실용적인 예제**: 실제 사용 사례와 함께 제공 - **초보자 친화적**: 명확한 설명과 팁 포함 - **빠른 참조**: 필수 명령어에 대한 빠른 접근 --- ## 📑 목차 - [📖 이 가이드에 대해](#이-가이드에-대해) - [🔧 초기 설정](#초기-설정) - [⚙️ 설정 파일](#설정-파일) - [📁 저장소 설정](#저장소-설정) - [📊 상태 명령어](#상태-명령어) - [📝 파일 관리](#파일-관리) - [💾 커밋](#커밋) - [🌿 브랜치](#브랜치) - [🔀 머지](#머지) - [🌐 원격 저장소](#원격-저장소) - [📚 히스토리와 로그](#히스토리와-로그) - [🔍 검색](#검색) - [📁 이동/이름 변경](#이동이름-변경) - [🏷️ 태그](#태그) - [↩️ 변경사항 되돌리기](#변경사항-되돌리기) - [📦 스태시](#스태시) - [🌊 Git Flow](#git-flow) - [💡 유용한 팁](#유용한-팁) - [🌍 다른 언어](#다른-언어) - [🤝 기여하기](#기여하기) - [📄 라이센스](#라이센스) - [📖 추가 리소스](#추가-리소스) --- ## 🔧 초기 설정 개인 정보로 Git을 설정하세요: ```bash # 사용자 이름 설정 git config --global user.name "당신의 이름" # 이메일 설정 git config --global user.email "email@example.com" # 현재 설정 보기 git config --list # 기본 에디터 설정 git config --global core.editor "nano" # 머지 도구 설정 git config --global merge.tool vimdiff ``` --- ## ⚙️ 설정 파일 Git은 여러 레벨에서 설정을 관리할 수 있습니다: ### 전역 설정 파일 ```bash # 전역 설정 파일 경로 ~/.gitconfig # 전역 설정 편집 git config --global --edit ``` ### 저장소별 설정 파일 ```bash # 저장소별 설정 파일 경로 .git/config # 저장소별 설정 편집 git config --edit ``` ### 시스템 전체 설정 ```bash # 시스템 설정 파일 (관리자 권한 필요) /etc/gitconfig # 시스템 설정 편집 git config --system --edit ``` ### 유용한 설정들 ```bash # 컬러 출력 활성화 git config --global color.ui true # 기본 브랜치명 설정 git config --global init.defaultBranch main # 줄 바꿈 처리 (macOS/Linux) git config --global core.autocrlf input # 줄 바꿈 처리 (Windows) git config --global core.autocrlf true ``` --- ## 📁 저장소 설정 ### 새 저장소 만들기: ```bash # 새 Git 저장소 생성 git init # 기존 저장소 클론 git clone <저장소-url> # 특정 디렉토리에 클론 git clone <저장소-url> <디렉토리-이름> ``` --- ## 📊 상태 명령어 ### 저장소 상태 확인: ```bash # 저장소의 현재 상태 보기 git status # 짧은 형식으로 상태 보기 git status -s # 추적되지 않는 파일을 무시하고 상태 보기 git status --ignored # 수정된 파일의 차이점 보기 git diff # 스테이징 영역의 차이점 보기 git diff --staged # 브랜치 간 차이점 보기 git diff <브랜치1> <브랜치2> ``` --- ## 📝 파일 관리 ### 파일 추가 및 제거: ```bash # 특정 파일을 스테이징 영역에 추가 git add <파일> # 모든 수정된 파일 추가 git add . # 특정 타입의 모든 파일 추가 git add *.txt # 대화형으로 추가 git add -i # 저장소와 작업 디렉토리에서 파일 제거 git rm <파일> # 저장소에서만 파일 제거 (디렉토리에는 유지) git rm --cached <파일> # 파일 이동/이름 변경 git mv <소스-파일> <대상-파일> ``` --- ## 💾 커밋 ### 저장소에 변경사항 저장: ```bash # 메시지와 함께 커밋 git commit -m "커밋 메시지" # 모든 수정된 파일을 추가하고 커밋 git commit -am "커밋 메시지" # 마지막 커밋 수정 git commit --amend # 빈 커밋 (CI/CD 트리거에 유용) git commit --allow-empty -m "CI 트리거" # 상세한 메시지로 커밋 (에디터 열림) git commit ``` --- ## 🌿 브랜치 ### 브랜치 작업: ```bash # 모든 브랜치 보기 git branch # 원격 브랜치 보기 git branch -r # 모든 브랜치 보기 (로컬과 원격) git branch -a # 새 브랜치 생성 git branch <브랜치-이름> # 브랜치로 전환 git checkout <브랜치-이름> # 새 브랜치 생성하고 전환 git checkout -b <브랜치-이름> # 특정 커밋에서 브랜치 생성 git checkout -b <브랜치-이름> <커밋-해시> # 브랜치 삭제 git branch -d <브랜치-이름> # 강제로 브랜치 삭제 git branch -D <브랜치-이름> # 현재 브랜치 이름 변경 git branch -m <새-이름> # 특정 브랜치 이름 변경 git branch -m <옛-이름> <새-이름> ``` --- ## 🔀 머지 ### 브랜치 간 변경사항 머지: ```bash # 현재 브랜치에 다른 브랜치 머지 git merge <브랜치-이름> # 패스트-포워드 없이 머지 (머지 커밋 생성) git merge --no-ff <브랜치-이름> # 패스트-포워드일 때만 머지 git merge --ff-only <브랜치-이름> # 진행 중인 머지 취소 git merge --abort # 충돌 해결 후 머지 계속 git merge --continue ``` --- ## 🌐 원격 저장소 ### 원격 저장소 관리: ```bash # 원격 저장소 보기 git remote # URL과 함께 원격 저장소 보기 git remote -v # 원격 저장소 추가 git remote add <이름> # 원격 저장소 URL 변경 git remote set-url <이름> <새-url> # 원격 저장소 제거 git remote remove <이름> # 원격 저장소에 변경사항 푸시 git push <원격> <브랜치> # 브랜치 푸시하고 추적 설정 git push -u <원격> <브랜치> # 모든 브랜치 푸시 git push --all # 태그 푸시 git push --tags # 원격 저장소에서 변경사항 다운로드 git pull <원격> <브랜치> # 머지 없이 변경사항 다운로드 git fetch <원격> # 모든 원격 브랜치 다운로드 git fetch --all ``` --- ## 📚 히스토리와 로그 ### 커밋 히스토리 탐색: ```bash # 커밋 히스토리 보기 git log # 커밋당 한 줄로 히스토리 보기 git log --oneline # 그래프와 함께 히스토리 보기 git log --graph # 특정 파일의 히스토리 보기 git log <파일> # 커밋 통계 보기 git log --stat # 각 커밋의 변경사항 보기 git log -p # 마지막 N개 커밋 보기 git log -n <숫자> # 날짜 범위 내 커밋 보기 git log --since="2023-01-01" --until="2023-12-31" # 작성자별 커밋 보기 git log --author="작성자 이름" # 커밋 메시지에서 검색 git log --grep="키워드" ``` --- ## 🔍 검색 ### 파일과 내용 검색: ```bash # 파일 내용에서 텍스트 검색 git grep "검색어" # 특정 커밋에서 검색 git grep "검색어" HEAD~3 # 대소문자 구분 없이 검색 git grep -i "검색어" # 정확한 단어만 검색 git grep -w "검색어" # 줄 번호와 함께 검색 git grep -n "검색어" # 매칭된 파일 이름만 표시 git grep -l "검색어" # 로그에서 특정 텍스트 변경사항 검색 git log -S "검색어" # 정규표현식으로 로그 검색 git log --grep="패턴" --perl-regexp # 파일명 검색 git ls-files | grep "패턴" ``` --- ## 🏷️ 태그 ### 버전 태그 관리: ```bash # 모든 태그 보기 git tag # 가벼운 태그 생성 git tag <태그-이름> # 주석이 달린 태그 생성 git tag -a <태그-이름> -m "태그 메시지" # 특정 커밋에 태그 생성 git tag -a <태그-이름> <커밋-해시> # 태그 정보 보기 git show <태그-이름> # 로컬 태그 삭제 git tag -d <태그-이름> # 원격 태그 삭제 git push --delete <원격> <태그-이름> # 특정 태그 푸시 git push <원격> <태그-이름> # 모든 태그 푸시 git push <원격> --tags ``` --- ## 📁 이동/이름 변경 ### 파일과 디렉토리 관리: ```bash # 파일 이동/이름 변경 git mv <기존-파일> <새-파일> # 디렉토리 이름 변경 git mv <기존-디렉토리> <새-디렉토리> # 여러 파일을 디렉토리로 이동 git mv file1.txt file2.txt directory/ # 대소문자만 변경 (대소문자 구분 파일시스템) git mv filename.txt temp.txt git mv temp.txt FileName.txt # 파일 이동 후 히스토리 확인 git log --follow <파일> # 이동된 파일 추적 git log --stat -M # 이름 변경 감지 임계값 설정 git log --follow -M90% <파일> ``` --- ## ↩️ 변경사항 되돌리기 ### 수정사항 되돌리기: ```bash # 특정 파일의 변경사항 취소 git checkout <파일> # 모든 커밋되지 않은 변경사항 취소 git checkout . # 특정 버전으로 파일 되돌리기 git checkout <커밋-해시> <파일> # 스테이징 영역에서 파일 제거 git reset <파일> # 스테이징 영역에서 모든 파일 제거 git reset # 이전 커밋으로 돌아가기 (변경사항 유지) git reset --soft HEAD~1 # 이전 커밋으로 돌아가기 (변경사항 취소) git reset --hard HEAD~1 # 특정 커밋으로 돌아가기 git reset --hard <커밋-해시> # 다른 커밋을 취소하는 새 커밋 생성 git revert <커밋-해시> # 여러 커밋 되돌리기 git revert <해시-시작>..<해시-끝> ``` --- ## 📦 스태시 ### 임시로 작업 저장: ```bash # 현재 변경사항을 스태시에 저장 git stash # 설명적 메시지와 함께 저장 git stash save "설명적 메시지" # 모든 스태시 보기 git stash list # 마지막 스태시 적용 git stash apply # 특정 스태시 적용 git stash apply stash@{0} # 마지막 스태시 적용하고 삭제 git stash pop # 특정 스태시 삭제 git stash drop stash@{0} # 모든 스태시 삭제 git stash clear # 스태시의 변경사항 보기 git stash show stash@{0} # 스태시에서 브랜치 생성 git stash branch <브랜치-이름> stash@{0} ``` --- ## 🌊 Git Flow Git Flow는 프로젝트 릴리스를 중심으로 설계된 엄격한 워크플로우를 정의하는 브랜칭 모델입니다. ### 주요 브랜치: - **master/main**: 프로덕션 코드 - **develop**: 주요 개발 브랜치 ### 지원 브랜치: - **feature**: 새로운 기능을 위한 - **release**: 새 버전 준비를 위한 - **hotfix**: 프로덕션 긴급 수정을 위한 ### Git Flow 명령어: ```bash # git flow 초기화 git flow init # 새 기능 시작 git flow feature start <기능-이름> # 기능 완료 git flow feature finish <기능-이름> # 기능 발행 git flow feature publish <기능-이름> # 릴리스 시작 git flow release start <버전> # 릴리스 완료 git flow release finish <버전> # 핫픽스 시작 git flow hotfix start <버전> # 핫픽스 완료 git flow hotfix finish <버전> ``` ### Git Flow 없는 워크플로우: ![Git Flow Commands](../Img/git-flow-commands-without-flow.png) ```bash # 기능 브랜치 생성 git checkout develop git checkout -b feature/새-기능 # 기능 작업 git add . git commit -m "새 기능 추가" # develop에 기능 머지 git checkout develop git merge --no-ff feature/새-기능 git branch -d feature/새-기능 # 릴리스 브랜치 생성 git checkout develop git checkout -b release/1.0.0 # 릴리스 완료 git checkout master git merge --no-ff release/1.0.0 git tag -a 1.0.0 -m "버전 1.0.0" git checkout develop git merge --no-ff release/1.0.0 git branch -d release/1.0.0 ``` --- ## 💡 유용한 팁 ### 유용한 별칭: ```bash # 유용한 별칭 설정 git config --global alias.st status git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.unstage 'reset HEAD --' git config --global alias.last 'log -1 HEAD' git config --global alias.visual '!gitk' ``` ### .gitignore 파일: ```bash # .gitignore 파일 생성 echo "node_modules/" >> .gitignore echo "*.log" >> .gitignore echo ".env" >> .gitignore # 이미 추적된 파일 무시하기 git rm --cached <파일> echo "<파일>" >> .gitignore git add .gitignore git commit -m ".gitignore에 파일 추가" ``` --- ## 📖 추가 리소스 ### 공식 문서 및 가이드 - [Git 공식 문서](https://git-scm.com/doc) - [Pro Git 책 (무료)](https://git-scm.com/book) - [Git 참조 매뉴얼](https://git-scm.com/docs) - [Git 튜토리얼](https://git-scm.com/docs/gittutorial) ### 온라인 학습 자료 - [GitHub Git 핸드북](https://guides.github.com/introduction/git-handbook/) - [Atlassian Git 튜토리얼](https://www.atlassian.com/git/tutorials) - [Learn Git Branching (대화형)](https://learngitbranching.js.org/) - [Git Immersion](http://gitimmersion.com/) ### GUI 도구 - [GitHub Desktop](https://desktop.github.com/) - [GitKraken](https://www.gitkraken.com/) - [SourceTree](https://www.sourcetreeapp.com/) - [Tower](https://www.git-tower.com/) ### 고급 주제 - [Git Hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) - [Git Workflows](https://www.atlassian.com/git/tutorials/comparing-workflows) - [Git 내부 구조](https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain) --- ## 🌍 다른 언어 이 Git Cheat Sheet는 다음 언어로 제공됩니다: - 🇺🇸 [English](../README.md) - 🇸🇦 [العربية](git-cheat-sheet-ar.md) - 🇧🇩 [বাংলা](git-cheat-sheet-bn.md) - 🇩🇪 [Deutsch](git-cheat-sheet-de.md) - 🇬🇷 [Ελληνικά](git-cheat-sheet-el.md) - 🇪🇸 [Español](git-cheat-sheet-es.md) - 🇮🇳 [हिन्दी](git-cheat-sheet-hi.md) - 🇰🇷 **한국어** (현재) - 🇵🇱 [Polski](git-cheat-sheet-pl.md) - 🇧🇷 [Português](git-cheat-sheet-pt_BR.md) - 🇹🇷 [Türkçe](git-cheat-sheet-tr.md) - 🇨🇳 [中文](git-cheat-sheet-zh.md) --- ## 🤝 기여하기 기여를 환영합니다! 이 프로젝트를 개선하는 데 도움을 주세요: 1. **문제 보고**: 오류나 개선 제안을 공유하세요 2. **새 언어 추가**: 번역을 만들거나 기존 것을 개선하세요 3. **내용 개선**: 새로운 명령어, 예제 또는 설명을 추가하세요 4. **피드백 제공**: 경험과 제안을 공유하세요 ### 기여 방법: - [GitHub에서 이슈 열기](https://github.com/arslanbilal/git-cheat-sheet/issues) - Pull request 제출 - 문서 개선 제안 --- ## 📄 라이센스 이 프로젝트는 MIT 라이센스 하에 라이센스가 부여됩니다. 자세한 내용은 [LICENSE](../LICENSE) 파일을 참조하세요. ---
⭐ 이 치트 시트가 유용하다면 별표를 주세요!
Git과 함께 즐거운 코딩 하세요! 🚀
================================================ FILE: other-sheets/git-cheat-sheet-pl.md ================================================ # Git Cheat Sheet Polski ![Git Logo](../Img/git-logo.png) Szybki przewodnik referencyjny dla najczęściej używanych poleceń Git, zorganizowany w kategorie dla łatwego użycia. ## 📖 O tym przewodniku Ten kompleksowy przewodnik referencyjny Git jest kompletnym zasobem dla każdego, kto chce usprawnić swój przepływ pracy z Git. Od początkujących, którzy rozpoczynają swoją przygodę z Git, po doświadczonych programistów, ten przewodnik zapewnia systematycznie zorganizowane polecenia kategoryzowane w celu przyspieszenia procesu rozwoju. ### Kluczowe cechy: - **Systematyczne kategorie**: Polecenia zorganizowane w jasne, logiczne grupy - **Praktyczne przykłady**: Zawiera rzeczywiste przypadki użycia - **Przyjazne dla początkujących**: Jasne wyjaśnienia i wskazówki - **Szybka referencja**: Błyskawiczny dostęp do niezbędnych poleceń --- ## 📑 Spis treści - [📖 O tym przewodniku](#o-tym-przewodniku) - [🔧 Konfiguracja początkowa](#konfiguracja-początkowa) - [⚙️ Pliki konfiguracyjne](#pliki-konfiguracyjne) - [📁 Konfiguracja repozytorium](#konfiguracja-repozytorium) - [📊 Polecenia statusu](#polecenia-statusu) - [📝 Zarządzanie plikami](#zarządzanie-plikami) - [💾 Commity](#commity) - [🌿 Gałęzie (Branches)](#gałęzie-branches) - [🔀 Scalanie (Merge)](#scalanie-merge) - [🌐 Zdalne repozytoria](#zdalne-repozytoria) - [📚 Historia i logi](#historia-i-logi) - [🔍 Wyszukiwanie](#wyszukiwanie) - [📁 Przenoszenie/Zmiana nazwy](#przenoszeniizmiana-nazwy) - [🏷️ Tagi](#tagi) - [↩️ Cofanie zmian](#cofanie-zmian) - [📦 Schowek (Stash)](#schowek-stash) - [🌊 Git Flow](#git-flow) - [💡 Przydatne wskazówki](#przydatne-wskazówki) - [📚 Dodatkowe zasoby](#dodatkowe-zasoby) - [🌍 Inne języki](#inne-języki) - [🤝 Współpraca](#współpraca) - [📄 Licencja](#licencja) --- ## 🔧 Konfiguracja początkowa Skonfiguruj Git ze swoimi danymi osobowymi: ```bash # Ustawienie nazwy użytkownika git config --global user.name "Twoje Imię" # Ustawienie adresu email git config --global user.email "email@example.com" # Wyświetlenie bieżącej konfiguracji git config --list # Ustawienie domyślnego edytora git config --global core.editor "nano" # Ustawienie narzędzia do scalania git config --global merge.tool vimdiff ``` --- ## ⚙️ Pliki konfiguracyjne Git zarządza konfiguracją na kilku poziomach: ### Plik konfiguracji globalnej ```bash # Ścieżka do globalnego pliku konfiguracji ~/.gitconfig # Edycja globalnej konfiguracji git config --global --edit ``` ### Plik konfiguracji repozytorium ```bash # Ścieżka do pliku konfiguracji repozytorium .git/config # Edycja konfiguracji repozytorium git config --edit ``` ### Konfiguracja systemowa ```bash # Plik konfiguracji systemowej (wymaga uprawnień administratora) /etc/gitconfig # Edycja konfiguracji systemowej git config --system --edit ``` ### Przydatne ustawienia konfiguracji ```bash # Włączenie kolorowego wyjścia git config --global color.ui true # Ustawienie domyślnej nazwy gałęzi git config --global init.defaultBranch main # Obsługa końców linii (macOS/Linux) git config --global core.autocrlf input # Obsługa końców linii (Windows) git config --global core.autocrlf true ``` --- ## 📁 Konfiguracja repozytorium ### Tworzenie nowego repozytorium: ```bash # Utworzenie nowego repozytorium Git git init # Klonowanie istniejącego repozytorium git clone # Klonowanie do określonego katalogu git clone ``` --- ## 📊 Polecenia statusu ### Sprawdzanie statusu repozytorium: ```bash # Wyświetlenie bieżącego statusu repozytorium git status # Wyświetlenie statusu w krótkim formacie git status -s # Wyświetlenie statusu ignorując nieśledzone pliki git status --ignored # Wyświetlenie różnic w zmodyfikowanych plikach git diff # Wyświetlenie różnic w obszarze staging git diff --staged # Wyświetlenie różnic między gałęziami git diff ``` --- ## 📝 Zarządzanie plikami ### Dodawanie i usuwanie plików: ```bash # Dodanie określonego pliku do obszaru staging git add # Dodanie wszystkich zmodyfikowanych plików git add . # Dodanie wszystkich plików określonego typu git add *.txt # Interaktywne dodawanie git add -i # Usunięcie pliku z repozytorium i katalogu roboczego git rm # Usunięcie pliku tylko z repozytorium (zachowanie w katalogu) git rm --cached # Przenoszenie/zmiana nazwy pliku git mv ``` --- ## 💾 Commity ### Zapisywanie zmian w repozytorium: ```bash # Commit z wiadomością git commit -m "Wiadomość commita" # Commit dodając wszystkie zmodyfikowane pliki git commit -am "Wiadomość commita" # Modyfikacja ostatniego commita git commit --amend # Pusty commit (przydatny dla wyzwalaczy CI/CD) git commit --allow-empty -m "Wyzwalacz CI" # Commit ze szczegółową wiadomością (otwiera edytor) git commit ``` --- ## 🌿 Gałęzie (Branches) ### Praca z gałęziami: ```bash # Wyświetlenie wszystkich gałęzi git branch # Wyświetlenie zdalnych gałęzi git branch -r # Wyświetlenie wszystkich gałęzi (lokalnych i zdalnych) git branch -a # Utworzenie nowej gałęzi git branch # Przełączenie na gałąź git checkout # Utworzenie i przełączenie na nową gałąź git checkout -b # Utworzenie gałęzi z określonego commita git checkout -b # Usunięcie gałęzi git branch -d # Wymuszone usunięcie gałęzi git branch -D # Zmiana nazwy bieżącej gałęzi git branch -m # Zmiana nazwy określonej gałęzi git branch -m ``` --- ## 🔀 Scalanie (Merge) ### Scalanie zmian między gałęziami: ```bash # Scalenie gałęzi z bieżącą gałęzią git merge # Scalenie bez fast-forward (utworzenie commita scalenia) git merge --no-ff # Scalenie tylko jeśli jest fast-forward git merge --ff-only # Anulowanie trwającego scalenia git merge --abort # Kontynuacja scalenia po rozwiązaniu konfliktów git merge --continue ``` --- ## 🌐 Zdalne repozytoria ### Zarządzanie zdalnymi repozytoriami: ```bash # Wyświetlenie zdalnych repozytoriów git remote # Wyświetlenie zdalnych repozytoriów z URL-ami git remote -v # Dodanie zdalnego repozytorium git remote add # Zmiana URL zdalnego repozytorium git remote set-url # Usunięcie zdalnego repozytorium git remote remove # Wysłanie zmian do zdalnego repozytorium git push # Wysłanie gałęzi i ustawienie śledzenia git push -u # Wysłanie wszystkich gałęzi git push --all # Wysłanie tagów git push --tags # Pobranie zmian ze zdalnego repozytorium git pull # Pobranie zmian bez scalania git fetch # Pobranie wszystkich zdalnych gałęzi git fetch --all ``` --- ## 📚 Historia i logi ### Eksploracja historii commitów: ```bash # Wyświetlenie historii commitów git log # Wyświetlenie historii w jednej linii na commit git log --oneline # Wyświetlenie historii z wykresem git log --graph # Wyświetlenie historii określonego pliku git log # Wyświetlenie statystyk commitów git log --stat # Wyświetlenie zmian w każdym commicie git log -p # Wyświetlenie ostatnich N commitów git log -n # Wyświetlenie commitów między datami git log --since="2023-01-01" --until="2023-12-31" # Wyświetlenie commitów według autora git log --author="Imię Autora" # Wyszukiwanie w wiadomościach commitów git log --grep="słowo kluczowe" ``` --- ## 🔍 Wyszukiwanie ### Wyszukiwanie w zawartości i historii: ```bash # Wyszukiwanie tekstu w plikach śledzonych git grep "tekst do wyszukania" # Wyszukiwanie z ignorowaniem wielkości liter git grep -i "tekst" # Wyszukiwanie całych słów git grep -w "słowo" # Wyświetlenie numerów linii git grep -n "tekst" # Wyświetlenie tylko nazw plików git grep -l "tekst" # Wyszukiwanie w określonych plikach git grep "tekst" -- "*.js" # Wyszukiwanie w historii commitów git log -S "tekst" --source --all # Wyszukiwanie dodań/usunięć w historii git log -G "regex_pattern" --patch # Wyszukiwanie według nazwy pliku git log --all --full-history -- "**/nazwa_pliku.*" # Wyszukiwanie w określonym commicie git grep "tekst" ``` --- ## 🏷️ Tagi ### Zarządzanie tagami wersji: ```bash # Wyświetlenie wszystkich tagów git tag # Utworzenie lekkiego tagu git tag # Utworzenie adnotowanego tagu git tag -a -m "Wiadomość tagu" # Utworzenie tagu na określonym commicie git tag -a # Wyświetlenie informacji o tagu git show # Usunięcie lokalnego tagu git tag -d # Usunięcie zdalnego tagu git push --delete # Wysłanie określonego tagu git push # Wysłanie wszystkich tagów git push --tags ``` --- ## 📁 Przenoszenie/Zmiana nazwy ### Zarządzanie plikami i katalogami: ```bash # Przenoszenie/zmiana nazwy pliku git mv # Zmiana nazwy katalogu git mv # Przenoszenie wielu plików do katalogu git mv plik1.txt plik2.txt katalog/ # Zmiana wielkości liter (systemy plików wrażliwe na wielkość liter) git mv nazwapliku.txt temp.txt git mv temp.txt NazwaPliku.txt # Śledzenie historii przeniesionego pliku git log --follow # Śledzenie przeniesionych plików git log --stat -M # Ustawienie progu wykrywania zmian nazwy git log --follow -M90% ``` --- ## ↩️ Cofanie zmian ### Przywracanie modyfikacji: ```bash # Anulowanie zmian w określonym pliku git checkout # Anulowanie wszystkich niezacommitowanych zmian git checkout . # Przywrócenie pliku do określonej wersji git checkout # Usunięcie pliku z obszaru staging git reset # Usunięcie wszystkich plików z obszaru staging git reset # Powrót do poprzedniego commita (zachowanie zmian) git reset --soft HEAD~1 # Powrót do poprzedniego commita (anulowanie zmian) git reset --hard HEAD~1 # Powrót do określonego commita git reset --hard # Utworzenie commita anulującego inny commit git revert # Anulowanie wielu commitów git revert .. ``` --- ## 📦 Schowek (Stash) ### Tymczasowe zapisywanie pracy: ```bash # Zapisanie bieżących zmian w schowku git stash # Zapisanie z opisową wiadomością git stash save "Opisowa wiadomość" # Wyświetlenie wszystkich schowków git stash list # Zastosowanie ostatniego schowka git stash apply # Zastosowanie określonego schowka git stash apply stash@{0} # Zastosowanie i usunięcie ostatniego schowka git stash pop # Usunięcie określonego schowka git stash drop stash@{0} # Usunięcie wszystkich schowków git stash clear # Wyświetlenie zmian w schowku git stash show stash@{0} # Utworzenie gałęzi ze schowka git stash branch stash@{0} ``` --- ## 🌊 Git Flow Git Flow to model rozgałęziania, który definiuje ścisły przepływ pracy zaprojektowany wokół wydania projektu. ### Główne gałęzie: - **master/main**: Kod produkcyjny - **develop**: Główna gałąź rozwoju ### Gałęzie wsparcia: - **feature**: Dla nowych funkcji - **release**: Dla przygotowania nowych wersji - **hotfix**: Dla pilnych poprawek w produkcji ### Polecenia Git Flow: ```bash # Inicjalizacja git flow git flow init # Rozpoczęcie nowej funkcji git flow feature start # Zakończenie funkcji git flow feature finish # Publikowanie funkcji git flow feature publish # Rozpoczęcie wydania git flow release start # Zakończenie wydania git flow release finish # Rozpoczęcie hotfixa git flow hotfix start # Zakończenie hotfixa git flow hotfix finish ``` ### Przepływ pracy bez Git Flow: ![Git Flow Commands](../Img/git-flow-commands-without-flow.png) ```bash # Utworzenie gałęzi funkcji git checkout develop git checkout -b feature/nowa-funkcja # Praca nad funkcją git add . git commit -m "Dodanie nowej funkcji" # Scalenie funkcji z develop git checkout develop git merge --no-ff feature/nowa-funkcja git branch -d feature/nowa-funkcja # Utworzenie gałęzi wydania git checkout develop git checkout -b release/1.0.0 # Zakończenie wydania git checkout master git merge --no-ff release/1.0.0 git tag -a 1.0.0 -m "Wersja 1.0.0" git checkout develop git merge --no-ff release/1.0.0 git branch -d release/1.0.0 ``` --- ## 💡 Przydatne wskazówki ### Przydatne aliasy: ```bash # Ustawienie przydatnych aliasów git config --global alias.st status git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.unstage 'reset HEAD --' git config --global alias.last 'log -1 HEAD' git config --global alias.visual '!gitk' ``` ### Pliki .gitignore: ```bash # Utworzenie pliku .gitignore echo "node_modules/" >> .gitignore echo "*.log" >> .gitignore echo ".env" >> .gitignore # Ignorowanie już śledzonych plików git rm --cached echo "" >> .gitignore git add .gitignore git commit -m "Dodanie pliku do .gitignore" ``` --- ## 📚 Dodatkowe zasoby ### Oficjalna dokumentacja i przewodniki - [Oficjalna dokumentacja Git](https://git-scm.com/doc) - [Książka Pro Git (darmowa)](https://git-scm.com/book) - [Manual referencyjny Git](https://git-scm.com/docs) - [Tutorial Git](https://git-scm.com/docs/gittutorial) ### Materiały do nauki online - [GitHub Git Handbook](https://guides.github.com/introduction/git-handbook/) - [Atlassian Git Tutorials](https://www.atlassian.com/git/tutorials) - [Learn Git Branching (interaktywny)](https://learngitbranching.js.org/) - [Git Immersion](http://gitimmersion.com/) ### Narzędzia GUI - [GitHub Desktop](https://desktop.github.com/) - [GitKraken](https://www.gitkraken.com/) - [SourceTree](https://www.sourcetreeapp.com/) - [Tower](https://www.git-tower.com/) ### Zaawansowane tematy - [Git Hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) - [Przepływy pracy Git](https://www.atlassian.com/git/tutorials/comparing-workflows) - [Wewnętrzne mechanizmy Git](https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain) --- ## 🌍 Inne języki Ten Git Cheat Sheet jest dostępny w następujących językach: - 🇺🇸 [English](../README.md) - 🇸🇦 [العربية](git-cheat-sheet-ar.md) - 🇧🇩 [বাংলা](git-cheat-sheet-bn.md) - 🇩🇪 [Deutsch](git-cheat-sheet-de.md) - 🇬🇷 [Ελληνικά](git-cheat-sheet-el.md) - 🇪🇸 [Español](git-cheat-sheet-es.md) - 🇮🇳 [हिन्दी](git-cheat-sheet-hi.md) - 🇰🇷 [한국어](git-cheat-sheet-ko.md) - 🇵🇱 **Polski** (bieżący) - 🇧🇷 [Português](git-cheat-sheet-pt_BR.md) - 🇹🇷 [Türkçe](git-cheat-sheet-tr.md) - 🇨🇳 [中文](git-cheat-sheet-zh.md) --- ## 🤝 Współpraca Zachęcamy do współpracy! Aby pomóc w ulepszaniu tego projektu: 1. **Zgłaszaj problemy**: Dziel się błędami lub sugestiami ulepszeń 2. **Dodawaj nowe języki**: Twórz tłumaczenia lub ulepszaj istniejące 3. **Ulepszaj treść**: Dodawaj nowe polecenia, przykłady lub wyjaśnienia 4. **Przekazuj opinie**: Dziel się swoimi doświadczeniami i sugestiami ### Jak współpracować: - [Otwórz issue na GitHub](https://github.com/arslanbilal/git-cheat-sheet/issues) - Wyślij pull request - Zaproponuj ulepszenia dokumentacji --- ## 📄 Licencja Ten projekt jest licencjonowany na licencji MIT. Zobacz plik [LICENSE](../LICENSE) po więcej szczegółów. ---
⭐ Jeśli ten cheat sheet jest pomocny, zostaw gwiazdkę!
Miłego kodowania z Git! 🚀
================================================ FILE: other-sheets/git-cheat-sheet-pt_BR.md ================================================ # Git Cheat Sheet Português (Brasil) ![Git Logo](../Img/git-logo.png) Esta folha de dicas abrangente do Git ajuda você a dominar comandos Git sem memorizar tudo. Seja você iniciante ou desenvolvedor experiente, este guia fornece referência rápida para operações essenciais do Git. **Contribuições são bem-vindas!** Sinta-se livre para: - Corrigir erros gramaticais - Adicionar novos comandos - Traduzir para seu idioma - Melhorar explicações --- ## 📋 Índice - [🔧 Configuração](#-configuração) - [⚙️ Arquivos de Configuração](#️-arquivos-de-configuração) - [🆕 Criar Repositório](#-criar-repositório) - [📝 Mudanças Locais](#-mudanças-locais) - [🔍 Buscar](#-buscar) - [📖 Histórico de Commits](#-histórico-de-commits) - [📁 Mover / Renomear](#-mover--renomear) - [🌿 Branches e Tags](#-branches-e-tags) - [🔄 Atualizar e Publicar](#-atualizar-e-publicar) - [🔀 Merge e Rebase](#-merge-e-rebase) - [↩️ Desfazer](#️-desfazer) - [🌊 Git Flow](#-git-flow) - [📚 Recursos Adicionais](#-recursos-adicionais) - [🌍 Outros Idiomas](#-outros-idiomas) - [🤝 Contribuir](#-contribuir) - [📄 Licença](#-licença) --- ## 🔧 Configuração ### Ver Configuração **Mostrar configuração atual:** ```bash git config --list ``` **Mostrar configuração do repositório:** ```bash git config --local --list ``` **Mostrar configuração global:** ```bash git config --global --list ``` **Mostrar configuração do sistema:** ```bash git config --system --list ``` ### Configuração do Usuário **Definir seu nome para histórico de versões:** ```bash git config --global user.name "[nome sobrenome]" ``` **Definir seu endereço de email:** ```bash git config --global user.email "[email-válido]" ``` ### Configurações de Exibição e Editor **Habilitar coloração automática da linha de comando:** ```bash git config --global color.ui auto ``` **Definir editor global para commits:** ```bash git config --global core.editor vi ``` --- ## ⚙️ Arquivos de Configuração | Escopo | Localização | Flag do Comando | |--------|-------------|-----------------| | **Repositório** | `/.git/config` | `--local` | | **Usuário** | `~/.gitconfig` | `--global` | | **Sistema** | `/etc/gitconfig` | `--system` | --- ## 🆕 Criar Repositório ### Clonar Repositório Existente **Via SSH:** ```bash git clone ssh://usuario@dominio.com/repo.git ``` **Via HTTPS:** ```bash git clone https://dominio.com/usuario/repo.git ``` ### Inicializar Novo Repositório **Criar repositório no diretório atual:** ```bash git init ``` **Criar repositório em diretório específico:** ```bash git init ``` --- ## 📝 Mudanças Locais ### Verificar Status e Diferenças **Ver status do diretório de trabalho:** ```bash git status ``` **Mostrar mudanças em arquivos rastreados:** ```bash git diff ``` **Mostrar mudanças em arquivo específico:** ```bash git diff ``` ### Preparar Mudanças **Adicionar todas as mudanças atuais:** ```bash git add . ``` **Adicionar arquivos específicos:** ```bash git add ``` **Adicionar interativamente partes de um arquivo:** ```bash git add -p ``` ### Fazer Commit das Mudanças **Fazer commit de todas as mudanças de arquivos rastreados:** ```bash git commit -a ``` **Fazer commit das mudanças preparadas:** ```bash git commit ``` **Fazer commit com mensagem:** ```bash git commit -m 'mensagem aqui' ``` **Pular preparação e fazer commit com mensagem:** ```bash git commit -am 'mensagem aqui' ``` **Fazer commit com data específica:** ```bash git commit --date="`date --date='n day ago'`" -am "" ``` ### Modificar Último Commit > ⚠️ **Aviso:** Não modifique commits publicados! **Emendar último commit:** ```bash git commit -a --amend ``` **Emendar sem alterar mensagem do commit:** ```bash git commit --amend --no-edit ``` **Alterar data do committer:** ```bash GIT_COMMITTER_DATE="data" git commit --amend ``` **Alterar data do autor:** ```bash git commit --amend --date="data" ``` ### Guardar Mudanças Temporariamente **Salvar mudanças atuais temporariamente:** ```bash git stash ``` **Aplicar últimas mudanças salvas:** ```bash git stash apply ``` **Aplicar stash específico:** ```bash git stash apply stash@{numero_stash} ``` > Use `git stash list` para ver stashes disponíveis **Remover último stash:** ```bash git stash drop ``` **Mover mudanças não commitadas para outro branch:** ```bash git stash git checkout branch2 git stash pop ``` --- ## 🔍 Buscar ### Busca de Texto **Buscar texto em todos os arquivos:** ```bash git grep "Olá" ``` **Buscar em versão específica:** ```bash git grep "Olá" v2.5 ``` ### Busca de Commits **Encontrar commits que introduziram palavra-chave específica:** ```bash git log -S 'palavra-chave' ``` **Buscar com expressão regular:** ```bash git log -S 'palavra-chave' --pickaxe-regex ``` --- ## 📖 Histórico de Commits ### Histórico Básico **Mostrar todos os commits (detalhado):** ```bash git log ``` **Mostrar commits (uma linha cada):** ```bash git log --oneline ``` **Mostrar commits por autor específico:** ```bash git log --author="nomeusuario" ``` **Mostrar mudanças para arquivo específico:** ```bash git log -p ``` ### Histórico Avançado **Comparar branches:** ```bash git log --oneline .. --left-right ``` **Mostrar quem mudou o que e quando:** ```bash git blame ``` ### Logs de Referência **Mostrar log de referência:** ```bash git reflog show ``` **Deletar log de referência:** ```bash git reflog delete ``` --- ## 📁 Mover / Renomear **Renomear um arquivo:** ```bash git mv Index.txt Index.html ``` --- ## 🌿 Branches e Tags ### Listar Branches **Listar branches locais:** ```bash git branch ``` **Listar todos os branches (local + remoto):** ```bash git branch -a ``` **Listar branches remotos:** ```bash git branch -r ``` **Listar branches mesclados:** ```bash git branch --merged ``` ### Trocar e Criar Branches **Trocar para branch existente:** ```bash git checkout ``` **Criar e trocar para novo branch:** ```bash git checkout -b ``` **Trocar para branch anterior:** ```bash git checkout - ``` **Criar branch a partir de branch existente:** ```bash git checkout -b ``` **Criar branch a partir de commit específico:** ```bash git checkout -b ``` **Criar branch sem trocar:** ```bash git branch ``` **Criar branch de rastreamento:** ```bash git branch --track ``` ### Operações de Branch **Obter arquivo único de branch diferente:** ```bash git checkout -- ``` **Aplicar commit específico de outro branch:** ```bash git cherry-pick ``` **Renomear branch atual:** ```bash git branch -m ``` **Deletar branch local:** ```bash git branch -d ``` **Forçar deleção de branch local:** ```bash git branch -D ``` > ⚠️ **Aviso:** Você perderá mudanças não mescladas! ### Tags **Criar tag no HEAD:** ```bash git tag ``` **Criar tag anotada:** ```bash git tag -a ``` **Criar tag com mensagem:** ```bash git tag -am 'mensagem aqui' ``` **Listar todas as tags:** ```bash git tag ``` **Listar tags com mensagens:** ```bash git tag -n ``` --- ## 🔄 Atualizar e Publicar ### Gerenciamento de Remotos **Listar remotos configurados:** ```bash git remote -v ``` **Mostrar informações do remoto:** ```bash git remote show ``` **Adicionar novo remoto:** ```bash git remote add ``` **Renomear remoto:** ```bash git remote rename ``` **Remover remoto:** ```bash git remote rm ``` > ℹ️ **Nota:** Isso apenas remove a referência remota localmente, não o repositório remoto em si. ### Fetch e Pull **Baixar mudanças sem mesclar:** ```bash git fetch ``` **Baixar e mesclar mudanças:** ```bash git pull ``` **Obter mudanças do branch principal:** ```bash git pull origin master ``` **Pull com rebase:** ```bash git pull --rebase ``` ### Push e Publicar **Publicar mudanças locais:** ```bash git push ``` **Deletar branch remoto:** ```bash # Git v1.7.0+ git push --delete # Git v1.5.0+ git push : ``` **Publicar tags:** ```bash git push --tags ``` --- ## 🔀 Merge e Rebase ### Operações de Merge **Mesclar branch no HEAD atual:** ```bash git merge ``` **Configurar ferramenta de merge globalmente:** ```bash git config --global merge.tool meld ``` **Usar ferramenta de merge configurada:** ```bash git mergetool ``` ### Operações de Rebase > ⚠️ **Aviso:** Não faça rebase de commits publicados! **Fazer rebase do HEAD atual sobre branch:** ```bash git rebase ``` **Abortar rebase:** ```bash git rebase --abort ``` **Continuar rebase após resolver conflitos:** ```bash git rebase --continue ``` ### Resolução de Conflitos **Marcar arquivo como resolvido:** ```bash git add ``` **Remover arquivo resolvido:** ```bash git rm ``` ### Squashing Commits **Rebase interativo para squashing:** ```bash git rebase -i ``` **Exemplo de configuração para squash:** ``` # Antes pick pick pick # Depois (squash commit_id2 e commit_id3 em commit_id) pick squash squash ``` --- ## ↩️ Desfazer ### Descartar Mudanças **Descartar todas as mudanças locais:** ```bash git reset --hard HEAD ``` **Tirar todos os arquivos da área de staging:** ```bash git reset HEAD ``` **Descartar mudanças em arquivo específico:** ```bash git checkout HEAD ``` ### Operações de Reset **Reset para commit anterior (descartar todas as mudanças):** ```bash git reset --hard ``` **Reset para estado do branch remoto:** ```bash git reset --hard # Exemplo: git reset --hard upstream/master ``` **Reset preservando mudanças como não preparadas:** ```bash git reset ``` **Reset preservando mudanças locais não commitadas:** ```bash git reset --keep ``` ### Reverter Commits **Reverter commit (criar novo commit com mudanças opostas):** ```bash git revert ``` ### Limpar Arquivos Ignorados **Remover arquivos acidentalmente commitados que deveriam ser ignorados:** ```bash git rm -r --cached . git add . git commit -m "remover arquivos ignorados" ``` --- ## 🌊 Git Flow **Git-flow melhorado:** [git-flow-avh](https://github.com/petervanderdoes/gitflow-avh) ### 📋 Índice - [🔧 Configuração](#configuração-1) - [🚀 Começando](#começando) - [✨ Features](#features) - [🎁 Fazer um Release](#fazer-um-release) - [🔥 Hotfixes](#hotfixes) - [📊 Resumo de Comandos](#resumo-de-comandos) --- ### 🔧 Configuração {#configuração-1} > **Pré-requisito:** Instalação do Git funcionando é necessária. Git-flow funciona no macOS, Linux e Windows. **macOS (Homebrew):** ```bash brew install git-flow-avh ``` **macOS (MacPorts):** ```bash port install git-flow ``` **Linux (baseado em Debian):** ```bash sudo apt-get install git-flow ``` **Windows (Cygwin):** > Requer wget e util-linux ```bash wget -q -O - --no-check-certificate https://raw.githubusercontent.com/petervanderdoes/gitflow/develop/contrib/gitflow-installer.sh install | bash ``` --- ### 🚀 Começando Git-flow precisa de inicialização para personalizar a configuração do seu projeto. **Inicializar (interativo):** ```bash git flow init ``` > Você responderá perguntas sobre convenções de nomenclatura de branches. Valores padrão são recomendados. **Inicializar (usar padrões):** ```bash git flow init -d ``` --- ### ✨ Features Features são para desenvolver nova funcionalidade para próximos releases. Tipicamente existem apenas em repositórios de desenvolvedores. **Iniciar novo feature:** ```bash git flow feature start MEUFEATURE ``` > Cria branch de feature baseado em 'develop' e troca para ele **Finalizar feature:** ```bash git flow feature finish MEUFEATURE ``` > Isso fará: > 1. Mesclar MEUFEATURE em 'develop' > 2. Remover o branch de feature > 3. Trocar de volta para 'develop' **Publicar feature (para colaboração):** ```bash git flow feature publish MEUFEATURE ``` **Obter feature publicado:** ```bash git flow feature pull origin MEUFEATURE ``` **Rastrear feature de origem:** ```bash git flow feature track MEUFEATURE ``` --- ### 🎁 Fazer um Release Releases suportam preparação de novos releases de produção, permitindo correções menores de bugs e preparando meta-dados. **Iniciar release:** ```bash git flow release start RELEASE [BASE] ``` > Cria branch de release a partir de 'develop'. Opcionalmente especifique commit SHA-1 [BASE]. **Publicar release:** ```bash git flow release publish RELEASE ``` **Rastrear release remoto:** ```bash git flow release track RELEASE ``` **Finalizar release:** ```bash git flow release finish RELEASE ``` > Isso fará: > 1. Mesclar branch de release em 'master' > 2. Taggar o release > 3. Mesclar release de volta em 'develop' > 4. Remover branch de release > 💡 **Não esqueça:** Envie suas tags com `git push --tags` --- ### 🔥 Hotfixes Hotfixes abordam problemas críticos em versões de produção ao vivo. Eles se ramificam da tag correspondente no master. **Iniciar hotfix:** ```bash git flow hotfix start VERSAO [NOMEBASE] ``` **Finalizar hotfix:** ```bash git flow hotfix finish VERSAO ``` > Mescla de volta em 'develop' e 'master', e tagga o merge do master --- ### 📊 Resumo de Comandos

Comandos Git Flow

### 🌊 Esquema do Git Flow

Esquema Git Flow

--- ## 📚 Recursos Adicionais ### Documentação Oficial e Guias - [Documentação Oficial do Git](https://git-scm.com/doc) - [Livro Pro Git (gratuito)](https://git-scm.com/book/pt-br) - [Manual de Referência Git](https://git-scm.com/docs) - [Tutorial Git](https://git-scm.com/docs/gittutorial) ### Materiais de Aprendizado Online - [GitHub Git Handbook](https://guides.github.com/introduction/git-handbook/) - [Atlassian Git Tutorials](https://www.atlassian.com/git/tutorials) - [Learn Git Branching (interativo)](https://learngitbranching.js.org/?locale=pt_BR) - [Git Immersion](http://gitimmersion.com/) ### Ferramentas GUI - [GitHub Desktop](https://desktop.github.com/) - [GitKraken](https://www.gitkraken.com/) - [SourceTree](https://www.sourcetreeapp.com/) - [Tower](https://www.git-tower.com/) ### Tópicos Avançados - [Git Hooks](https://git-scm.com/book/pt-br/v2/Customizing-Git-Git-Hooks) - [Workflows Git](https://www.atlassian.com/git/tutorials/comparing-workflows) - [Funcionamento Interno do Git](https://git-scm.com/book/pt-br/v2/Git-Internals-Plumbing-and-Porcelain) --- ## 🌍 Outros Idiomas Esta folha de dicas está disponível em múltiplos idiomas: | Idioma | Link | |--------|------| | 🇺🇸 Inglês | [README.md](../README.md) | | 🇸🇦 Árabe | [git-cheat-sheet-ar.md](./git-cheat-sheet-ar.md) | | 🇧🇩 Bengali | [git-cheat-sheet-bn.md](./git-cheat-sheet-bn.md) | | 🇨🇳 Chinês | [git-cheat-sheet-zh.md](./git-cheat-sheet-zh.md) | | 🇩🇪 Alemão | [git-cheat-sheet-de.md](./git-cheat-sheet-de.md) | | 🇪🇸 Espanhol | [git-cheat-sheet-es.md](./git-cheat-sheet-es.md) | | 🇬🇷 Grego | [git-cheat-sheet-el.md](./git-cheat-sheet-el.md) | | 🇮🇳 Hindi | [git-cheat-sheet-hi.md](./git-cheat-sheet-hi.md) | | 🇰🇷 Coreano | [git-cheat-sheet-ko.md](./git-cheat-sheet-ko.md) | | 🇵🇱 Polonês | [git-cheat-sheet-pl.md](./git-cheat-sheet-pl.md) | | 🇹🇷 Turco | [git-cheat-sheet-tr.md](./git-cheat-sheet-tr.md) | --- ## 🤝 Contribuir Damos as boas-vindas a contribuições! Você pode: - 🐛 Reportar bugs ou erros de digitação - ✨ Adicionar novos comandos Git - 🌍 Traduzir para novos idiomas - 💡 Melhorar explicações - 📝 Aprimorar formatação **Como contribuir:** 1. Faça fork deste repositório 2. Crie seu branch de feature (`git checkout -b feature/FeatureIncrivel`) 3. Faça commit das suas mudanças (`git commit -m 'Adicionar alguma FeatureIncrivel'`) 4. Faça push para o branch (`git push origin feature/FeatureIncrivel`) 5. Abra um Pull Request --- ## 📄 Licença Este projeto é código aberto e está disponível sob a [Licença MIT](LICENSE). ---

⭐ Dê uma estrela neste repositório se foi útil!

================================================ FILE: other-sheets/git-cheat-sheet-tr.md ================================================ # Git Cheat Sheet Türkçe ![Git Logo](../Img/git-logo.png) En çok kullanılan Git komutları için hızlı referans rehberi, kolay kullanım için kategorilere göre düzenlenmiştir. ## 📖 Bu Rehber Hakkında Bu kapsamlı Git referans rehberi, Git iş akışlarını iyileştirmek isteyen herkes için eksiksiz bir kaynaktır. Git yolculuğuna başlayan yeni başlayanlardan deneyimli geliştiricilere kadar, bu rehber geliştirme sürecinizi hızlandırmak için sistematik olarak düzenlenmiş ve kategorize edilmiş komutlar sağlar. ### Temel Özellikler: - **Sistematik kategoriler**: Komutlar açık ve mantıklı gruplara düzenlenmiştir - **Pratik örnekler**: Gerçek kullanım durumlarıyla birlikte verilmiştir - **Yeni başlayanlar için uygun**: Net açıklamalar ve ipuçları içerir - **Hızlı referans**: Temel komutlara anında erişim --- ## 📑 İçindekiler - [📖 Bu Rehber Hakkında](#bu-rehber-hakkında) - [🔧 İlk Kurulum](#i̇lk-kurulum) - [⚙️ Yapılandırma Dosyaları](#yapılandırma-dosyaları) - [📁 Depo Kurulumu](#depo-kurulumu) - [📊 Durum Komutları](#durum-komutları) - [📝 Dosya Yönetimi](#dosya-yönetimi) - [💾 Commit'ler](#commitler) - [🌿 Dal'lar (Branches)](#dallar-branches) - [🔀 Birleştirme (Merge)](#birleştirme-merge) - [🌐 Uzak Depolar](#uzak-depolar) - [📚 Geçmiş ve Loglar](#geçmiş-ve-loglar) - [🔍 Arama](#arama) - [📁 Taşıma/Yeniden Adlandırma](#taşımayeniden-adlandırma) - [🏷️ Etiketler (Tags)](#etiketler-tags) - [↩️ Değişiklikleri Geri Alma](#değişiklikleri-geri-alma) - [📦 Saklama (Stash)](#saklama-stash) - [🌊 Git Flow](#git-flow) - [💡 Faydalı İpuçları](#faydalı-i̇puçları) - [📚 Ek Kaynaklar](#ek-kaynaklar) - [🌍 Diğer Diller](#diğer-diller) - [🤝 Katkıda Bulunma](#katkıda-bulunma) - [📄 Lisans](#lisans) --- ## 🔧 İlk Kurulum Git'i kişisel bilgilerinizle yapılandırın: ```bash # Kullanıcı adını ayarlama git config --global user.name "Adınız" # E-posta adresini ayarlama git config --global user.email "email@example.com" # Mevcut yapılandırmayı görme git config --list # Varsayılan editörü ayarlama git config --global core.editor "nano" # Birleştirme aracını ayarlama git config --global merge.tool vimdiff ``` --- ## ⚙️ Yapılandırma Dosyaları Git, yapılandırmayı çeşitli seviyelerde yönetir: ### Global yapılandırma dosyası ```bash # Global yapılandırma dosyası yolu ~/.gitconfig # Global yapılandırmayı düzenleme git config --global --edit ``` ### Depo yapılandırma dosyası ```bash # Depo yapılandırma dosyası yolu .git/config # Depo yapılandırmasını düzenleme git config --edit ``` ### Sistem yapılandırması ```bash # Sistem yapılandırma dosyası (yönetici izinleri gerekli) /etc/gitconfig # Sistem yapılandırmasını düzenleme git config --system --edit ``` ### Yararlı yapılandırma ayarları ```bash # Renkli çıktıyı etkinleştirme git config --global color.ui true # Varsayılan dal adını ayarlama git config --global init.defaultBranch main # Satır sonu işleme (macOS/Linux) git config --global core.autocrlf input # Satır sonu işleme (Windows) git config --global core.autocrlf true ``` --- ## 📁 Depo Kurulumu ### Yeni depo oluşturma: ```bash # Yeni Git deposu oluşturma git init # Mevcut depoyu klonlama git clone # Belirli dizine klonlama git clone ``` --- ## 📊 Durum Komutları ### Deponuzun durumunu kontrol etme: ```bash # Deponun mevcut durumunu gösterme git status # Kısa formatta durum gösterme git status -s # İzlenmeyen dosyaları yok sayarak durum gösterme git status --ignored # Değiştirilmiş dosyalardaki farkları gösterme git diff # Hazırlama alanındaki farkları gösterme git diff --staged # Dallar arasındaki farkları gösterme git diff ``` --- ## 📝 Dosya Yönetimi ### Dosya ekleme ve kaldırma: ```bash # Belirli dosyayı hazırlama alanına ekleme git add # Tüm değiştirilmiş dosyaları ekleme git add . # Belirli türdeki tüm dosyaları ekleme git add *.txt # Etkileşimli ekleme git add -i # Dosyayı depo ve çalışma dizininden kaldırma git rm # Dosyayı sadece depodan kaldırma (dizinde tutma) git rm --cached # Dosya taşıma/yeniden adlandırma git mv ``` --- ## 💾 Commit'ler ### Depoda değişiklikleri kaydetme: ```bash # Mesajla commit yapma git commit -m "Commit mesajı" # Tüm değiştirilmiş dosyaları ekleyerek commit yapma git commit -am "Commit mesajı" # Son commit'i değiştirme git commit --amend # Boş commit yapma (CI/CD tetikleyicileri için yararlı) git commit --allow-empty -m "CI Tetikleyici" # Ayrıntılı mesajla commit yapma (editör açılır) git commit ``` --- ## 🌿 Dal'lar (Branches) ### Dallarla çalışma: ```bash # Tüm dalları gösterme git branch # Uzak dalları gösterme git branch -r # Tüm dalları gösterme (yerel ve uzak) git branch -a # Yeni dal oluşturma git branch # Dala geçiş yapma git checkout # Yeni dal oluşturup geçiş yapma git checkout -b # Belirli commit'ten dal oluşturma git checkout -b # Dal silme git branch -d # Zorla dal silme git branch -D # Mevcut dalı yeniden adlandırma git branch -m # Belirli dalı yeniden adlandırma git branch -m ``` --- ## 🔀 Birleştirme (Merge) ### Dallar arasında değişiklikleri birleştirme: ```bash # Mevcut dala başka dalı birleştirme git merge # Fast-forward olmadan birleştirme (merge commit oluşturma) git merge --no-ff # Sadece fast-forward olduğunda birleştirme git merge --ff-only # Devam eden birleştirmeyi iptal etme git merge --abort # Çakışma çözümünden sonra birleştirmeye devam etme git merge --continue ``` --- ## 🌐 Uzak Depolar ### Uzak depo yönetimi: ```bash # Uzak depoları gösterme git remote # URL'lerle uzak depoları gösterme git remote -v # Uzak depo ekleme git remote add # Uzak depo URL'ini değiştirme git remote set-url # Uzak depo kaldırma git remote remove # Uzak depoya değişiklikleri gönderme git push # Dal göndererek takibi ayarlama git push -u # Tüm dalları gönderme git push --all # Etiketleri gönderme git push --tags # Uzak depodan değişiklikleri indirme git pull # Birleştirme olmadan değişiklikleri indirme git fetch # Tüm uzak dalları indirme git fetch --all ``` --- ## 📚 Geçmiş ve Loglar ### Commit geçmişini keşfetme: ```bash # Commit geçmişini gösterme git log # Commit başına bir satırda geçmiş gösterme git log --oneline # Grafik ile geçmiş gösterme git log --graph # Belirli dosyanın geçmişini gösterme git log # Commit istatistiklerini gösterme git log --stat # Her commit'teki değişiklikleri gösterme git log -p # Son N commit'i gösterme git log -n # Tarihler arasındaki commit'leri gösterme git log --since="2023-01-01" --until="2023-12-31" # Yazara göre commit'leri gösterme git log --author="Yazar Adı" # Commit mesajlarında arama yapma git log --grep="anahtar kelime" ``` --- ## 🔍 Arama ### İçerik ve geçmişte arama: ```bash # İzlenen dosyalarda metin arama git grep "aranacak metin" # Büyük/küçük harf duyarsız arama git grep -i "metin" # Tam kelime arama git grep -w "kelime" # Satır numaralarını gösterme git grep -n "metin" # Sadece dosya adlarını gösterme git grep -l "metin" # Belirli dosyalarda arama git grep "metin" -- "*.js" # Commit geçmişinde arama git log -S "metin" --source --all # Geçmişte ekleme/silme araması git log -G "regex_pattern" --patch # Dosya adına göre arama git log --all --full-history -- "**/dosya_adi.*" # Belirli commit'te arama git grep "metin" ``` --- ## 🏷️ Etiketler (Tags) ### Sürüm etiketleri yönetimi: ```bash # Tüm etiketleri gösterme git tag # Hafif etiket oluşturma git tag # Açıklamalı etiket oluşturma git tag -a -m "Etiket mesajı" # Belirli commit'e etiket oluşturma git tag -a # Etiket bilgilerini gösterme git show # Yerel etiket silme git tag -d # Uzak etiket silme git push --delete # Belirli etiket gönderme git push # Tüm etiketleri gönderme git push --tags ``` --- ## 📁 Taşıma/Yeniden Adlandırma ### Dosya ve dizin yönetimi: ```bash # Dosya taşıma/yeniden adlandırma git mv # Dizin yeniden adlandırma git mv # Birden fazla dosyayı dizine taşıma git mv dosya1.txt dosya2.txt dizin/ # Büyük/küçük harf değişikliği (büyük/küçük harf duyarlı dosya sistemleri) git mv dosyaadi.txt temp.txt git mv temp.txt DosyaAdi.txt # Taşınan dosyanın geçmişini takip etme git log --follow # Taşınan dosyaları izleme git log --stat -M # Yeniden adlandırma algılama eşiğini ayarlama git log --follow -M90% ``` --- ## ↩️ Değişiklikleri Geri Alma ### Değişiklikleri geri almak: ```bash # Belirli dosyadaki değişiklikleri iptal etme git checkout # Tüm commit edilmemiş değişiklikleri iptal etme git checkout . # Dosyayı belirli sürüme geri getirme git checkout # Dosyayı hazırlama alanından kaldırma git reset # Tüm dosyaları hazırlama alanından kaldırma git reset # Önceki commit'e dönme (değişiklikleri koruma) git reset --soft HEAD~1 # Önceki commit'e dönme (değişiklikleri iptal etme) git reset --hard HEAD~1 # Belirli commit'e dönme git reset --hard # Başka commit'i iptal eden yeni commit oluşturma git revert # Birden fazla commit'i geri alma git revert .. ``` --- ## 📦 Saklama (Stash) ### Geçici olarak çalışmayı saklama: ```bash # Mevcut değişiklikleri stash'e saklama git stash # Açıklayıcı mesajla saklama git stash save "Açıklayıcı mesaj" # Tüm stash'leri gösterme git stash list # Son stash'i uygulama git stash apply # Belirli stash'i uygulama git stash apply stash@{0} # Son stash'i uygulayıp silme git stash pop # Belirli stash'i silme git stash drop stash@{0} # Tüm stash'leri silme git stash clear # Stash'teki değişiklikleri gösterme git stash show stash@{0} # Stash'ten dal oluşturma git stash branch stash@{0} ``` --- ## 🌊 Git Flow Git Flow, proje yayınları etrafında tasarlanmış katı bir iş akışı tanımlayan dallanma modelidir. ### Ana dallar: - **master/main**: Üretim kodu - **develop**: Ana geliştirme dalı ### Destek dalları: - **feature**: Yeni özellikler için - **release**: Yeni sürüm hazırlığı için - **hotfix**: Üretimde acil düzeltmeler için ### Git Flow komutları: ```bash # git flow başlatma git flow init # Yeni özellik başlatma git flow feature start <özellik-adı> # Özelliği bitirme git flow feature finish <özellik-adı> # Özelliği yayınlama git flow feature publish <özellik-adı> # Sürüm başlatma git flow release start # Sürümü bitirme git flow release finish # Hotfix başlatma git flow hotfix start # Hotfix'i bitirme git flow hotfix finish ``` ### Git Flow olmadan iş akışı: ![Git Flow Commands](../Img/git-flow-commands-without-flow.png) ```bash # Özellik dalı oluşturma git checkout develop git checkout -b feature/yeni-özellik # Özellik üzerinde çalışma git add . git commit -m "Yeni özellik ekle" # Develop'a özellik birleştirme git checkout develop git merge --no-ff feature/yeni-özellik git branch -d feature/yeni-özellik # Sürüm dalı oluşturma git checkout develop git checkout -b release/1.0.0 # Sürümü tamamlama git checkout master git merge --no-ff release/1.0.0 git tag -a 1.0.0 -m "Sürüm 1.0.0" git checkout develop git merge --no-ff release/1.0.0 git branch -d release/1.0.0 ``` --- ## 💡 Faydalı İpuçları ### Faydalı kısayollar: ```bash # Faydalı kısayolları ayarlama git config --global alias.st status git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.unstage 'reset HEAD --' git config --global alias.last 'log -1 HEAD' git config --global alias.visual '!gitk' ``` ### .gitignore dosyaları: ```bash # .gitignore dosyası oluşturma echo "node_modules/" >> .gitignore echo "*.log" >> .gitignore echo ".env" >> .gitignore # Zaten izlenen dosyaları yok sayma git rm --cached echo "" >> .gitignore git add .gitignore git commit -m ".gitignore'a dosya ekle" ``` --- ## 📚 Ek Kaynaklar ### Resmi Dokümantasyon ve Rehberler - [Git Resmi Dokümantasyonu](https://git-scm.com/doc) - [Pro Git Kitabı (ücretsiz)](https://git-scm.com/book) - [Git Referans Kılavuzu](https://git-scm.com/docs) - [Git Eğitimi](https://git-scm.com/docs/gittutorial) ### Çevrimiçi Öğrenme Materyalleri - [GitHub Git El Kitabı](https://guides.github.com/introduction/git-handbook/) - [Atlassian Git Eğitimleri](https://www.atlassian.com/git/tutorials) - [Learn Git Branching (etkileşimli)](https://learngitbranching.js.org/) - [Git Immersion](http://gitimmersion.com/) ### GUI Araçları - [GitHub Desktop](https://desktop.github.com/) - [GitKraken](https://www.gitkraken.com/) - [SourceTree](https://www.sourcetreeapp.com/) - [Tower](https://www.git-tower.com/) ### İleri Düzey Konular - [Git Hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) - [Git İş Akışları](https://www.atlassian.com/git/tutorials/comparing-workflows) - [Git İç Yapısı](https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain) --- ## 🌍 Diğer Diller Bu Git Cheat Sheet aşağıdaki dillerde mevcuttur: - 🇺🇸 [English](../README.md) - 🇸🇦 [العربية](git-cheat-sheet-ar.md) - 🇧🇩 [বাংলা](git-cheat-sheet-bn.md) - 🇩🇪 [Deutsch](git-cheat-sheet-de.md) - 🇬🇷 [Ελληνικά](git-cheat-sheet-el.md) - 🇪🇸 [Español](git-cheat-sheet-es.md) - 🇮🇳 [हिन्दी](git-cheat-sheet-hi.md) - 🇰🇷 [한국어](git-cheat-sheet-ko.md) - 🇵🇱 [Polski](git-cheat-sheet-pl.md) - 🇧🇷 [Português](git-cheat-sheet-pt_BR.md) - 🇹🇷 **Türkçe** (mevcut) - 🇨🇳 [中文](git-cheat-sheet-zh.md) --- ## 🤝 Katkıda Bulunma Katkıları memnuniyetle karşılıyoruz! Bu projeyi iyileştirmeye yardımcı olmak için: 1. **Sorunları bildirin**: Hataları veya iyileştirme önerilerini paylaşın 2. **Yeni diller ekleyin**: Çeviriler oluşturun veya mevcut olanları geliştirin 3. **İçeriği iyileştirin**: Yeni komutlar, örnekler veya açıklamalar ekleyin 4. **Geri bildirim verin**: Deneyimlerinizi ve önerilerinizi paylaşın ### Nasıl katkıda bulunulur: - [GitHub'da sorun açın](https://github.com/arslanbilal/git-cheat-sheet/issues) - Pull request gönderin - Dokümantasyon iyileştirmeleri önerin --- ## 📄 Lisans Bu proje MIT Lisansı altında lisanslanmıştır. Ayrıntılar için [LICENSE](../LICENSE) dosyasına bakın. ---
⭐ Bu cheat sheet yararlı olduğunda yıldızlayın!
Git ile mutlu kodlamalar! 🚀
================================================ FILE: other-sheets/git-cheat-sheet-zh.md ================================================ # Git Cheat Sheet 中文 ![Git Logo](../Img/git-logo.png) 这个全面的Git速查表帮助您掌握Git命令而无需记住所有内容。无论您是初学者还是经验丰富的开发者,本指南都为基本的Git操作提供快速参考。 **欢迎贡献!** 请随意: - 修正语法错误 - 添加新命令 - 翻译成您的语言 - 改进说明 --- ## 📋 目录 - [📖 关于](#-关于) - [🔧 设置](#-设置) - [⚙️ 配置文件](#️-配置文件) - [🆕 创建仓库](#-创建仓库) - [📝 本地更改](#-本地更改) - [🔍 搜索](#-搜索) - [📖 提交历史](#-提交历史) - [📁 移动 / 重命名](#-移动--重命名) - [🌿 分支和标签](#-分支和标签) - [🔄 更新和发布](#-更新和发布) - [🔀 合并和变基](#-合并和变基) - [↩️ 撤销](#️-撤销) - [🌊 Git Flow](#-git-flow) - [📚 附加资源](#-附加资源) - [🌍 其他语言](#-其他语言) - [🤝 贡献](#-贡献) - [📄 许可证](#-许可证) --- ## 🔧 设置 ### 查看配置 **显示当前配置:** ```bash git config --list ``` **显示仓库配置:** ```bash git config --local --list ``` **显示全局配置:** ```bash git config --global --list ``` **显示系统配置:** ```bash git config --system --list ``` ### 用户配置 **设置版本历史的姓名:** ```bash git config --global user.name "[姓名]" ``` **设置电子邮件地址:** ```bash git config --global user.email "[有效邮箱]" ``` ### 显示和编辑器设置 **启用自动命令行着色:** ```bash git config --global color.ui auto ``` **设置全局提交编辑器:** ```bash git config --global core.editor vi ``` --- ## ⚙️ 配置文件 | 范围 | 位置 | 命令标志 | |------|------|----------| | **仓库** | `/.git/config` | `--local` | | **用户** | `~/.gitconfig` | `--global` | | **系统** | `/etc/gitconfig` | `--system` | --- ## 🆕 创建仓库 ### 克隆现有仓库 **通过SSH:** ```bash git clone ssh://用户@域名.com/repo.git ``` **通过HTTPS:** ```bash git clone https://域名.com/用户/repo.git ``` ### 初始化新仓库 **在当前目录创建仓库:** ```bash git init ``` **在指定目录创建仓库:** ```bash git init <目录> ``` --- ## 📝 本地更改 ### 检查状态和差异 **查看工作目录状态:** ```bash git status ``` **显示跟踪文件的更改:** ```bash git diff ``` **显示特定文件的更改:** ```bash git diff <文件> ``` ### 暂存更改 **添加所有当前更改:** ```bash git add . ``` **添加特定文件:** ```bash git add <文件1> <文件2> ``` **交互式添加文件的部分内容:** ```bash git add -p <文件> ``` ### 提交更改 **提交所有跟踪文件的更改:** ```bash git commit -a ``` **提交暂存的更改:** ```bash git commit ``` **带消息提交:** ```bash git commit -m '这里是消息' ``` **跳过暂存并带消息提交:** ```bash git commit -am '这里是消息' ``` **以特定日期提交:** ```bash git commit --date="`date --date='n day ago'`" -am "<提交消息>" ``` ### 修改最后一次提交 > ⚠️ **警告:** 不要修改已发布的提交! **修正最后一次提交:** ```bash git commit -a --amend ``` **修正而不更改提交消息:** ```bash git commit --amend --no-edit ``` **更改提交者日期:** ```bash GIT_COMMITTER_DATE="日期" git commit --amend ``` **更改作者日期:** ```bash git commit --amend --date="日期" ``` ### 暂存更改 **临时保存当前更改:** ```bash git stash ``` **应用最后保存的更改:** ```bash git stash apply ``` **应用特定的暂存:** ```bash git stash apply stash@{暂存号} ``` > 使用 `git stash list` 查看可用的暂存 **删除最后一个暂存:** ```bash git stash drop ``` **将未提交的更改移动到另一个分支:** ```bash git stash git checkout 分支2 git stash pop ``` --- ## 🔍 搜索 ### 文本搜索 **在所有文件中搜索文本:** ```bash git grep "你好" ``` **在特定版本中搜索:** ```bash git grep "你好" v2.5 ``` ### 提交搜索 **查找引入特定关键字的提交:** ```bash git log -S '关键字' ``` **使用正则表达式搜索:** ```bash git log -S '关键字' --pickaxe-regex ``` --- ## 📖 提交历史 ### 基本历史 **显示所有提交(详细):** ```bash git log ``` **显示提交(每行一个):** ```bash git log --oneline ``` **显示特定作者的提交:** ```bash git log --author="用户名" ``` **显示特定文件的更改:** ```bash git log -p <文件> ``` ### 高级历史 **比较分支:** ```bash git log --oneline .. --left-right ``` **显示谁何时更改了什么:** ```bash git blame <文件> ``` ### 引用日志 **显示引用日志:** ```bash git reflog show ``` **删除引用日志:** ```bash git reflog delete ``` --- ## 📁 移动 / 重命名 **重命名文件:** ```bash git mv Index.txt Index.html ``` --- ## 🌿 分支和标签 ### 列出分支 **列出本地分支:** ```bash git branch ``` **列出所有分支(本地+远程):** ```bash git branch -a ``` **列出远程分支:** ```bash git branch -r ``` **列出已合并的分支:** ```bash git branch --merged ``` ### 切换和创建分支 **切换到现有分支:** ```bash git checkout <分支> ``` **创建并切换到新分支:** ```bash git checkout -b <分支> ``` **切换到上一个分支:** ```bash git checkout - ``` **从现有分支创建分支:** ```bash git checkout -b <新分支> <现有分支> ``` **从特定提交创建分支:** ```bash git checkout <提交哈希> -b <新分支名> ``` **创建分支但不切换:** ```bash git branch <新分支> ``` **创建跟踪分支:** ```bash git branch --track <新分支> <远程分支> ``` ### 分支操作 **从不同分支检出单个文件:** ```bash git checkout <分支> -- <文件名> ``` **应用另一个分支的特定提交:** ```bash git cherry-pick <提交哈希> ``` **重命名当前分支:** ```bash git branch -m <新分支名> ``` **删除本地分支:** ```bash git branch -d <分支> ``` **强制删除本地分支:** ```bash git branch -D <分支> ``` > ⚠️ **警告:** 您将丢失未合并的更改! ### 标签 **在HEAD创建标签:** ```bash git tag <标签名> ``` **创建注释标签:** ```bash git tag -a <标签名> ``` **创建带消息的标签:** ```bash git tag <标签名> -am '这里是消息' ``` **列出所有标签:** ```bash git tag ``` **列出带消息的标签:** ```bash git tag -n ``` --- ## 🔄 更新和发布 ### 远程管理 **列出配置的远程:** ```bash git remote -v ``` **显示远程信息:** ```bash git remote show <远程> ``` **添加新远程:** ```bash git remote add <远程> <网址> ``` **重命名远程:** ```bash git remote rename <远程> <新远程> ``` **删除远程:** ```bash git remote rm <远程> ``` > ℹ️ **注意:** 这只是在本地删除远程引用,不是远程仓库本身。 ### 获取和拉取 **下载更改而不合并:** ```bash git fetch <远程> ``` **下载并合并更改:** ```bash git pull <远程> <分支> ``` **从主分支获取更改:** ```bash git pull origin master ``` **使用变基拉取:** ```bash git pull --rebase <远程> <分支> ``` ### 推送和发布 **发布本地更改:** ```bash git push <远程> <分支> ``` **删除远程分支:** ```bash # Git v1.7.0+ git push <远程> --delete <分支> # Git v1.5.0+ git push <远程> :<分支> ``` **发布标签:** ```bash git push --tags ``` --- ## 🔀 合并和变基 ### 合并操作 **将分支合并到当前HEAD:** ```bash git merge <分支> ``` **全局配置合并工具:** ```bash git config --global merge.tool meld ``` **使用配置的合并工具:** ```bash git mergetool ``` ### 变基操作 > ⚠️ **警告:** 不要变基已发布的提交! **将当前HEAD变基到分支:** ```bash git rebase <分支> ``` **中止变基:** ```bash git rebase --abort ``` **解决冲突后继续变基:** ```bash git rebase --continue ``` ### 冲突解决 **标记文件为已解决:** ```bash git add <已解决文件> ``` **删除已解决文件:** ```bash git rm <已解决文件> ``` ### 压缩提交 **交互式变基进行压缩:** ```bash git rebase -i <第一个提交之前的提交> ``` **压缩配置示例:** ``` # 之前 pick <提交id> pick <提交id2> pick <提交id3> # 之后(将提交id2和提交id3压缩到提交id) pick <提交id> squash <提交id2> squash <提交id3> ``` --- ## ↩️ 撤销 ### 丢弃更改 **丢弃所有本地更改:** ```bash git reset --hard HEAD ``` **从暂存区移除所有文件:** ```bash git reset HEAD ``` **丢弃特定文件的更改:** ```bash git checkout HEAD <文件> ``` ### 重置操作 **重置到上一个提交(丢弃所有更改):** ```bash git reset --hard <提交> ``` **重置到远程分支状态:** ```bash git reset --hard <远程/分支> # 示例:git reset --hard upstream/master ``` **重置保持更改为未暂存:** ```bash git reset <提交> ``` **重置保持本地未提交更改:** ```bash git reset --keep <提交> ``` ### 还原提交 **还原提交(创建具有相反更改的新提交):** ```bash git revert <提交> ``` ### 清理忽略的文件 **删除意外提交的应该被忽略的文件:** ```bash git rm -r --cached . git add . git commit -m "删除忽略的文件" ``` --- ## 🌊 Git Flow **改进的Git-flow:** [git-flow-avh](https://github.com/petervanderdoes/gitflow-avh) ### 📋 目录 - [🔧 设置](#设置-1) - [🚀 开始](#开始) - [✨ 功能](#功能) - [🎁 制作发布](#制作发布) - [🔥 热修复](#热修复) - [📊 命令概览](#命令概览) --- ### 🔧 设置 {#设置-1} > **先决条件:** 需要可工作的Git安装。Git-flow可在macOS、Linux和Windows上运行。 **macOS (Homebrew):** ```bash brew install git-flow-avh ``` **macOS (MacPorts):** ```bash port install git-flow ``` **Linux (基于Debian):** ```bash sudo apt-get install git-flow ``` **Windows (Cygwin):** > 需要wget和util-linux ```bash wget -q -O - --no-check-certificate https://raw.githubusercontent.com/petervanderdoes/gitflow/develop/contrib/gitflow-installer.sh install | bash ``` --- ### 🚀 开始 Git-flow需要初始化以自定义您的项目设置。 **初始化(交互式):** ```bash git flow init ``` > 您将回答关于分支命名约定的问题。建议使用默认值。 **初始化(使用默认值):** ```bash git flow init -d ``` --- ### ✨ 功能 功能用于开发即将发布的新功能。它们通常只存在于开发者仓库中。 **开始新功能:** ```bash git flow feature start 我的功能 ``` > 基于'develop'创建功能分支并切换到它 **完成功能:** ```bash git flow feature finish 我的功能 ``` > 这将: > 1. 将我的功能合并到'develop' > 2. 删除功能分支 > 3. 切换回'develop' **发布功能(用于协作):** ```bash git flow feature publish 我的功能 ``` **获取已发布的功能:** ```bash git flow feature pull origin 我的功能 ``` **跟踪源功能:** ```bash git flow feature track 我的功能 ``` --- ### 🎁 制作发布 发布支持新生产版本的准备,允许小的错误修复和准备元数据。 **开始发布:** ```bash git flow release start 发布 [基础] ``` > 从'develop'创建发布分支。可选择指定[基础]提交SHA-1。 **发布版本:** ```bash git flow release publish 发布 ``` **跟踪远程发布:** ```bash git flow release track 发布 ``` **完成发布:** ```bash git flow release finish 发布 ``` > 这将: > 1. 将发布分支合并到'master' > 2. 标记发布 > 3. 将发布合并回'develop' > 4. 删除发布分支 > 💡 **别忘了:** 使用 `git push --tags` 推送您的标签 --- ### 🔥 热修复 热修复解决在线生产版本中的关键问题。它们从master上的相应标签分支。 **开始热修复:** ```bash git flow hotfix start 版本 [基础名称] ``` **完成热修复:** ```bash git flow hotfix finish 版本 ``` > 合并回'develop'和'master',并标记master合并 --- ### 📊 命令概览

Git Flow命令

### 🌊 Git Flow模式

Git Flow模式

--- ## 📚 附加资源 ### 官方文档和指南 - [Git官方文档](https://git-scm.com/doc) - [Pro Git书籍(免费)](https://git-scm.com/book/zh) - [Git参考手册](https://git-scm.com/docs) - [Git教程](https://git-scm.com/docs/gittutorial) ### 在线学习资料 - [GitHub Git手册](https://guides.github.com/introduction/git-handbook/) - [Atlassian Git教程](https://www.atlassian.com/git/tutorials) - [Learn Git Branching(交互式)](https://learngitbranching.js.org/?locale=zh_CN) - [Git Immersion](http://gitimmersion.com/) ### GUI工具 - [GitHub Desktop](https://desktop.github.com/) - [GitKraken](https://www.gitkraken.com/) - [SourceTree](https://www.sourcetreeapp.com/) - [Tower](https://www.git-tower.com/) ### 高级主题 - [Git Hooks](https://git-scm.com/book/zh/v2/自定义-Git-Git-钩子) - [Git工作流程](https://www.atlassian.com/git/tutorials/comparing-workflows) - [Git内部原理](https://git-scm.com/book/zh/v2/Git-内部原理-底层命令与上层命令) --- ## 🌍 其他语言 此速查表提供多种语言版本: | 语言 | 链接 | |------|------| | 🇺🇸 英语 | [README.md](../README.md) | | 🇸🇦 阿拉伯语 | [git-cheat-sheet-ar.md](./git-cheat-sheet-ar.md) | | 🇧🇩 孟加拉语 | [git-cheat-sheet-bn.md](./git-cheat-sheet-bn.md) | | 🇧🇷 巴西葡萄牙语 | [git-cheat-sheet-pt_BR.md](./git-cheat-sheet-pt_BR.md) | | 🇩🇪 德语 | [git-cheat-sheet-de.md](./git-cheat-sheet-de.md) | | 🇪🇸 西班牙语 | [git-cheat-sheet-es.md](./git-cheat-sheet-es.md) | | 🇬🇷 希腊语 | [git-cheat-sheet-el.md](./git-cheat-sheet-el.md) | | 🇮🇳 印地语 | [git-cheat-sheet-hi.md](./git-cheat-sheet-hi.md) | | 🇰🇷 韩语 | [git-cheat-sheet-ko.md](./git-cheat-sheet-ko.md) | | 🇵🇱 波兰语 | [git-cheat-sheet-pl.md](./git-cheat-sheet-pl.md) | | 🇹🇷 土耳其语 | [git-cheat-sheet-tr.md](./git-cheat-sheet-tr.md) | --- ## 🤝 贡献 我们欢迎贡献!您可以: - 🐛 报告错误或拼写错误 - ✨ 添加新的Git命令 - 🌍 翻译成新语言 - 💡 改进说明 - 📝 增强格式 **如何贡献:** 1. Fork这个仓库 2. 创建您的功能分支 (`git checkout -b feature/神奇功能`) 3. 提交您的更改 (`git commit -m '添加一些神奇功能'`) 4. 推送到分支 (`git push origin feature/神奇功能`) 5. 打开Pull Request --- ## 📄 许可证 此项目是开源的,在[MIT许可证](LICENSE)下可用。 ---

⭐ 如果这个仓库对您有帮助,请给它加星!