Gündelik Hayatta GIT İpuçları

Gündelik Hayatta GIT İpuçları

Phpkonf 2015'te yaptığım sunum.
http://phpkonf.org/

033485f7e18823d4ccabb24e5cb4935f?s=128

Uğur Özyılmazel

July 26, 2015
Tweet

Transcript

  1. GIT İPUÇLARI G Ü N D E L İ K

    H A Y A T T A Uğur “vigo” Özyılmazel
  2. HELP

  3. git help -a

  4. add add--interactive am annotate apply archive bisect bisect--helper blame branch

    bundle cat-file check-attr check-ignore check-mailmap check-ref-format checkout checkout-index cherry cherry-pick clean clone column commit commit-tree config count-objects credential credential-cache credential-cache--daemon credential-store daemon describe diff diff-files diff-index diff-tree difftool difftool--helper fast-export fast-import fetch fetch-pack filter-branch fmt-merge-msg for-each-ref format-patch fsck fsck-objects gc get-tar-commit-id grep hash-object help http-backend http-fetch http-push imap-send index-pack init init-db instaweb log ls-files ls-remote ls-tree mailinfo mailsplit merge merge-base merge-file merge-index merge-octopus merge-one-file merge-ours merge-recursive merge-resolve merge-subtree merge-tree mergetool mktag mktree mv name-rev notes pack-objects pack-redundant pack-refs patch-id prune prune-packed pull push quiltimport read-tree rebase receive-pack reflog relink remote remote-ext remote-fd remote-ftp remote-ftps remote-http remote-https remote-testsvn repack replace request-pull rerere reset rev-list rev-parse revert rm send-pack sh-i18n--envsubst shell shortlog show show-branch show-index show-ref stage stash status stripspace submodule subtree symbolic-ref tag unpack-file unpack-objects update-index update-ref update-server-info upload-archive upload-pack var verify-commit verify-pack verify-tag web--browse whatchanged write-tree 146+ KOMUT
  5. git help -g

  6. git help attributes everyday glossary ignore modules revisions tutorial workflows

  7. TAG

  8. git tag v0.0.1

  9. git tag -a v0.0.1 -m "İlk versiyon"

  10. git tag

  11. git ls-remote --tags

  12. git describe

  13. git describe HEAD

  14. * 6006b9c (feature/1a) feature1a added * 26447ed (HEAD -> master)

    JSON service3 file added * 241004e JSON service2 file added * eafcd77 JSON service file added | * 3d118d6 (feature/1) feature1 added |/ * 023ee17 (tag: v0.0.2) "Hello World" string added to index.html * 45e83cb (tag: v0.0.1) Rakefile added for automated tasks * c5bb57d HTML index file added * 7b87937 JS index file added * 4cbb412 RUBY application file added * 1d034b5 PYTHON source file added * ef7d3f5 PHP index file added * fb52add Initial commit v0.0.2-3-g26447ed
  15. * 6006b9c (feature/1a) feature1a added * 26447ed (HEAD -> master)

    JSON service3 file added * 241004e (1) JSON service2 file added * eafcd77 (2) JSON service file added | * 3d118d6 (feature/1) feature1 added |/ * 023ee17 (3) (tag: v0.0.2) "Hello World" string added to index.html * 45e83cb (tag: v0.0.1) Rakefile added for automated tasks * c5bb57d HTML index file added * 7b87937 JS index file added * 4cbb412 RUBY application file added * 1d034b5 PYTHON source file added * ef7d3f5 PHP index file added v0.0.2-3-g26447ed
  16. git describe HEAD@{1.week.ago}

  17. REVİZYON

  18. git show

  19. git show HEAD

  20. git show 023ee17

  21. git show v2.1.5

  22. git show feature/1

  23. git show eafcd77^1

  24. git show eafcd77~2

  25. git show master@{yesterday}

  26. git show master@{1.minute.ago}

  27. git show :/kelime

  28. git checkout -

  29. git branch --merged

  30. git branch --no-merged

  31. git branch
 --contains :/kelime

  32. BUNDLE

  33. git bundle create ~/project.bundle master

  34. git ls-remote
 ~/project.bundle

  35. ae3cc4b38c2a3b737a87 3397c1c086b30bf9d1c5 refs/heads/master

  36. git clone ~/ project.bundle -b master friends-repo

  37. * 40f6f9b (HEAD -> master) friend added 2 files *

    ae3cc4b (origin/master) 2 files added * 465fea2 Initial commit
  38. git log --oneline master ^origin/master

  39. 40f6f9b friend added 2 files

  40. git bundle create
 ~/friends.bundle master ^origin/master

  41. cd repo/ git bundle verify
 ~/friends.bundle

  42. The bundle contains this ref: 40f6f9b757c0a21cc9496689a3db11382831f345 refs/heads/master The bundle requires

    this ref: ae3cc4b38c2a3b737a873397c1c086b30bf9d1c5 ~/friends.bundle is okay
  43. git fetch
 ~/friends.bundle master:friends-master

  44. git log --graph
 --decorate --oneline
 --all

  45. * 40f6f9b (friends-master) friend added 2 files * ae3cc4b (HEAD

    -> master) 2 files added * 465fea2 Initial commit
  46. REMOTE

  47. git branch -av

  48. git remote update origin

  49. git remote update origin
 --prune

  50. TRACKING

  51. git checkout
 -b BRANCH origin/BRANCH

  52. git checkout
 -t origin/BRANCH

  53. git push -u REMOTE BRANCH

  54. git branch --set-upstream- to=REMOTE/BRANCH BRANCH

  55. HISTORY

  56. git commit --allow- empty

  57. git commit --amend

  58. git commit --amend --no-edit

  59. REBASING

  60. * ca3fdfe (HEAD -> master) file6 added | * 6e5c748

    (feature) file5 added | * 29a8cf0 file4 added |/ * fdadf1f file3 added * 941b2e4 file2 added * 089ee87 file1 added * 61bd5c1 Initial commit
  61. 089ee87 941b2e4 fdadf1f ca3fdfe 29a8cf0 6e5c748 feature HEAD -> master

  62. 941b2e4 089ee87 fdadf1f ca3fdfe HEAD -> master 29a8cf0 6e5c748 feature

  63. 941b2e4 089ee87 fdadf1f ca3fdfe HEAD -> master 29a8cf0 6e5c748 feature

  64. * c035db3 (HEAD -> master) file6 added * 6e5c748 (feature)

    file5 added * 29a8cf0 file4 added * fdadf1f file3 added * 941b2e4 file2 added * 089ee87 file1 added * 61bd5c1 Initial commit
  65. git checkout master

  66. git rebase BRANCH

  67. git rebase -i @{u}

  68. SQUASH

  69. git rebase -i

  70. * 7d0bc97 Added yet another missing text to README *

    4ff7ba1 Added another missing text to README * 31f1560 Added missing text to README * dcb8071 JSON service3 file added - amend * bb2f23b JSON service2 file added * 2911c52 JSON service file added
  71. * 7d0bc97 Added yet another missing text to README *

    4ff7ba1 Added another missing text to README * 31f1560 Added missing text to README * dcb8071 JSON service3 file added - amend * bb2f23b JSON service2 file added * 2911c52 JSON service file added
  72. git rebase -i dcb8071

  73. pick 31f1560 Added missing text to README pick 4ff7ba1 Added

    another missing text to README pick 7d0bc97 Added yet another missing text to README pick 31f1560 Added missing text to README squash 4ff7ba1 Added another missing text to README squash 7d0bc97 Added yet another missing text to README
  74. # This is a combination of 3 commits. # The

    first commit's message is: Added missing text to README # This is the 2nd commit message: Added another missing text to README # This is the 3rd commit message: Added yet another missing text to README # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Date: Wed Jul 15 09:05:25 2015 +0300 # # rebase in progress; onto dcb8071 # You are currently editing a commit while rebasing branch 'master' on 'dcb8071'. # # Changes to be committed: # modified: README.md #
  75. 917b8ea README file updated dcb8071 JSON service3 file added -

    amend bb2f23b JSON service2 file added 2911c52 JSON service file added
  76. git reset --soft HEAD~3

  77. SPLIT

  78. * c2109ee (HEAD -> master) did many things * 3c7b147

    file2 added * c502494 file1 added * 41b8cc1 init
  79. git rebase -i HEAD^

  80. pick c2109ee did many things

  81. edit c2109ee did many things

  82. git reset HEAD^

  83. rebase in progress; onto 3c7b147 You are currently editing a

    commit while rebasing branch 'master' on '3c7b147'. (use "git commit --amend" to amend the current commit) (use "git rebase --continue" once you are satisfied with your changes) Untracked files: (use "git add <file>..." to include in what will be committed) test_file1 test_file2 test_file3 test_file4 nothing added to commit but untracked files present (use "git add" to track)
  84. git add test_file1 test_file2

  85. git commit -m "test_file1 and test_file2 added"

  86. git add test_file3 test_file4

  87. git commit -m "test_file3 and test_file4 added"

  88. git rebase --continue

  89. * 82d30b2 (HEAD -> master) test_file3 and test_file4 added *

    ed68764 test_file1 and test_file2 added * 3c7b147 file2 added * c502494 file1 added * 41b8cc1 init
  90. * c2109ee (HEAD -> master) did many things * 3c7b147

    file2 added * c502494 file1 added * 41b8cc1 init
  91. LOG

  92. git log --graph
 --decorate --oneline --all

  93. * 83d0d2d (HEAD -> master, origin/master, origin/HEAD) added what_is_my_public_ip alias

    for showing public ip address * d485193 Docker IP support for PS1 * 4d9679d gentoo specific fixes * 9a4b867 Merge branch 'master' of github.com:vigo/dotfiles-universal |\ | * 09b9f6d mysql prompt fixed * | 13dbcc5 nano 2.4.2 support |/ * 91a3a86 virtualenv prompt fix: display django version info if django exists * cd1990b mysql.server status indicator for PS1 * f3f39fe Screen shot updated * 5af3b2f AirDrop / Ethernet hack added to osx tweaks * 60c916e Merge branch 'master' of github.com:vigo/dotfiles-universal |\ | * 60bedb1 nano version 2.4.1 for nanorc * | b84ba0b ctags files are ignored |/ * 2a434d6 virtualenv, python and django version info for prompt * ae39932 bash-completion for django: manage.py and django-admin.py
  94. git notes edit SHA

  95. git notes show SHA

  96. git notes show HEAD

  97. commit dcb807137280386cdc1d38e2327656d1c088124c Author: Uğur Özyılmazel <ugurozyilmazel@gmail.com> Date: Tue Jul 14

    13:41:39 2015 +0300 JSON service3 file added - amend Notes: Bu bir test notudur!
  98. REFLOG

  99. 8670327 HEAD@{0}: checkout: moving from master to feature2 8670327 HEAD@{1}:

    cherry-pick: file2-a added 3c7b147 HEAD@{2}: checkout: moving from feature to master af2a355 HEAD@{3}: commit: file2-a added 3c7b147 HEAD@{4}: checkout: moving from master to feature 3c7b147 HEAD@{5}: commit: file2 added c502494 HEAD@{6}: commit: file1 added 41b8cc1 HEAD@{7}: commit (initial): init
  100. 8670327 HEAD@{0}: checkout: moving from master to feature2 8670327 HEAD@{1}:

    cherry-pick: file2-a added 3c7b147 HEAD@{2}: checkout: moving from feature to master af2a355 HEAD@{3}: commit: file2-a added 3c7b147 HEAD@{4}: checkout: moving from master to feature 3c7b147 HEAD@{5}: commit: file2 added c502494 HEAD@{6}: commit: file1 added 41b8cc1 HEAD@{7}: commit (initial): init
  101. git reset --hard 3c7b147

  102. git reset --hard HEAD@{7}

  103. 3c7b147 HEAD@{0}: reset: moving to 3c7b147 8670327 HEAD@{1}: checkout: moving

    from 3c7b14747431c36db72775d00db2e76e8775ba47 to master 3c7b147 HEAD@{2}: checkout: moving from feature2 to 3c7b147 8670327 HEAD@{3}: checkout: moving from master to feature2 8670327 HEAD@{4}: cherry-pick: file2-a added 3c7b147 HEAD@{5}: checkout: moving from feature to master af2a355 HEAD@{6}: commit: file2-a added 3c7b147 HEAD@{7}: checkout: moving from master to feature 3c7b147 HEAD@{8}: commit: file2 added c502494 HEAD@{9}: commit: file1 added 41b8cc1 HEAD@{10}: commit (initial): init
  104. COMMIT

  105. Kısa açıklama maksimum 50 karakterden oluşmalı Daha detaylı açıklamalar paragraflar

    halinde uzun uzun yazılabilir ve 72 karakter boyunda satırlardan oluşması önerilmektedir. Örneğin GitHub, commit mesajının title'i yani başlığı olarak ilk satırı göstermektedir. Paragraflar arasında 1 satır boşluk bırakılması önerilir. - Bullet list ya da liste şekli - Yine birer satır aralık verilmesi önerilir. * Çizgi / Dash yerine yıldız da kullanılabilir
  106. PATCH

  107. git add -p

  108. $ git add -p diff --git a/file1 b/file1 index 70177a7..2d2e1d1

    100644 --- a/file1 +++ b/file1 @@ -1,2 +1,4 @@ Hello World Hello World as second line +Hello World as 3rd line +Hello World as 4th line Stage this hunk [y,n,q,a,d,/,e,?]? ? y - stage this hunk n - do not stage this hunk q - quit; do not stage this hunk or any of the remaining ones a - stage this hunk and all later hunks in the file d - do not stage this hunk or any of the later hunks in the file g - select a hunk to go to / - search for a hunk matching the given regex j - leave this hunk undecided, see next undecided hunk J - leave this hunk undecided, see next hunk k - leave this hunk undecided, see previous undecided hunk K - leave this hunk undecided, see previous hunk s - split the current hunk into smaller hunks e - manually edit the current hunk ? - print help @@ -1,2 +1,4 @@ Hello World Hello World as second line +Hello World as 3rd line +Hello World as 4th line Stage this hunk [y,n,q,a,d,/,e,?]?
  109. BISECT

  110. git bisect start

  111. * 82d30b2 (HEAD -> master) test_file3 and test_file4 added *

    ed68764 test_file1 and test_file2 added * 3c7b147 file2 added * c502494 file1 added * 41b8cc1 init
  112. git bisect bad

  113. * 82d30b2 (HEAD -> master, refs/bisect/bad) test_file3 and test_file4 added

    * ed68764 test_file1 and test_file2 added * 3c7b147 file2 added * c502494 file1 added * 41b8cc1 init
  114. git checkout 3c7b147

  115. git bisect good

  116. Bisecting: 0 revisions left to test after this (roughly 0

    steps) [ed68764cd0098bf143248e8d293d6c1a0ac2d848] test_file1 and test_file2 added
  117. * 82d30b2 (master, refs/bisect/bad) test_file3 and test_file4 added * ed68764

    (HEAD) test_file1 and test_file2 added * 3c7b147 (refs/bisect/good-3c7b14747431c36db72775d00db2e76e8775ba47) file2 added * c502494 file1 added * 41b8cc1 init
  118. git bisect reset

  119. TÜYOLAR

  120. git diff --word-diff

  121. diff --git a/file2 b/file2 index e69de29..3b18e51 100644 --- a/file2 +++

    b/file2 @@ -0,0 +1 @@ +hello world
  122. diff --git a/file2 b/file2 index e69de29..3b18e51 100644 --- a/file2 +++

    b/file2 @@ -0,0 +1 @@ {+hello world+}
  123. git status -sb

  124. ## master M file1 A file3 AM file4 ?? file5

  125. git config --global pull.rebase true

  126. git config --global push.default tracking

  127. git config --global rerere.enabled true

  128. git instaweb

  129. git instaweb start

  130. None
  131. git instaweb stop

  132. KONFİGÜRASYON

  133. /etc/gitconfig
 Sistem --system
 ~/.gitconfig
 Kullanıcı --global
 
 $GIT_DIR/config Proje --local

  134. git config --global

  135. git config --system

  136. git config --local

  137. KaynAKLAR

  138. https://github.com/mislav https://github.com/schacon https://github.com/singingwolfboy http://vigo.github.io/git-tips/ ♥

  139. TEŞEKKÜRLER vigobronx vigo