Slide 1

Slide 1 text

“git with it” A few tips on using git in teams Tom de Bruin | @deadlyhifi

Slide 2

Slide 2 text

My VCS History Alone Agency Single product teams

Slide 3

Slide 3 text

What’s the point of a VCS? ● You don’t want to lose your code ● You want a history of your work. ● You want to have multiple people committing to the same code base. ● You want to make it easy to deploy your code. ● You want to easily experiment with ideas. ● Any others?

Slide 4

Slide 4 text

Margaret Hamilton (NASA) https://qz.com/726338/the-code-that-took-america-to-the-moon-was-just-publis hed-to-github-and-its-like-a-1960s-time-capsule/

Slide 5

Slide 5 text

Communication

Slide 6

Slide 6 text

With Great Power… Practice “good practice”

Slide 7

Slide 7 text

Atomic Commits “In the field of computer science an atomic commit is an operation that applies a set of distinct changes as a single operation…” https://en.wikipedia.org/wiki/Atomic_commit

Slide 8

Slide 8 text

Branching

Slide 9

Slide 9 text

Make each feature a separate commit git commit -m “ticket-1 - fix code style issues … git commit -m “ticket-1 - update config

Slide 10

Slide 10 text

While you were working…

Slide 11

Slide 11 text

Rebasing

Slide 12

Slide 12 text

Rebasing git rebase master ● Goes back to the point you branched off master and replay your commits ● This happened ● Then this happened ● Then this happened git rebase -i HEAD~3 ● If you need to amend a particular commit just go back to it and make the changes.

Slide 13

Slide 13 text

Merge conflict!

Slide 14

Slide 14 text

Demo

Slide 15

Slide 15 text

“git push --force” “git push --force-with-lease”

Slide 16

Slide 16 text

Top tip # list git branches with their descriptions function gb() { branch="" branches=`git branch --list` while read -r branch; do clean_branch_name=${branch//\*\ /} description=`git config branch.$clean_branch_name.description` printf "%-15s %s\n" "$branch": "$description" done <<< "$branches" }

Slide 17

Slide 17 text

More Information https://services.github.com/on-demand/ https://help.github.com/articles/git-and-github-learning-resources/ https://abookapart.com/products/git-for-humans https://try.github.io (by Code School)

Slide 18

Slide 18 text

Any Tips to Share? Any Questions? Tom de Bruin | @deadlyhifi