Download - Git - Bildiğiniz Gibi Değil
GITbildiğiniz gibi değil…
LEMİ ORHAN ERGİN
lemi orhan ergin
GIT bildiğiniz gibi değil…
LEMİ ORHAN ERGİNAgile Software Craftsman, ACM
2001’den bu yana yazılım geliştiriyor Agile Turkey topluluk lideri Software Craftsmanship Turkey kurucusu Yazılımcı, Mimar, Eğitmen, Koç, Danışman 2009’dan bu yana GitMan Sony & eBay/GittiGidiyor eski çalışanı ACM’de yönetici ortak
/lemiorhan lemiorhanergin.com @lemiorhan
Sürüm Yönetim Sistemleridijital dosyalar için bir zaman makinesidir
Sürüm Kontrol
Sürüm Kontrol
SistemleriMerkeziYerel
Dağıtık
Sadece dosya isimlerini kullanarak dosyaların sürümlerini belirler
YEREL Sürüm Kontrol Sistemi
Revision Control System revizyonları yamalar halinde (patch)
bir isimlendirme kuralına uygun şekilde saklar.
http://en.wikipedia.org/wiki/Revision_Control_System
YEREL Sürüm Kontrol Sistemi
merkezİSürüm Kontrol Sistemi
Dosyaları ortak bir alanda saklar (sunucu) ve herkes buraya kendi kişisel makinalarından erişir (istemci)
merkezİSürüm Kontrol Sistemi
Kullanıcılarda dosyaların sadece son sürümleri bulunur Eğer sunucu bozulursa, tüm sürümleri kaybetme ihtimali vardır
Sturgeon’nun Kuralı Der ki;
bir işe yaramaz
Yaptığımız şeylerin
%90’ıİşe yarayan
çözümleri bulabilmek için
deneysel çalışmalar yapabileceğimiz, korkmadan
sistemi dağıtabileceğimiz, güvenilir bir sisteme ihtiyaç vardır
DağıtıkSürüm Kontrol Sistemi
Her iki tipin avantajlarının birleşimi bir hibrit sistemdir
DağıtıkSürüm Kontrol Sistemi
Sunucuya erişim sorunlarına ve sunucudaki sürümlere bağımlılıktan endişe duymadan yerel değişiklikler yapabilmenizi sağlar
SVN gibi dağıtık olmayan sistemler
Dosya farkları şeklinde
Git değişiklikleri farklı tutar
Değişmiş dosyalar halinde
2.7Gb
8.2Gb
450MB
?MOZILLA350Mb kaynak kod İÇİN
1998’den bu yana yazılan
Ne kadar bİR DİSK ALANI GEREKLİ
Git Ortami
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
.git Folder / Object Database
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
.git Folder / Object Database
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
.git Folder / Object Database
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
.git Folder / Object Database
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
.git Folder / Object Database
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
.git Folder / Object Database
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
.git Folder / Object Database
Sunucuya Kod Gönderme
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
.git Folder / Object Database
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
$ git add
.git Folder / Object Database
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
$ git commit
.git Folder / Object Database
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı.git Folder / Object Database
Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
$ git push
Sunucudan Güncellemeleri Alma
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı.git Folder / Object Database
Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı.git Folder / Object Database
Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
$ git fetch
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
$ git merge FETCH_HEAD
.git Folder / Object Database
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
$ git pullKISAYOL
.git Folder / Object Database
Kodu Sifirdan Alma
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
.git Folder / Object Database
Kaynak KodWoking Copy
CacheStaging Area / The Index
Obje Veritabanı Uzak DepoUpstream Repo / Remote Repo
Kendi makinamız Sunucu
$ git cloneKISAYOL
.git Folder / Object Database
Bir Grup Kod Değişikliği: Commit
Kaliningrad, Prussia’daki 7 köprü
Yıl 1735
Königsberg, Prussia’daki 7 köprüYıl 1735
Her bir köprüden bir kez geçerek tüm şehri dolaşabilir misiniz?
Leonhard Euler
ÇİZGE TEORİSİ (Graph Theory)
klasör
klasör
klasör
dosya
dosya
dosya
klasör
klasör
klasör
dosya
dosya
dosya
GIT bildiğiniz gibi değil…
commit
$ git add . $ git commit -m “first commit”
klasör
klasör
klasör
dosya
dosya
dosya
GIT bildiğiniz gibi değil…
commit
branch
HEAD
$ git add . $ git commit -m “first commit”
klasör
klasör
klasör
dosya
dosya
dosya
GIT bildiğiniz gibi değil…
commit
klasör
klasör
klasör
dosya
commit
branch
HEAD
$ git add . $ git commit -m “second commit”
commit commit commit
klasör
klasör
klasör
dosya
dosya
dosya
GIT bildiğiniz gibi değil…
commit
klasör
klasör
klasör
dosya
commit
branch
HEAD
klasör
dosya
commit
$ git add . $ git commit -m “third commit”
GIT bildiğiniz gibi değil…
branch
HEAD
commit commit commit
$ git add . $ git commit -m “third commit”
d99108a master HEAD
$ git commit -m "first commit" [master (root-commit) d99108a] first commit
1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .gitignore
d99108a
master HEADa4510bc
$ git commit -m "second commit" [master a4510bc] second commit 1 file changed, 1 insertion(+)
d99108a
master HEAD
a4510bc
b2be58f
$ git commit -m "third commit" [master b2be58f] third commit 1 file changed, 1 insertion(+)
d99108a
a4510bc
b2be58f
$ git commit -m "fourth commit" [master 8810ac4] fourth commit 1 file changed, 1 insertion(+)
master HEAD8810ac4
Agh! Son commit’e bir değişiklik eklemeyi unutmuşum. Son commit’i değiştireyim.“
”
d99108a
a4510bc
b2be58f
$ git commit --amend [master 1fa3409] third commit 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 readme.txt
1fa3409
Aynı ortak ata ile ilişkili 2. bir commit oluştu
master HEAD8810ac4
d99108a
a4510bc
b2be58f
1fa3409
master HEAD
8810ac4
bb43c12
$ git commit -m "fifth commit" [master bb43c12] fifth commit 1 file changed, 1 insertion(+)
Ayni Anda Farkli Görevleri Gerçekleştirme
master
HEAD
TAG/v1.1
$ git tag tag/v1.1
master
HEAD
TAG/v1.1
master
HEAD
$ git commit
$ git branch typofix
master
HEAD
typofixTAG/v1.1
$ git checkout typofix
master
typofixTAG/v1.1
HEAD
master
HEAD
typofix
TAG/v1.1
$ git commit
master
typofix
TAG/v1.1
$ git checkout master
HEAD
master
HEAD
TAG/v1.1
typofix
$ git commit
master
HEAD
TAG/v1.1
typofix
$ git merge typofix
master
HEAD
TAG/v1.1
$ git branch -d typofix
Kod Birleştirmenin Akillisi
master
HEAD
typofix
TAG/v1.1
master
HEAD
typofix
TAG/v1.1
$ git merge typofix
Başkalarinin Kodunu İle Entegrasyon
master
HEAD
TAG/v1.1
typofix
master
HEAD
TAG/v1.1 typofix
$ git rebase master
Kaybolmayan Kod Sorunsali :)
master
typofix
TAG/v1.1
login
HEAD
master
TAG/v1.1
login
HEAD
$ git branch -D typofix
master
typofix
TAG/v1.1
login
HEAD
$ git branch typofix a45f3c
Cimbizla Kod Tirtiklamak
master
HEAD
TAG/v1.1
typofix
master
HEAD
TAG/v1.1
typofix
$ git cherry-pick Green1 Green2
Hatalardan Geri Dönüş
master
HEAD
TAG/v1.1
typofix
master
HEAD
TAG/v1.1
typofix
$ git reset HEAD~2
Commit Graph
commit branch
checkout reset revert
cherry-pick tag
merge rebase stash fetch
LEMİ ORHAN ERGİNMaster Software Craftsman, ACM
/lemiorhan lemiorhanergin.com @lemiorhan