Leveling Up Your git Workflow

Code4Lib 2015

Megan Kudzia

Kate Sears

Albion College Library

We git, and so can you

  • How and why we started
  • Biggest mistakes
  • Things we did right
  • Things we did wrong
  • Cleanup
  • Other thoughts

Why and how we started using git

  • We wanted:
    • A better code approval process
    • Access to our code from anywhere
    • To learn new things on an 'easy' project
  • Megan started a repo in late spring
  • Added Kate when she got back in the fall

Defining the scope

  • Website redesign
  • Wordpress child theme
  • Incorporated LESS CSS
  • Start a fresh project with git!

What went wrong

Conceptually

  • We looked for an easy way through
  • Workflow/terminology confusion

Specifically

  • Creating a branch and not checking it out
  • Not waiting for the GUI to refresh properly after changes
  • Sourcetree? GitK? Command line? What?

Things Kate did right/wrong

Right

  • Made lots of commits, useful messages
  • Shared work space and hours, so it was easy to address problems quickly
  • Made heavy use of white boards and diagramming

Wrong

  • Used distracting git GUI
  • Our reaction to mistakes was to try again

Things Megan did right/wrong

Right

  • Decided the best way to learn was to jump in
  • Found a more-advanced buddy

Wrong

  • Used distracting git GUI
  • See Kate re:reaction to mistakes
  • Made commits & decisions while tired, cranky
  • Clung to the idea that git is easy

Brainstorming: yikes

Our initial workflow

Or, more yikes

Cleanup

  • Learn new way to approach git
    • @jessitron git happens talk
    • think like a git
  • Reconsider and re-do workflow

Lightbulb #1

We changed our thinking about git progression/directionality

Lightbulb #2

We learned about the graph/node thing.


This digressed into a huge "arrrgh MATH" conversation, but fear not!

Continuing cleanup

Explain your process with and without git-speak

  • Move (checkout) master to beginning of filter-branch 
  • Use git filter-branch to remove extra files
    • Not all files that are here need to be here
  • Push (results in merge commit that doesn't point at anything yet)
  • Garbage collect
  • Push again
  • Rebase for conciseness and clarity of tree

The Cleanup Process

What we're doing now:

Other Thoughts

  • Git is hierarchy-less; use workflow 
  • Be willing to iterate
  • Approach rebase with caution, not dread
  • You probably have to make mistakes to learn git
    • Work in a team
    • Use the command line
    • Confusion is normal!
  • Don't git when tired/cranky

Thanks!

Questions?

  • @mkudzia, kudzia.megan@gmail.com
  • @KSears16

Leveling Up Your Git Workflow

By Megan Kudzia

Leveling Up Your Git Workflow

Moving from a one-person git workflow to a multi-person workflow with a hierarchical structure.

  • 2,164