Git allows for branching and merging without fear. It stores changes locally, meaning work can be done offline and changes committed later. The index stages changes between the working directory and repository. Commits are stored as snapshots in the object database as a directed acyclic graph, allowing history to be rewritten and recovery from any prior commit. Basic commands were reviewed, as were rebasing and the reflog for recovering work. Online tutorials were provided for next steps in learning Git.
4. Not your parents’
source control
Forget
• Check out (i.e. unlock)
• Files are locked by default
• Must be connected
in real-time
• Merges are scary
• Don’t merge unrelated branch
• Branching is expensive
Embrace
• It’s already yours
• Work first, commit later
• You have your own copy
(of everything)
• Merges are hard work
(but not so much as before)
• Merge is a merge is a …
• Branching is cheap & fast
5. Not your parents’
source control
Forget
• Revision numbers
• The central authority
• Latest version
• IDE integration
Embrace
• Hashes
• Everyone has a copy
• View the log
• Command Line
6. Common fears
Git is unmanageable – there’s no central authority!
• Every clone is a full copy; this means many backups and extra redundancy.
• It is common to declare one central copy of the repo as the “authority” (or “origin”)
and use a workflow that enforces that.
“Git history is a bunch of lies”
• Rewriting local history is one of the great benefits of git
Git is too complicated
• Learn the basics & try it out
The command line is unfriendly
• Command line is very helpful, once you know the basics.
“Git will eat all of your code and you’ll never ever be able to get it back!”
• You can recover almost any commit, even ones that you’ve orphaned.
• The “reflog” will save your bacon!
bitly.com/11Px78L | bit.ly/15w82WF
8. What is:
a Directed Acyclic Graph?
http://light.physics.auth.gr/graphs/gr_history_en.html
Mathspeak What it means
A graph A collection of dots and lines
(called vertices and edges)
9. What is:
a Directed Acyclic Graph?
http://stackoverflow.com/questions/4625440/cycle-enumeration-of-a-directed-graph-with-multi-edges
Mathspeak What it means
A graph A collection of dots and lines
(called vertices and edges)
A directed
graph
The edges have arrows
indicating which direction
the line points.
10. What is:
a Directed Acyclic Graph?
http://en.wikipedia.org/wiki/File:Directed_acyclic_graph_3.svg
Mathspeak What it means
A graph A collection of dots and lines
(called vertices and edges)
A directed
graph
The edges have arrows
indicating which direction
the line points.
A directed
acyclic graph
The arrows make
no closed loops
(i.e. no cycles)
11. Why is this important?
http://nvie.com/posts/a-successful-git-branching-model/
Mathspeak What it means
A graph A collection of dots and lines
(called vertices and edges)
A directed
graph
The edges have arrows
indicating which direction
the line points.
A directed
acyclic graph
The arrows make
no closed loops
(i.e. no cycles)
12. How git stores changes
The object store
Commit
Tree
Blob
13. What is the index?
Working directory
The index
The object store
http://bit.ly/18QF4gx
14. What is the index?
Working directory
The index
The object store
http://bit.ly/18QF4gx
Time
15. What is the index?
Working directory
The index
The object store
http://bit.ly/18QF4gx
Time
Blob
16. What is the index?
Working directory
The index
The object store
http://bit.ly/18QF4gx
Time
Commit
Tree
Blob
17. What is the index?
Working directory
The index
The object store
http://bit.ly/18QF4gx
Time
Commit
Tree
Blob
18. What is the index?
Working directory
The index
The object store
http://bit.ly/18QF4gx
Time
Commit
Tree
Blob
21. Show me teh codz
http://www.gurl.com/2012/03/10/cats-sleeping-in-weird-places/
22. Syntax Comparison
Phase Subversion
Team Foundation
Source Control (TFSC) Git
Initial Checkout Get Latest Clone
Daily Update Get Latest Fetch or Pull
Checkout (unlock)
-- do work -- -- do work -- -- do work --
Review Status View Pending Changes Status
Stage changes Add Add
Save your work Check in (remote) Check in (remote) Commit (local)
Share your work -- done -- -- done -- Push (to remote)
23. Common commands
Command
git branch Create a (local) branch
git checkout {target} Update working copy to a specific commit
git status View status of working copy & index
git add [{filepath}] Stage files from working copy -> index
git commit Commit indexed changes into local repo
git rebase {target} {source} Rewrite local history
git merge {target} Merge this branch into another branch
git fetch {remoteName} Bring remote changes into local repo
git pull {remote} Fetch, then merge
git push {remote} {localBranchName} Share your local commits with others
gitk --all & Open the gitk tool in the background
26. Online tutorials
Title URL
Code School – Try Git http://bit.ly/11eaP5C
Learn Git Branching http://bit.ly/18R1L45
A successful git branching model https://bitly.com/qcZc8E
Set up git http://bit.ly/10lwGlc
Git cheat sheet http://bit.ly/YBUXIn
27. Learning goals
• Don’t fear the git
• Understand basic principles:
– How git stores changes
– What that means for you
• Don’t fear the git
Next steps
• Google: “git tutorial” or visit bit.ly/gituptospeed
• Try it out
David Alpert |@davidalpert
Editor's Notes
Open your mind to a new way of tracking your changes.
Open your mind to a new way of tracking your changes.