RailsConf – Day 1 – Git Immersion
June 7th, 2010 by Brian | No Comments | Filed in workJim Weirich – @jimweirich
If for some crazy reason you don’t already have git installed, go download it from here – http://git-scm.com/download
Source Control Made Easy – Pragmatic Bookshelf Screen Cast
git config –global user.name “Brian Olore”
git config –global user.email “brian@olore.net”
git config –global core.autocrlf input
git init – creates a new, empty repository
Git is about changes, not files.
Always additive – Information is never destroyed – makes it really really hard to screw up your repository
SHA1 used for preventing duplication – all files referenced using their hash
- Is there additional meta-data that has things like executable flag, etc ??
Tags point to snapshots & never move
Branches point to snapshots and move with commits
Can branch after committing changes
Cheap, local branches
git clone <url> – make an exact copy of remote working copy
git pull <url> – receive changes from remote url into your working copy
Shared remote archive – allows sharing between many users – like svn, but if remote goes away, can still push/pull between users without the centralized repository
git log –pretty=oneline
5e870f0441fb9a30ad2711e186cb46a1cafd9e30 pulling from command line
63537c6c788c4893cf928509339f84cb9f243c6b First commit
git log –pretty=oneline –abbrev-commit
5e870f0 pulling from command line
63537c6 First commit
git add – adds the changes to be committed, not the file. Can have multiple adds
git diff – compare un-staged (things not yet “add”ed)
git diff –cached – compare staged area (things “add”ed) to “commit”ted
Both gitx (for Macs) and gitk (any platform) are useful in exploring log history.
git reset – changes a branch pointer
git reset –hard – changes the branch pointer and checks out into your working directory.
git rebase master – replays branch changes (rewrites commits) as if they happened on master
DO NOT rebase shared branches – only reset/rebase on local repositories
http:/nvie.com/git-model – “A successful Git branching model”

