Slide 1

Slide 1 text

GIT İPUÇLARI G Ü N D E L İ K H A Y A T T A Uğur “vigo” Özyılmazel

Slide 2

Slide 2 text

HELP

Slide 3

Slide 3 text

git help -a

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

git help -g

Slide 6

Slide 6 text

git help attributes everyday glossary ignore modules revisions tutorial workflows

Slide 7

Slide 7 text

TAG

Slide 8

Slide 8 text

git tag v0.0.1

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

git tag

Slide 11

Slide 11 text

git ls-remote --tags

Slide 12

Slide 12 text

git describe

Slide 13

Slide 13 text

git describe HEAD

Slide 14

Slide 14 text

* 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

Slide 15

Slide 15 text

* 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

Slide 16

Slide 16 text

git describe HEAD@{1.week.ago}

Slide 17

Slide 17 text

REVİZYON

Slide 18

Slide 18 text

git show

Slide 19

Slide 19 text

git show HEAD

Slide 20

Slide 20 text

git show 023ee17

Slide 21

Slide 21 text

git show v2.1.5

Slide 22

Slide 22 text

git show feature/1

Slide 23

Slide 23 text

git show eafcd77^1

Slide 24

Slide 24 text

git show eafcd77~2

Slide 25

Slide 25 text

git show master@{yesterday}

Slide 26

Slide 26 text

git show master@{1.minute.ago}

Slide 27

Slide 27 text

git show :/kelime

Slide 28

Slide 28 text

git checkout -

Slide 29

Slide 29 text

git branch --merged

Slide 30

Slide 30 text

git branch --no-merged

Slide 31

Slide 31 text

git branch
 --contains :/kelime

Slide 32

Slide 32 text

BUNDLE

Slide 33

Slide 33 text

git bundle create ~/project.bundle master

Slide 34

Slide 34 text

git ls-remote
 ~/project.bundle

Slide 35

Slide 35 text

ae3cc4b38c2a3b737a87 3397c1c086b30bf9d1c5 refs/heads/master

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

* 40f6f9b (HEAD -> master) friend added 2 files * ae3cc4b (origin/master) 2 files added * 465fea2 Initial commit

Slide 38

Slide 38 text

git log --oneline master ^origin/master

Slide 39

Slide 39 text

40f6f9b friend added 2 files

Slide 40

Slide 40 text

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

Slide 41

Slide 41 text

cd repo/ git bundle verify
 ~/friends.bundle

Slide 42

Slide 42 text

The bundle contains this ref: 40f6f9b757c0a21cc9496689a3db11382831f345 refs/heads/master The bundle requires this ref: ae3cc4b38c2a3b737a873397c1c086b30bf9d1c5 ~/friends.bundle is okay

Slide 43

Slide 43 text

git fetch
 ~/friends.bundle master:friends-master

Slide 44

Slide 44 text

git log --graph
 --decorate --oneline
 --all

Slide 45

Slide 45 text

* 40f6f9b (friends-master) friend added 2 files * ae3cc4b (HEAD -> master) 2 files added * 465fea2 Initial commit

Slide 46

Slide 46 text

REMOTE

Slide 47

Slide 47 text

git branch -av

Slide 48

Slide 48 text

git remote update origin

Slide 49

Slide 49 text

git remote update origin
 --prune

Slide 50

Slide 50 text

TRACKING

Slide 51

Slide 51 text

git checkout
 -b BRANCH origin/BRANCH

Slide 52

Slide 52 text

git checkout
 -t origin/BRANCH

Slide 53

Slide 53 text

git push -u REMOTE BRANCH

Slide 54

Slide 54 text

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

Slide 55

Slide 55 text

HISTORY

Slide 56

Slide 56 text

git commit --allow- empty

Slide 57

Slide 57 text

git commit --amend

Slide 58

Slide 58 text

git commit --amend --no-edit

Slide 59

Slide 59 text

REBASING

Slide 60

Slide 60 text

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

Slide 61

Slide 61 text

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

Slide 62

Slide 62 text

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

Slide 63

Slide 63 text

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

Slide 64

Slide 64 text

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

Slide 65

Slide 65 text

git checkout master

Slide 66

Slide 66 text

git rebase BRANCH

Slide 67

Slide 67 text

git rebase -i @{u}

Slide 68

Slide 68 text

SQUASH

Slide 69

Slide 69 text

git rebase -i

Slide 70

Slide 70 text

* 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

Slide 71

Slide 71 text

* 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

Slide 72

Slide 72 text

git rebase -i dcb8071

Slide 73

Slide 73 text

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

Slide 74

Slide 74 text

# 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 #

Slide 75

Slide 75 text

917b8ea README file updated dcb8071 JSON service3 file added - amend bb2f23b JSON service2 file added 2911c52 JSON service file added

Slide 76

Slide 76 text

git reset --soft HEAD~3

Slide 77

Slide 77 text

SPLIT

Slide 78

Slide 78 text

* c2109ee (HEAD -> master) did many things * 3c7b147 file2 added * c502494 file1 added * 41b8cc1 init

Slide 79

Slide 79 text

git rebase -i HEAD^

Slide 80

Slide 80 text

pick c2109ee did many things

Slide 81

Slide 81 text

edit c2109ee did many things

Slide 82

Slide 82 text

git reset HEAD^

Slide 83

Slide 83 text

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 ..." 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)

Slide 84

Slide 84 text

git add test_file1 test_file2

Slide 85

Slide 85 text

git commit -m "test_file1 and test_file2 added"

Slide 86

Slide 86 text

git add test_file3 test_file4

Slide 87

Slide 87 text

git commit -m "test_file3 and test_file4 added"

Slide 88

Slide 88 text

git rebase --continue

Slide 89

Slide 89 text

* 82d30b2 (HEAD -> master) test_file3 and test_file4 added * ed68764 test_file1 and test_file2 added * 3c7b147 file2 added * c502494 file1 added * 41b8cc1 init

Slide 90

Slide 90 text

* c2109ee (HEAD -> master) did many things * 3c7b147 file2 added * c502494 file1 added * 41b8cc1 init

Slide 91

Slide 91 text

LOG

Slide 92

Slide 92 text

git log --graph
 --decorate --oneline --all

Slide 93

Slide 93 text

* 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

Slide 94

Slide 94 text

git notes edit SHA

Slide 95

Slide 95 text

git notes show SHA

Slide 96

Slide 96 text

git notes show HEAD

Slide 97

Slide 97 text

commit dcb807137280386cdc1d38e2327656d1c088124c Author: Uğur Özyılmazel Date: Tue Jul 14 13:41:39 2015 +0300 JSON service3 file added - amend Notes: Bu bir test notudur!

Slide 98

Slide 98 text

REFLOG

Slide 99

Slide 99 text

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

Slide 100

Slide 100 text

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

Slide 101

Slide 101 text

git reset --hard 3c7b147

Slide 102

Slide 102 text

git reset --hard HEAD@{7}

Slide 103

Slide 103 text

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

Slide 104

Slide 104 text

COMMIT

Slide 105

Slide 105 text

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

Slide 106

Slide 106 text

PATCH

Slide 107

Slide 107 text

git add -p

Slide 108

Slide 108 text

$ 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,?]?

Slide 109

Slide 109 text

BISECT

Slide 110

Slide 110 text

git bisect start

Slide 111

Slide 111 text

* 82d30b2 (HEAD -> master) test_file3 and test_file4 added * ed68764 test_file1 and test_file2 added * 3c7b147 file2 added * c502494 file1 added * 41b8cc1 init

Slide 112

Slide 112 text

git bisect bad

Slide 113

Slide 113 text

* 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

Slide 114

Slide 114 text

git checkout 3c7b147

Slide 115

Slide 115 text

git bisect good

Slide 116

Slide 116 text

Bisecting: 0 revisions left to test after this (roughly 0 steps) [ed68764cd0098bf143248e8d293d6c1a0ac2d848] test_file1 and test_file2 added

Slide 117

Slide 117 text

* 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

Slide 118

Slide 118 text

git bisect reset

Slide 119

Slide 119 text

TÜYOLAR

Slide 120

Slide 120 text

git diff --word-diff

Slide 121

Slide 121 text

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

Slide 122

Slide 122 text

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

Slide 123

Slide 123 text

git status -sb

Slide 124

Slide 124 text

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

Slide 125

Slide 125 text

git config --global pull.rebase true

Slide 126

Slide 126 text

git config --global push.default tracking

Slide 127

Slide 127 text

git config --global rerere.enabled true

Slide 128

Slide 128 text

git instaweb

Slide 129

Slide 129 text

git instaweb start

Slide 130

Slide 130 text

No content

Slide 131

Slide 131 text

git instaweb stop

Slide 132

Slide 132 text

KONFİGÜRASYON

Slide 133

Slide 133 text

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

Slide 134

Slide 134 text

git config --global

Slide 135

Slide 135 text

git config --system

Slide 136

Slide 136 text

git config --local

Slide 137

Slide 137 text

KaynAKLAR

Slide 138

Slide 138 text

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

Slide 139

Slide 139 text

TEŞEKKÜRLER vigobronx vigo