29/11/2021

Git -3

Branching

Dallandırma aşağıda ki gibi yapılır ve dal listesi -a ile görüntülenir.

PS C:\Users\can\git\first_repo> git branch verzweigung1
PS C:\Users\can\git\first_repo> git branch -a
* master
  verzweigung1

Hızlı branch oluşturma ve oraya geçme

PS C:\Users\can\git\first_repo> git checkout -b verzweigung2
Switched to a new branch 'verzweigung2'

dallar arasında geçiş için

PS C:\Users\can\git\first_repo> git checkout verzweigung1
Switched to branch 'verzweigung1'

şimdi bu dalda bir dosya oluşturup onu commit edelim.

PS C:\Users\can\git\first_repo> git add test3.txt
PS C:\Users\can\git\first_repo> git status
On branch verzweigung1
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   test3.txt

PS C:\Users\can\git\first_repo> git commit -a -m "test3 olusturuldu"
[verzweigung1 b69447d] test3 olusturuldu
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test3.txt

şimdi branch değiştirip Master a geri dönersek oluşturduğumuz dosya orada olmayacaktır. çünkü o branchte dosya oluşturulmadı.

Branch silme

Branchleri listeleyelim.

PS C:\Users\can\git\first_repo> git branch -a
  master
  verzweigung1
* verzweigung2

Şimdi ilk dalı silelim.

S C:\Users\can\git\first_repo> git branch -d verzweigung1
error: The branch 'verzweigung1' is not fully merged.
If you are sure you want to delete it, run 'git branch -D verzweigung1'.

Silemedik. Hata verdi silmek için büyük D kullanmalıyız (force gibi)

PS C:\Users\can\git\first_repo> git branch -D verzweigung1
Deleted branch verzweigung1 (was b69447d).

MERGE

Hangisi ana branch olacaksa önce ona gidiyoruz. !!!!!!

PS C:\Users\can\git\first_repo> git checkout master
Switched to branch 'master'

sonra hangi branch , ona birleştireceksek merge komutu ile birleştiriyoruz.

PS C:\Users\can\git\first_repo> git merge verzweigung2
Updating 2cc0f8b..8086e35
Fast-forward
 test31.txt | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test31.txt
PS C:\Users\can\git\first_repo> git log --oneline
8086e35 (HEAD -> master, verzweigung2) test31 olusturuldu
2cc0f8b yessss
748564a Revert "commit 5"
6f22157 Revert "commit 6"
b90c20f commit 6
9178e52 Revert "commit 2"
be10291 commit 5
71e0210 ater soft reset
b2b7125 commit 2
e5c0fdc ilk commit

Leave a Reply