2. What is Git?
• Git is a flavour of
Source Control Management
(aka revision control, version control)
• It is an open source command line tool
with many GUIs available
• Created by Linus Torvalds to maintain the
Linux kernal
3. Why use Version Control?
• Rollback to working version
• Extra redundant backups
• Keep dependencies updated
• Move towards collaborative coding
• Social proof: an extra point of presence
(also StackExchange, StudioPress forums)
4. Setting Up
• Create a repo from
scratch or by cloning
• Stage files / hunks
• Commit to the repo
5. The basic Git workflow
• You modify files in your working directory.
• You stage the files, adding snapshots of them
to your staging area.
• You do a commit, which takes the files as they
are in the staging area and stores that
snapshot permanently to your Git directory.
http://git-scm.com/book/en/Getting-Started-Git-Basics
6. Underpinnings
• Git = two 'tricks':
• Commit blob
• Move pointers
(HEAD, branch)
• Theory video:
Git For Ages 4 And Up
7. Committing
• "…a commit's ID is a SHA-1 hash of
several pieces of information: the contents
of the commit, and the IDs of its parent
commits."
http://think-like-a-git.net/sections/graphs-and-git/garbage-collection.html
8. Branch and Merge
• Testing Out Merges
• The Scout Pattern (merge on a new
branch)
• The Save Point (merge on master)
• "Black Belt" (no branches)
http://think-like-a-git.net/sections/testing-out-merges.html
12. Terminology
• Repository / Repo: the .git filesystem which contains the project history and
settings
• Staging area / index / cache: files (or 'hunks' of code) which will be committed
• Working Copy: the directory you're working in, may not be staged or
committed yet
• Hash: A checksum which acts as a unique identifier for your commit. Also
guarantees file integrity.
• Commit: create a snapshot or restore point, to which you can return in
future (n: the snapshot itself)
• Checkout: sync your Working Copy with the selected commit
• Clone: to download a copy of a repository
• Branch: an active line of development
• Head: a reference to the branch you're working on
• Master: the default development branch
13. Terminology
• Merge: to integrate changes from another branch into the
current
• Tag: a label which acts like a 'bookmark', generally used for
tagging release versions.
• Rebase: funky merge.. think cherry picks & hard reset: Using
'git cherry-pick' to Simulate 'git rebase'
• Fork: to make modifications to someone else's project
• Push: send changes to a remote server
• Fetch: receive changes from a remote server
• Pull: Fetch & merge in one operation
http://www.kernel.org/pub/software/scm/git/docs/gitglossary.html#
14. Free Tools
• SourceTree by Atlassian
• GitHub for Mac
• 5 Windows Git Clients To ‘Git’ The Job
Done
16. Wordpress & Git
• The WordPress core team uses SVN
natively, but syncs to Git every 15 minutes,
so folk who prefer Git can follow along:
https://github.com/WordPress/WordPress
17. Further Reading
• Think Like (a) Git: conversational clarity -
the simplest read on understanding Git.
• Git Documentation: really clear, easy to
read, the definitive resource. Free PDF
• CSStricks: Let’s Suck at GitHub Together
• CSStricks: Getting off FTP and onto Git
Deployment with Beanstalk