Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git Workflows

Git Workflows

Radoslav Stankov

October 19, 2018
Tweet

More Decks by Radoslav Stankov

Other Decks in Technology

Transcript

  1. = !

  2. Content Type + ' ' + Size + \0 Content

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

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

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

    SHA1 digest
 bbd51c3fa6ccabc8e3bf955958... .git/objects/bb/d51c3fa6ccabc8e3bf9559cd0af21558995d3f
  6. 
 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 } }); } }; }
  7. Content Type + ' ' + Size + \0 Content

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

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

    digest
 bbd51c3fa6ccabc8e3bf955958... .git/objects/bb/d51c3fa6ccabc8e3bf9559cd0af21558995d3f Commit Tree Blob
  10. Tag 
 (v1) Ref
 (remote/master) Tree Blob (/README.md) Tree (/client/)

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

    Tag 
 (v1) Ref
 (remote/master) Ref
 (HEAD)
  12. 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

  13. 
 Main Git Commands
 Remote Local Staging Unstaged git add

    git commit git push git pull git checkout
  14. Master Branch Commit M1 Commit M2 Commit M3 Commit M4

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

    Commit M5 Commit M6 Commit B1 Commit B2 Commit B3 Commit B4
  16. 
 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
  17. 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]

  18. 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]

  19. Branch Master Commit M5 Commit M6 Commit B1 Commit B2

    Commit B3 Commit B4 
 git rebase master [branch]

  20. Branch Master Commit M5 Commit M6 Commit B1 Commit B2

    Commit B3 Commit B4 
 git rebase master [branch]

  21. Branch Master Commit M5 Commit M6 Commit B1x Commit B2

    Commit B3 Commit B4 
 git rebase master [branch]

  22. Branch Master Commit M5 Commit M6 Commit B1x Commit B2x

    Commit B3x Commit B4x 
 git rebase master [branch]

  23. Branch Master Commit M5 Commit M6 Commit B1x Commit B2x

    Commit B3x Commit B4x 
 git merge [branch] 

  24. [alias] st = status br = branch co = checkout

    
 https://github.com/RStankov/config_files/blob/master/dot/gitconfig

  25. [alias] stahs = stash puhs = push hsow = show

    
 https://github.com/RStankov/config_files/blob/master/dot/gitconfig

  26. [alias] stahs = stash puhs = push hsow = show

    
 https://github.com/RStankov/config_files/blob/master/dot/gitconfig
 "
  27. 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

  28. [alias] ls = ls-files undo = reset --soft HEAD^ amend

    = commit --amend unstage = reset HEAD 
 https://github.com/RStankov/config_files/blob/master/dot/gitconfig

  29. [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

  30. 
 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

  31. GUI

  32. "I only use Git GUI to stage files to commits

    and amending previous commits"