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

Gitting like a Pro

Gitting like a Pro

Git recipes for healthier coding

Stratos Pavlakis

June 13, 2017
Tweet

More Decks by Stratos Pavlakis

Other Decks in Technology

Transcript

  1. GITTING LIKE A PRO
    git recipes for healthier coding

    View Slide

  2. Stratos Pavlakis
    UI Tech Lead @ Workable
    https://github.com/th3hunt
    https://twitter.com/th3hunt
    who is this guy?

    View Slide

  3. Developers agreeing on Git work ow
    Jacques-Louis David, 1796-1799
    Oil on Canvas

    View Slide

  4. No need for such
    drama
    - Git knowledgeable developer

    View Slide

  5. Git Anatomy

    View Slide

  6. $ ls -F1 .git
    HEAD
    config
    description
    hooks/
    info/
    objects/
    refs/

    View Slide

  7. Now the secret to make the
    most out of a tool is ...

    View Slide

  8. to make it accessible!

    View Slide

  9. con guration

    View Slide

  10. # do some less typing
    git config --global alias.co checkout
    git config --global alias.st status
    # shell out if needed
    la=!git config -l | grep alias | cut -c 7-
    # style your output
    log --graph \
    --pretty=format':%C(yellow)%h%C(auto)%d%Creset %Creset%s %C(242)<%an>%Creset'

    View Slide

  11. Git Recipes

    View Slide

  12. KEEP A READABLE HISTORY
    REBASE don't merge
    Fixup
    Autosquash

    View Slide

  13. Programmer nds 1395 con icts after ‘git rebase
    develop’ 3 days before the deadline
    Gustav Courbet, 1844–1845
    Oil paint

    View Slide

  14. ESCAPE GROUNDHOG DAY
    AND KEEP YOUR SANITY
    git rerere
    WTF dude?
    no really... git rerere

    View Slide

  15. FIND THE NEEDLE
    IN THE HAYSTACK
    bisect
    bisect on autopilot

    View Slide

  16. JUMP BETWEEN BRANCHES
    LIKE A PRO
    git worktree add

    View Slide

  17. REVERT A BRANCH
    Find the mainline parent (X)
    git cat- le -p
    Revert the merge commit
    git revert -m X

    View Slide

  18. HARDCORE MAGIC
    lter_branch
    replace

    View Slide

  19. Thank you!
    Questions?

    View Slide