behaving like a git and getting away with it...git – the stupid content tracker "git"...

54
Behaving like a Git and getting away with it Ed Courtenay

Upload: others

Post on 23-Aug-2020

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

Behaving like a Git and getting away with it

Ed Courtenay

Page 2: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 3: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 4: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

git – The Stupid Content Tracker

"git" can mean anything, depending on your mood.

• random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of "get" may or may not be relevant.

• stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.

• "global information tracker": you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.

• "goddamn idiotic truckload of sh*t": when it breaks

https://github.com/git/git/blob/e83c5163316f89bfbde7d9ab23ca2e25604af290/README

Page 5: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

DVCS

• Your working repository is a clone

• Changesets are local

• Network connections not required (working on a train is easy)

Page 6: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

Getting started

Page 7: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 8: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 9: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 10: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

Branching and merging

Page 11: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 12: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 13: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 14: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 15: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 16: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 17: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 18: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 19: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 20: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 21: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 22: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 23: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 24: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 25: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 26: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 27: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 28: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 29: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 30: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

HEAD

• A head is simply a reference to a commit object.

• Each head has a name. • By default, there is a head in every repository called master.

• A repository can contain any number of heads. At any given time, one head is selected as the “current head.” This head is aliased to HEAD, always in capitals.

Page 31: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 32: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

Rebasing

Page 33: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 34: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 35: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 36: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 37: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 38: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 39: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 40: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

Demo: interactive rebasing

Page 41: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

Forking

Page 42: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 43: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 44: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 45: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 46: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 47: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

Why are line endings a pain?

Windows CR LF

Linux LF

Mac (old) CR

OSX/MacOS LF

git config --global core.autocrlf true

Page 48: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 49: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 50: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,
Page 51: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

Demo: aliases

Page 52: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

Useful aliases

• wipe • !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 –hard

• undelete • !git checkout $(git rev-list -n 1 HEAD -- "$1")^ -- "$1"

• hist • log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(bold red)%s%C(reset) %C(red){%an}%C(reset) %C(cyan)%d%C(reset)' --graph --date=short

Page 53: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

http://upload.wikimedia.org/wikipedia/commons/d/d8/Git_operations.svg

Page 54: Behaving like a Git and getting away with it...git – The Stupid Content Tracker "git" can mean anything, depending on your mood. •random three-letter combination that is pronounceable,

Questions?