Confession
I'm kind of obsessed with version control.
Agenda
- Commonly used commands
- Solving common problems
- What Git’s really doing under the hood
Key Terms
“DETACHED HEADs!?!’
the graph
history is not a timeline
3 zones of focus
↥Head ↦ Index ↧ Work Area
master^
doodlez^^^
HEAD@{2}
HEAD~5
Problem:
“Where am I?”
Solution:
Improve your git log
git log --color --graph --pretty=format:'%Cblue%h%Creset -%C(yellow)%d%Creset %s %Cgreen%cr %C(white)%an' --abbrev-commit
Problem:
“I'm in merge jail”
Solution:
git merge --abort
Problem:
Merge vs. Rebase?
Rebasing alters patches in order to advance the branch pointer.
Problem:
“I over-/under-commited”
Solution:
`git commit --amend`
...or
Interactive Rebase
git rebase -i HEAD~5
Problem:
“So much to type!”
Solution: Install git-friendly!
Problem:
“Too many options!”
Solution: zsh (or bash) completion
get this + git-friendly for free with @jm3/dotfiles
Wrap Up
(“Get those iphones out!”)
1. remember there is no timeline
2. live in git as much as you can
3. use git-friendly + jm3/dotfiles
Live in Git
- our projects at 140 Proof are in Git
- my website is in Git
- my blog is in Git
- this presentation is in Git
“My repo is a graph of pointers to patches…”
(Say it with me)
- Timeline-based metaphors incorrectly describe Git.
Save Yourself Time
- Install git-friendly + stop stashing so much
- install jm3/dotfiles + stop typing so much