Advanced Git Tutorial
Advanced Git Tutorial
by Sarah Sharp
WARNING:
I am a unique snowflake
WARNING:
This tutorial may make you lazy
WARNING:
Some Git features are
dangerous!
What is Git?
● Distributed
● Fast
● Flexible
Git Basics
● See Everyday Git Tutorial:
– http://www.kernel.org/pub/software/scm/git/doc
s/everyday.html
● My git commands:
– git add - git commit
– git diff - git log - git show
– git push - git pull
– git fetch - git rebase
Naming commits
<Commitish>
● (Indirect) hash of repo files, current
commit message, and ancestor commits.
● HEAD refers to the last commit
● ~ at the end means commit before that
– e.g. HEAD~
– ^ is roughly equivalent to ~
● A branch points to a specific commit
● see git rev-parse
Git Philosophy
Git Philosophy
● Commit early, commit often
● One commit represents one idea or one
change.
– Makes it easy to read patches
– Easy to revert unwanted changes later
● Your working directory, index, and local
repo are your scratch pads.
Frequent Use Infrequent Use
The Index, the staging area