Git Branch Cheat Sheet

Git Branch Cheat Sheet

🔹 Branch Listeleme

git branch # Lokal branch’leri göster
git branch -r # Remote (GitHub’daki) branch’leri göster
git branch -a # Hem lokal hem remote branch’leri göster

🔹 Branch Oluşturma

git checkout -b feature/yeni-ozellik # Yeni branch aç ve içine geç

🔹 Branch Değiştirme

git checkout main # main branch’e geç
git checkout feature/yeni-ozellik # ilgili branch’e geç

🔹 Branch Silme

git branch -d feature/yeni-ozellik # Lokal branch’i sil (merge edilmişse)
git branch -D feature/yeni-ozellik # Lokal branch’i zorla sil
git push origin --delete feature/yeni-ozellik # Remote (GitHub) branch’i sil

🔹 Branch Push Etme (GitHub’a Gönderme)

git push origin feature/yeni-ozellik # Branch’i GitHub’a gönder

🔹 Branch Birleştirme (Merge)

git checkout main # Önce main’e geç
git merge feature/yeni-ozellik # Feature branch’i main ile birleştir

🔹 Branch Durumunu Görmek

git status # Mevcut branch ve değişiklikleri göster

War dieser Artikel hilfreich?