SlideShare a Scribd company logo
GIT
Commit ve Push’dan Bir Adım Ötesi...
İbrahim Gündüz
Markafoni Brown Bag @ 2015
Ajanda
● Temel Kavramlar
○ fetch
○ merge
○ rebase
○ pull
○ pull --rebase
● Neden Merge Değil Rebase ?
● AB-1 vs origin/AB-1
● Sapma (Diverge) Nedir ? Nasıl Olur ? Ne Yapmalı ?
● Çakışma (Conflict) Nedir ? Nasıl Oluşur ? Ne Yapmalı ?
● A Geliştiricisi İle B Geliştiricisinin AB-1 dalında Birlikte Çalışması
● Lüzumsuz Commitler ve Rebase Zulmü Arasındaki İlişki
● Sorular ?
GIT - Temel Kavramlar
git fetch
git merge
git rebase
git pull
git pull --rebase
GIT - git fetch
● Uzak uçtaki referansları transfer eder.
● Kaynak kodu güncellemez.
Söz Dizimi:
git fetch <repository>
Örnek:
git fetch origin
GIT - git merge
● Belirli bir GIT dalını, geçerli dalla birleştirir.
● Yalnızca daha önce uzak uçtan aktarılmış referanslar veya yerel depodaki
dallarla birleştirme gerçekleştirilir.
● Değişiklikler, tarihsel sıraya göre uygulanır.
Söz Dizimi:
git merge <ref>
Örnek:
$ git merge AB-1
$ git merge origin/AB-1
GIT - git merge
Önce Sonra
GIT - git rebase
● Belirli bir GIT dalını, geçerli dalla birleştirir.
● Yalnızca daha önce uzak uçtan aktarılmış referansları birleştirir.
● Değişiklikler, geçerli dalın ana daldan ayrıldığı noktadan itibaren
gerçekleştirilen geliştirmelerin birleştirme sonrasında en sona taşınması
şeklinde uygulanır.
Söz Dizimi:
git rebase <base_ref>
Örnek:
$ git rebase master
$ git rebase origin/master
GIT - git rebase
Önce
Sonra
GIT - git pull
● git pull == git fetch + git merge
● Yalnızca parametre olarak belirtilen dal için senkronizasyon işlemi
gerçekleştirir.
● Birleştirme işlemini kronolojik olarak gerçekleştirir.
● Geçerli dal ile parametre olarak belirtilen dalı birleştirmez.
Söz Dizimi:
git pull <repository> <ref>
Örnek:
$ git pull origin ab-1
?
git pull --rebase
git pull --rebase
=
git fetch + git rebase
GIT - Neden Merge Değil Rebase ?
git merge git rebase
● Birleştirme yapılan dalda herhangibir zamanda oluşturulan commit lerin
birleşen daldaki commitlerin arasına karışarak dalda sapma (Diverge)
meydana gelmemesi
● Geliştirmelerin birbirinden keskin şekilde ayrılması
● Hangi dalda hangi değişikliğin yapıldığının net olarak anlaşılması
● Geri dönüş sırasında karşılaşılacak sorunların önüne geçmek.
GIT - AB-1 vs. origin/AB-1
AB-1: GIT dalı.
origin/AB-1: Referans.
origin/AB-1 Ne Zaman Kullanılabilir ?
Merge ve rebase öncesinde:
● Uzak Uç Log Kontrolü
$ git log origin/AB-1
● Uzak Uç ile Yerel Ortam Karşılaştırması
$ git diff AB-1 origin/AB-1
● Merge/Rebase İşlemlerinin Güvenli Olarak Gerçekleştirilmesi
$ git rebase origin/master
● Referans belirterek dal çıkmak
$ git checkout -b AB-2 -t origin/master
GIT - Sapma (Diverge) Nedir ? Nasıl Olur ? Ne
Yapmalı ?
Nedir ?
Uzak uç ile yerel ortam arasındaki
commit diziliminin belirli bir sıralama
sonrasında araya giren farklı commitler
nedeniyle bozulmasıdır.
Nasıl Olur ?
● İki veya daha fazla dalın bir dalda
birleştirilmesiyle iki commit
arasına giren yeni commitlerin
uzak uçla yerel ortam arasında
farklılık yaratması.
● Feature dalın rebase edilmesi.
Ne Yapmalı ?
Uzak uçdaki dal git push --force ile
ezilmeden önce;
● Birleştirilen dalların güncelliğinden
emin olunmalı.
● rebase edilen dal ve taban dalın
güncelliğinden emin olunmalı.
GIT - Çakışma (Conflict) Nedir ? Nasıl Oluşur ?
Ne Yapmalı ?
Nedir ?
Aynı yerde yapılan değişikliklerin üst üste gelmesi
durumudur.
Nasıl Oluşur ?
Birleştirilen dallar aynı dosyanın farklı versiyonlarını
içermesi durumunda
Ne Yapmalı ?
● Sürümde yeralması gereken değişikliğin hangisi
olduğuna karar verilerek diğer version kaynak
koddan kaldırılmalı.
● Conflictler çözüldükten sonra ilgili dosya git add ile
staging e alınmalı.
● Conflict merge sırasında oluşmuşsa;
○ Tüm conflictler çözülmüşse yeni bir commit
oluşturularak sürüme gönderilmeli.
○ git rebase --continue komutu çalıştırılarak
sonraki commitlerin dalla birleştirilmesi
sağlanmalıdır.
GIT - A Geliştiricisi İle B Geliştiricisinin AB-1
dalında Birlikte Çalışması
● Birlikte çalışılan işlerde feature branch ler
sıklıkla değişikliğe uğrar.
● Dallarda sapma (Diverge) meydana
gelmemesi için en son yapılan değişiklikler
dalın her zaman en sonunda tutulmalıdır.
● Doğru çalışılmış daldaki commit dizilimi düz
bir çizgiyi şeklindedir, herhangibir sapma
oluşmaz.
Ne Yapmalı ?
git pull --rebase origin AB-1
Ne Yapmamalı ?
git pull origin AB-1
Neden ?
● git pull, ucak uçtaki değişiklikleri kronolojik
olarak yerel ortamdaki dalla birleştirir.
● Kronolojik olarak birleşen branch, zamana
bağlı olarak araya giren farklı commitler
nedeniyle uzak uçtan sapar.
Hatalı Feature Branch
Başarılı Feature Branch
● Geliştirme sonrasında oluşturulan hata
veya stil düzeltme commit leri logun
gereksiz uzamasına ve okuma
güçlüğüne neden olur.
● Çok sayıda commit içeren dalların
rebase edilmesi sırasında oluşan
çakışmalar tekrar tekrar fix edilmek
durumunda kalınabilir.
$ git rebase --continue
$ git rebase --continue
$ git rebase --continue
…
$ git rebase --continue
Ne Yapmalı ?
Lüzumusz commitler Interactive rebase ile
birleştirilmelidir.
$ git rebase -i HEAD~2
GIT - Lüzumsuz Commitler ve Rebase Zulmü
Arasındaki İlişki
Gereksiz commitler (Son 2 Commit)
Interactive Rebase
Son iki commit birleştiriliyor
Başarılı Feature Branch
Sorular
?
Teşekkürler

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Git commit ve push’dan bir adım ötesi...

  • 1. GIT Commit ve Push’dan Bir Adım Ötesi... İbrahim Gündüz Markafoni Brown Bag @ 2015
  • 2. Ajanda ● Temel Kavramlar ○ fetch ○ merge ○ rebase ○ pull ○ pull --rebase ● Neden Merge Değil Rebase ? ● AB-1 vs origin/AB-1 ● Sapma (Diverge) Nedir ? Nasıl Olur ? Ne Yapmalı ? ● Çakışma (Conflict) Nedir ? Nasıl Oluşur ? Ne Yapmalı ? ● A Geliştiricisi İle B Geliştiricisinin AB-1 dalında Birlikte Çalışması ● Lüzumsuz Commitler ve Rebase Zulmü Arasındaki İlişki ● Sorular ?
  • 3. GIT - Temel Kavramlar git fetch git merge git rebase git pull git pull --rebase
  • 4. GIT - git fetch ● Uzak uçtaki referansları transfer eder. ● Kaynak kodu güncellemez. Söz Dizimi: git fetch <repository> Örnek: git fetch origin
  • 5. GIT - git merge ● Belirli bir GIT dalını, geçerli dalla birleştirir. ● Yalnızca daha önce uzak uçtan aktarılmış referanslar veya yerel depodaki dallarla birleştirme gerçekleştirilir. ● Değişiklikler, tarihsel sıraya göre uygulanır. Söz Dizimi: git merge <ref> Örnek: $ git merge AB-1 $ git merge origin/AB-1
  • 6. GIT - git merge Önce Sonra
  • 7. GIT - git rebase ● Belirli bir GIT dalını, geçerli dalla birleştirir. ● Yalnızca daha önce uzak uçtan aktarılmış referansları birleştirir. ● Değişiklikler, geçerli dalın ana daldan ayrıldığı noktadan itibaren gerçekleştirilen geliştirmelerin birleştirme sonrasında en sona taşınması şeklinde uygulanır. Söz Dizimi: git rebase <base_ref> Örnek: $ git rebase master $ git rebase origin/master
  • 8. GIT - git rebase Önce Sonra
  • 9. GIT - git pull ● git pull == git fetch + git merge ● Yalnızca parametre olarak belirtilen dal için senkronizasyon işlemi gerçekleştirir. ● Birleştirme işlemini kronolojik olarak gerçekleştirir. ● Geçerli dal ile parametre olarak belirtilen dalı birleştirmez. Söz Dizimi: git pull <repository> <ref> Örnek: $ git pull origin ab-1
  • 11. git pull --rebase = git fetch + git rebase
  • 12. GIT - Neden Merge Değil Rebase ? git merge git rebase ● Birleştirme yapılan dalda herhangibir zamanda oluşturulan commit lerin birleşen daldaki commitlerin arasına karışarak dalda sapma (Diverge) meydana gelmemesi ● Geliştirmelerin birbirinden keskin şekilde ayrılması ● Hangi dalda hangi değişikliğin yapıldığının net olarak anlaşılması ● Geri dönüş sırasında karşılaşılacak sorunların önüne geçmek.
  • 13. GIT - AB-1 vs. origin/AB-1 AB-1: GIT dalı. origin/AB-1: Referans. origin/AB-1 Ne Zaman Kullanılabilir ? Merge ve rebase öncesinde: ● Uzak Uç Log Kontrolü $ git log origin/AB-1 ● Uzak Uç ile Yerel Ortam Karşılaştırması $ git diff AB-1 origin/AB-1 ● Merge/Rebase İşlemlerinin Güvenli Olarak Gerçekleştirilmesi $ git rebase origin/master ● Referans belirterek dal çıkmak $ git checkout -b AB-2 -t origin/master
  • 14. GIT - Sapma (Diverge) Nedir ? Nasıl Olur ? Ne Yapmalı ? Nedir ? Uzak uç ile yerel ortam arasındaki commit diziliminin belirli bir sıralama sonrasında araya giren farklı commitler nedeniyle bozulmasıdır. Nasıl Olur ? ● İki veya daha fazla dalın bir dalda birleştirilmesiyle iki commit arasına giren yeni commitlerin uzak uçla yerel ortam arasında farklılık yaratması. ● Feature dalın rebase edilmesi. Ne Yapmalı ? Uzak uçdaki dal git push --force ile ezilmeden önce; ● Birleştirilen dalların güncelliğinden emin olunmalı. ● rebase edilen dal ve taban dalın güncelliğinden emin olunmalı.
  • 15. GIT - Çakışma (Conflict) Nedir ? Nasıl Oluşur ? Ne Yapmalı ? Nedir ? Aynı yerde yapılan değişikliklerin üst üste gelmesi durumudur. Nasıl Oluşur ? Birleştirilen dallar aynı dosyanın farklı versiyonlarını içermesi durumunda Ne Yapmalı ? ● Sürümde yeralması gereken değişikliğin hangisi olduğuna karar verilerek diğer version kaynak koddan kaldırılmalı. ● Conflictler çözüldükten sonra ilgili dosya git add ile staging e alınmalı. ● Conflict merge sırasında oluşmuşsa; ○ Tüm conflictler çözülmüşse yeni bir commit oluşturularak sürüme gönderilmeli. ○ git rebase --continue komutu çalıştırılarak sonraki commitlerin dalla birleştirilmesi sağlanmalıdır.
  • 16. GIT - A Geliştiricisi İle B Geliştiricisinin AB-1 dalında Birlikte Çalışması ● Birlikte çalışılan işlerde feature branch ler sıklıkla değişikliğe uğrar. ● Dallarda sapma (Diverge) meydana gelmemesi için en son yapılan değişiklikler dalın her zaman en sonunda tutulmalıdır. ● Doğru çalışılmış daldaki commit dizilimi düz bir çizgiyi şeklindedir, herhangibir sapma oluşmaz. Ne Yapmalı ? git pull --rebase origin AB-1 Ne Yapmamalı ? git pull origin AB-1 Neden ? ● git pull, ucak uçtaki değişiklikleri kronolojik olarak yerel ortamdaki dalla birleştirir. ● Kronolojik olarak birleşen branch, zamana bağlı olarak araya giren farklı commitler nedeniyle uzak uçtan sapar. Hatalı Feature Branch Başarılı Feature Branch
  • 17. ● Geliştirme sonrasında oluşturulan hata veya stil düzeltme commit leri logun gereksiz uzamasına ve okuma güçlüğüne neden olur. ● Çok sayıda commit içeren dalların rebase edilmesi sırasında oluşan çakışmalar tekrar tekrar fix edilmek durumunda kalınabilir. $ git rebase --continue $ git rebase --continue $ git rebase --continue … $ git rebase --continue Ne Yapmalı ? Lüzumusz commitler Interactive rebase ile birleştirilmelidir. $ git rebase -i HEAD~2 GIT - Lüzumsuz Commitler ve Rebase Zulmü Arasındaki İlişki Gereksiz commitler (Son 2 Commit) Interactive Rebase Son iki commit birleştiriliyor Başarılı Feature Branch