Date post: | 01-Dec-2014 |
Category: |
Documents |
Upload: | alex-hillman |
View: | 1,137 times |
Download: | 0 times |
Version Control
Chris NageleAlex Hillman
Today's Agenda
1. A bit about us2. A bit about version control3. A practical intro to Git
We're from Wildbit
Chris NageleFounder
• Transitioned business from consulting to product
• International Team - 7 countries represented
• Writer - ThinkVitamin, etc
• Spends days in the server closet
Alex HillmanBusiness Development
• Web development background
• Cofounded Indy Hall - Coworking in Philadelphia
• Public Speaker - SXSW, etc
• Spends days communicating with our customers
Beanstalkapp.com
Go sign up for a free trial now!
Why Version Control?
Why Version Control?
cp index.html index-v12-old2.html
Why Version Control?
cp index.html index-v12-old2.html
There has to be a better way
The Old Way
• Unmaintainable filesystems and filenames
• Accidental overwriting of revisions
• Updates on live server
• Communicate with team via e-mail
• Multiple server management nightmare
The New Way
• Filenames stay the same!
• Make changes with confidence - even revert!
• Source control as "source" for updates
• Code as communication with the whole team
• Deploy different versions to different servers easily
Vocabulary Lesson• Repository
• Track Changes
• Add or Update Files
• Commit Changes
• Revision
• Revert
• Branch
• Merge
• Diff
Version Control Options
Centralized
Centralized
Client & Server Relationship
CentralizedSubversion -
Benefits
• Easy to understand
• More control over users and access
• More GUI & IDE clients
• Simple to get started
• Free & Open Source!
Disadvantages
• Dependent on a server
• Hard to manage a server (and backups!)
• Slower
• Some advanced tasks are very difficult
Decentralized
(also known as Distributed)
Decentralized
A Network of Complete "Repositories"
DecentralizedGit & Mercurial
Benefits
• Powerful and detailed change tracking (you commit more often)
• No server necessary - everything is local
• It's fast to branch and merge
• Free & Open Source!
Disadvantages
• More to learn in order to get started
• Not as many GUI or IDE clients
• It doesn't protect you from yourself
Any questions so far?
Get Git!
Get Git!
http://bit.ly/downloadgit - for OSX
Get Git!
http://bit.ly/downloadgit - for OSX
Other platform? Sorry!
http://git-scm.com
Get Sample Files
http://bit.ly/samplefiles
Terminal
Global Config
Global Config
git config --global user.name "Alex Hillman"git config --global user.email "[email protected]"
Global Config
git config --global user.name "Alex Hillman"git config --global user.email "[email protected]"
Verify:
git config --list
Global Config - Bonus!
git config --global color.status autogit config --global color.branch auto
Global Config - Textmate Bonus!
git config --global core.editor "mate -w"
Or replace "mate -w" with your favorite text editor
Command Line Basics
pwd - present working directory
cd - change directory
cd .. - change directory up one folder level
ls - list everything in present working directory
mkdir - make directory
cp - copy
mv - move
My First Repository
You never forget your first
Ignoring Files
It's nothing personal
Git Status
What the hell is going on?
The Stage
And how to get your files on it
PSA: Beware of Empty Folders!
Committing
No diamond necessary
Committing ChangesA little about "insertions" and "deletions"
• Git is about "content"
• An insertion adds a new line of content
• A deletion removes a line of content
• A change is actually a deletion + an insertion
Committing ChangesA little about "insertions" and "deletions"
• Git is about "content"
• An insertion adds a new line of content
• A deletion removes a line of content
• A change is actually a deletion + an insertion
• Every change is very small, so commit often
• More commits = more communication
Inline Commits
For quickies
Verbose Commits
More to say? That's ok!
Stash
Git's "Clipboard"
Commits as Communication
Tasks, tickets, links, & more
Log
What happened and when?
Remotes
Don't change that channel
Sign up for Beanstalk!
It’s ok…we’ll wait….
Keys
Keys
ssh-keygen -t rsa
Keys
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub | pbcopy
Keys
Creating a Remote
The Easy Way – with Beanstalk
git remote add
git push
git push beanstalk master
Remotes
Connecting some dots between the command line and Beanstalk
Remotes
I Think I’m A Clone Now
Catastophe
Delete your work
git clone
git remote
git remote rename
git pull
git pull beanstalk master
Branches
git branch
git checkout
Branches + Remotes
git push beanstalk ________
where ________ is the name of your branch
git push beanstalk colorchange
git pull beanstalk colorchange
Integrating Changes
Without A Time Traveling DeLorean.
Rebase
Rebase
Check out progit.org
Merge
Make sure you’re on the branch you want to merge TO
git merge __________
Where __________ is the name of your branch you wish to merge in.
Keep that Repo Tidy
git branch –d __________
Where __________ is the name of your branch you wish to delete.
Conflict Resolution
You didn’t commit yet!
You didn’t commit yet!
error: Your local changes to the following files would be overwritten by merge:
index.phpPlease, commit your changes or stash them before you can merge.Aborting
You Did Commit! But…
You Did Commit! But…
* branch master -> FETCH_HEADAuto-merging index.phpCONFLICT (content): Merge conflict in index.phpAutomatic merge failed; fix conflicts and then commit the result.
Conflict Delimiters
Commit, then push!
Where to learn more
Thank You!
Chris Nagele – Alex Hillmanhttp://www.beanstalkapp.com
@beanstalkapp