Slide 1

Slide 1 text

Radoslav Stankov 18/10/2018 Improving Your Workflows

Slide 2

Slide 2 text

Radoslav Stankov @rstankov blog.rstankov.com github.com/rstankov
 twitter.com/rstankov

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

= !

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Git: Under the hooh

Slide 19

Slide 19 text

cd .git

Slide 20

Slide 20 text

refs/ objects/ logs/ hooks/ index HEAD config COMMIT_EDITMSG

Slide 21

Slide 21 text

refs/ objects/ logs/ hooks/ index HEAD config COMMIT_EDITMSG

Slide 22

Slide 22 text

"Git just object database + some shell scripts"

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Content

Slide 25

Slide 25 text

Content Type + ' ' + Size + \0 Content

Slide 26

Slide 26 text

Content Type + ' ' + Size + \0 Content SHA1 digest
 bbd51c3fa6ccabc8e3bf955958...

Slide 27

Slide 27 text

Content Type + ' ' + Size + \0 Content SHA1 digest
 bbd51c3fa6ccabc8e3bf955958... .git/objects/bb/d51c3fa6ccabc8e3bf9559cd0af21558995d3f

Slide 28

Slide 28 text

Content Type + ' ' + Size + \0 Content SHA1 digest
 bbd51c3fa6ccabc8e3bf955958... .git/objects/bb/d51c3fa6ccabc8e3bf9559cd0af21558995d3f

Slide 29

Slide 29 text

Content Type + ' ' + Size + \0 Content SHA1 digest
 bbd51c3fa6ccabc8e3bf955958... .git/objects/bb/d51c3fa6ccabc8e3bf9559cd0af21558995d3f

Slide 30

Slide 30 text

bbd51c bbd51c3fa bbd51c3fa6ccab bbd51c3fa6ccabc8e3bf95 bbd51c3fa6ccabc8e3bf9559cd0af21558995d3f 
 .git/objects/bb/d51c3fa6ccabc8e3bf9559cd0af21558995d3f


Slide 31

Slide 31 text

Commit Tree Blob 
 Main Object Types


Slide 32

Slide 32 text

Commit Tree Blob 
 Main Object Types


Slide 33

Slide 33 text


 Blob


Slide 34

Slide 34 text


 Blob
 export function toggleTopicFollow(topicId: number): Dispatchable { return function(dispatch: Dispatch, getState: Function, api: any): void { const { currentUser } = getState(); if (isFollowingTopic(currentUser, id)) { api.topics.followers.delete({ topicId }); dispatch({ type: UNFOLLOW_TOPIC, payload: { topicId } }); } else { api.topics.followers.create({ topicId }); dispatch({ type: FOLLOW_TOPIC, payload: { topicId } }); } }; }

Slide 35

Slide 35 text

Commit Tree Blob 
 Main Object Types


Slide 36

Slide 36 text


 Tree
 client/ server/ README.md

Slide 37

Slide 37 text


 Tree
 Tree Blob (/README.md) Tree (/client/) Tree (/server/)

Slide 38

Slide 38 text

Tree 100644 blob a906cb2a4a904a152e80877d4088654daad0c859 README.md 040000 blob 8f94139338f9404f26296befa88755fc2598c289 client/ 040000 tree 99f1a6d12cb4b6f19c8655fca46c3ecf317074e0 server/ 
 Tree


Slide 39

Slide 39 text

Tree 100644 blob a906cb2a4a904a152e80877d4088654daad0c859 README.md 040000 blob 8f94139338f9404f26296befa88755fc2598c289 client/ 040000 tree 99f1a6d12cb4b6f19c8655fca46c3ecf317074e0 server/ mode 
 Tree


Slide 40

Slide 40 text

Tree 100644 blob a906cb2a4a904a152e80877d4088654daad0c859 README.md 040000 blob 8f94139338f9404f26296befa88755fc2598c289 client/ 040000 tree 99f1a6d12cb4b6f19c8655fca46c3ecf317074e0 server/ 
 Tree


Slide 41

Slide 41 text

Tree 100644 blob a906cb2a4a904a152e80877d4088654daad0c859 README.md 040000 blob 8f94139338f9404f26296befa88755fc2598c289 client/ 040000 tree 99f1a6d12cb4b6f19c8655fca46c3ecf317074e0 server/ type 
 Tree


Slide 42

Slide 42 text

Tree 100644 blob a906cb2a4a904a152e80877d4088654daad0c859 README.md 040000 blob 8f94139338f9404f26296befa88755fc2598c289 client/ 040000 tree 99f1a6d12cb4b6f19c8655fca46c3ecf317074e0 server/ 
 Tree


Slide 43

Slide 43 text

Tree 100644 blob a906cb2a4a904a152e80877d4088654daad0c859 README.md 040000 blob 8f94139338f9404f26296befa88755fc2598c289 client/ 040000 tree 99f1a6d12cb4b6f19c8655fca46c3ecf317074e0 server/ ref 
 Tree


Slide 44

Slide 44 text

Tree 100644 blob a906cb2a4a904a152e80877d4088654daad0c859 README.md 040000 blob 8f94139338f9404f26296befa88755fc2598c289 client/ 040000 tree 99f1a6d12cb4b6f19c8655fca46c3ecf317074e0 server/ 
 Tree


Slide 45

Slide 45 text

Tree 100644 blob a906cb2a4a904a152e80877d4088654daad0c859 README.md 040000 blob 8f94139338f9404f26296befa88755fc2598c289 client/ 040000 tree 99f1a6d12cb4b6f19c8655fca46c3ecf317074e0 server/ name 
 Tree


Slide 46

Slide 46 text

Tree 100644 blob a906cb2a4a904a152e80877d4088654daad0c859 README.md 040000 blob 8f94139338f9404f26296befa88755fc2598c289 client/ 040000 tree 99f1a6d12cb4b6f19c8655fca46c3ecf317074e0 server/ 
 Tree


Slide 47

Slide 47 text

Commit Tree Blob 
 Main Object Types


Slide 48

Slide 48 text


 Commit


Slide 49

Slide 49 text


 Commit
 Tree Blob (/README.md) Tree (/client/) Tree (/server/)

Slide 50

Slide 50 text


 Commit
 Tree Blob (/README.md) Tree (/client/) Tree (/server/)

Slide 51

Slide 51 text


 Commit
 Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit

Slide 52

Slide 52 text


 Commit
 Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit Commit
 (parent)

Slide 53

Slide 53 text

Commit Tree a906cb2a4a904a152e80877d4088654daad0c859 Parent 8f94139338f9404f26296befa88755fc2598c289 Author Radoslav Stankov 123242 Date Sat May 5 18:09:34 2018 -0700 
 Commit


Slide 54

Slide 54 text

Commit Tree Blob 
 Main Object Types


Slide 55

Slide 55 text

Commit Tree Blob 
 Main Object Types


Slide 56

Slide 56 text

Commit Tree Blob 
 Main Object Types


Slide 57

Slide 57 text

Commit Tree Blob 
 Main Object Types


Slide 58

Slide 58 text

Commit Tree Blob 
 Main Object Types


Slide 59

Slide 59 text

Content Type + ' ' + Size + \0 Content SHA1 digest
 bbd51c3fa6ccabc8e3bf955958... .git/objects/bb/d51c3fa6ccabc8e3bf9559cd0af21558995d3f

Slide 60

Slide 60 text

Type + ' ' + Size + \0 Content SHA1 digest
 bbd51c3fa6ccabc8e3bf955958... .git/objects/bb/d51c3fa6ccabc8e3bf9559cd0af21558995d3f Commit Tree Blob

Slide 61

Slide 61 text

Type + ' ' + Size + \0 Content SHA1 digest
 bbd51c3fa6ccabc8e3bf955958... .git/objects/bb/d51c3fa6ccabc8e3bf9559cd0af21558995d3f Commit Tree Blob

Slide 62

Slide 62 text

Commit Tree Blob 
 Main Object Types


Slide 63

Slide 63 text

Commit Tree Blob 
 Main Object Types


Slide 64

Slide 64 text

refs/ objects/ logs/ hooks/ index HEAD config COMMIT_EDITMSG

Slide 65

Slide 65 text

refs/ objects/ logs/ hooks/ index HEAD config COMMIT_EDITMSG

Slide 66

Slide 66 text

"Refs are basically pointers to commit"

Slide 67

Slide 67 text

Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit

Slide 68

Slide 68 text

Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit

Slide 69

Slide 69 text

Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit Ref
 (mater)

Slide 70

Slide 70 text

Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit Ref
 (HEAD) Ref
 (mater)

Slide 71

Slide 71 text

Tag 
 (v1) Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit Ref
 (HEAD) Ref
 (mater)

Slide 72

Slide 72 text

Tag 
 (v1) Ref
 (remote/master) Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit Ref
 (HEAD) Ref
 (mater)

Slide 73

Slide 73 text

Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit Ref
 (mater) Tag 
 (v1) Ref
 (remote/master) Ref
 (HEAD)

Slide 74

Slide 74 text

Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit Ref
 (HEAD) Ref
 (mater)

Slide 75

Slide 75 text

Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit Ref
 (HEAD)

Slide 76

Slide 76 text

Tree Blob (/README.md) Tree (/client/) Tree (/server/) Commit Ref
 (HEAD) Commit Tree Blob (/README.md)

Slide 77

Slide 77 text

Tree Tree (/client/) Tree (/server/) Commit Ref
 (HEAD) Commit Tree Blob (/README.md) Commit Tree

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

git clone git add git commit git status git fetch git push git pull git checkout git branch git log
 git diff 
 Main Git Commands


Slide 80

Slide 80 text


 Main Git Commands
 Remote Local Staging Unstaged

Slide 81

Slide 81 text


 Main Git Commands
 Remote Local Staging Unstaged git add

Slide 82

Slide 82 text


 Main Git Commands
 Remote Local Staging Unstaged git add git commit

Slide 83

Slide 83 text


 Main Git Commands
 Remote Local Staging Unstaged git add git commit git push

Slide 84

Slide 84 text


 Main Git Commands
 Remote Local Staging Unstaged git add git commit git push git pull

Slide 85

Slide 85 text


 Main Git Commands
 Remote Local Staging Unstaged git add git commit git push git pull git checkout

Slide 86

Slide 86 text

refs/ objects/ logs/ hooks/ index HEAD config COMMIT_EDITMSG

Slide 87

Slide 87 text

Merge Rebase

Slide 88

Slide 88 text

Master Commit M1

Slide 89

Slide 89 text

Master Commit M1 Commit M2 Commit M3

Slide 90

Slide 90 text

Master Branch Commit M1 Commit M2 Commit M3

Slide 91

Slide 91 text

Master Branch Commit M1 Commit M2 Commit M3 Commit M4

Slide 92

Slide 92 text

Master Branch Commit M1 Commit M2 Commit M3 Commit M4 Commit B1

Slide 93

Slide 93 text

Master Branch Commit M1 Commit M2 Commit M3 Commit M4 Commit B1 Commit B2 Commit B3 Commit B4

Slide 94

Slide 94 text

Master Branch Commit M1 Commit M2 Commit M3 Commit M4 Commit M5 Commit M6 Commit B1 Commit B2 Commit B3 Commit B4

Slide 95

Slide 95 text


 git merge [branch]
 Master Branch Commit M1 Commit M2 Commit M3 Commit M4 Commit M5 Commit M6 Merge Commit Commit B1 Commit B2 Commit B3 Commit B4

Slide 96

Slide 96 text

Master Branch Commit M1 Commit M2 Commit M3 Commit M4 Commit M5 Commit M6 Commit B1 Commit B2 Commit B3 Commit B4 
 git rebase master [branch]


Slide 97

Slide 97 text

Branch Master Commit M1 Commit M2 Commit M3 Commit M4 Commit M5 Commit M6 Commit B1 Commit B2 Commit B3 Commit B4 
 git rebase master [branch]


Slide 98

Slide 98 text

Branch Master Commit M5 Commit M6 Commit B1 Commit B2 Commit B3 Commit B4 
 git rebase master [branch]


Slide 99

Slide 99 text

Branch Master Commit M5 Commit M6 Commit B1 Commit B2 Commit B3 Commit B4 
 git rebase master [branch]


Slide 100

Slide 100 text

Branch Master Commit M5 Commit M6 Commit B1x Commit B2 Commit B3 Commit B4 
 git rebase master [branch]


Slide 101

Slide 101 text

Branch Master Commit M5 Commit M6 Commit B1x Commit B2x Commit B3x Commit B4x 
 git rebase master [branch]


Slide 102

Slide 102 text

Branch Master Commit M5 Commit M6 Commit B1x Commit B2x Commit B3x Commit B4x 
 git merge [branch] 


Slide 103

Slide 103 text

Improve your tools

Slide 104

Slide 104 text

~/.gitconfig

Slide 105

Slide 105 text

[alias] st = status br = branch co = checkout 
 https://github.com/RStankov/config_files/blob/master/dot/gitconfig


Slide 106

Slide 106 text

[alias] stahs = stash puhs = push hsow = show 
 https://github.com/RStankov/config_files/blob/master/dot/gitconfig


Slide 107

Slide 107 text

[alias] stahs = stash puhs = push hsow = show 
 https://github.com/RStankov/config_files/blob/master/dot/gitconfig
 "

Slide 108

Slide 108 text

alias ga="git add -A" alias gp="git pull --rebase" alias grc="git add .; git rebase --continue" alias gr="git rebase -i" alias gs="git stash" alias gco="git checkout" alias gl="git lol" alias gd="git diff" alias gdc="git diff --cached" alias gst="git status" 
 https://github.com/RStankov/config_files/blob/master/dot/zsh/aliases


Slide 109

Slide 109 text

[alias] ls = ls-files undo = reset --soft HEAD^ amend = commit --amend unstage = reset HEAD 
 https://github.com/RStankov/config_files/blob/master/dot/gitconfig


Slide 110

Slide 110 text

[alias] lol = log --graph --decorate -- pretty='format:%C(yellow)%h%Cgreen%d%Creset %s %C(white) (%an, %ar)%Creset' --abbrev- commit today = log --stat --since='1 Day Ago' -- graph --pretty=oneline --abbrev-commit -- date=relative 
 https://github.com/RStankov/config_files/blob/master/dot/gitconfig


Slide 111

Slide 111 text


 git lol


Slide 112

Slide 112 text


 git today


Slide 113

Slide 113 text

~/bin/git-***

Slide 114

Slide 114 text

~/bin/git-pull-request

Slide 115

Slide 115 text


 https://github.com/RStankov/config_files/blob/master/bin/git-pull-request
 #!/bin/bash current_branch=`git rev-parse --abbrev-ref HEAD` remote_url=`git remote get-url origin | awk '{gsub(/ [email protected]:/,"")}1' | awk '{gsub(/\.git/,"")}1'` git push origin $current_branch --set-upstream open https://github.com/$remote_url/compare/$current_branch 
 git pull-request


Slide 116

Slide 116 text

~/bin/rebase-on-master

Slide 117

Slide 117 text


 https://github.com/RStankov/config_files/blob/master/bin/git-rebase-on-master
 #!/bin/bash current_branch=`git rev-parse --abbrev-ref HEAD` git checkout master git pull origin master --rebase git rebase master $current_branch 
 git rebase-on-master


Slide 118

Slide 118 text

~/bin/delete-merged

Slide 119

Slide 119 text


 https://github.com/RStankov/config_files/blob/master/bin/git-delete-merged
 #!/bin/bash current_branch=`git rev-parse --abbrev-ref HEAD` git checkout master git pull origin master --rebase git rebase master $current_branch 
 git delete-merged


Slide 120

Slide 120 text

GUI

Slide 121

Slide 121 text


 Fork
 
 https://git-fork.com


Slide 122

Slide 122 text


 https://git-fork.com


Slide 123

Slide 123 text

"I only use Git GUI to stage files to commits and amending previous commits"

Slide 124

Slide 124 text


 https://git-fork.com


Slide 125

Slide 125 text


 https://git-fork.com


Slide 126

Slide 126 text

No content

Slide 127

Slide 127 text

Thanks #