Upload
brian-layman
View
1.966
Download
0
Tags:
Embed Size (px)
DESCRIPTION
This presentation is a practical guide to the use of a Version Control System (VCS) to keep your theme, plugin, website, or project safe. You will learn the basic concepts common to version control programs like Git, Subversion and Mercurial in both a team and individual development settings. The unique aspects and advantages of using Git will also be covered, including the social aspect of revision control provided by GitHub.
Citation preview
How to Git with the Program!Using Git for Version Control
By Brian Layman
Introduction
0Brian Layman0Twitter/Skype: @BrianLayman ( u 7 u ı q )ɐɯʎɐ ɐ ɹ
What I do:0Security Reviews of Plugins & Servers0Site Optimization0Hacked Site Rescue0Custom Plugin Creation0Managed WordPress Hosting
What Is Git?
0More than just a Version Control System (VCS) “GitHub helps people build software together.”
0Allows you to track and undo changes.0Allows multiple people to work on the same code at
once.0Allows you to make changes to multiple versions of a
your software.0Allows you to deploy software to multiple servers.0Makes Code Development Social through
0 Notifications, Comments, Wiki & Graphs
What about CVS & SVN?
0Concurrent Versions System and SubVersioN0Not predecessors. They are similar but not the same
thing as Git0SVN is a centralized hub/wheel approach (CVCS)0Git (like Mercurial) is a Distributed VCS (DVCS)
0 You are working with your own copy of the repo0 You can commit to other “servers”0 FAST / OFFLINE / REDUNDANT
0SVN is simply not as advanced and “fakes” some of the standard VCS features.
Basic Terms
0 Repository – Your project & its history0 Branch – A separate and unique version of your code0 Tag – Your branch/repo at a specific point in time.0 Clone (Checkout in SVN) – Make your repo local0 Add – Start Tracking another file/tree.0 Commit (Git Only) –Add your changes to your local repo.0 Push (Commit in SVN) – Add your changes to a server0 Pull (Update in SVN) – Bring in changes from a server0 Revert (Git Only) – Undo a local commit 0 Checkout (Revert in SVN)- Get a specific server revision
Other Terms
0 Snapshots – Local commits0 Remote – Any other server with the current repository0 Diff – Compare two file versions0 Conflict – When a server has a different change to a line that
is changed on your local computer.0 Merge – Bring the changes from one branch into your local
branch (in SVN this is called PAIN)0 Status – Shows the current state of the files0 Log – All of the recent commits - Notice commits are not
named by a number but by a sha-1 hash that look like:a31e2253e16e2c154d01a70c3d7b12b4c57ea0a4
One Final Term: GitHub
0 The most common Git repository server0 4 Days ago GitHub raise $100 Million Dollars
(You’ve just gotta raise your pinky as you say that!)0 Provides a social aspect to coding
0 News Feed & history0 Issue Tracking0 Every Project gets a wiki0 Commenting on commits0 Pull requests & code submission0 Fork tracking & usage graphs
0 Watch people and project0 Private Repositories with role management
Basic Work Flow
0Create a Repository0Add a readme file to the repository0Commit the change with a comment (locally)0Connect the repository to a remote server0Push the change to the remote.0Make Changes0Commit (Repeat)0Pull updates from the server0Push
From the command line
git init(Create file README)git add READMEgit commit -m 'first commit'git remote add origin https://github.com/x/Example1.gitgit push -u origin master
(make changes)git commit –m “Fixed spelling misttake” test.phpgit pullgit push
Graphical UIs
0Native GitHub Mac/Windows/Android programs0On Windows there is SmartGit and TortoiseGit.0Lots more: http://bit.ly/GitUIs (mixed case)
0Demonstrations
BeanStalk App
0http://beanstalkapp.com0Provides Git or SVN repositories0Provides Automatic Deployment to various servers
when a push is made to a specific branch0This allows a two tier staging and production system
with automatic deployment0 Incident Tracking0Notification system (can use Google Talk)0Demonstrations
Command Line Goodies
0git fetch – Shows what will come down with a pull0git reset HEAD README – Unstage the last commit0git checkout -- README – Revert file README0git revert – Commit changes to undo last commits0git commit –amend – Modify the last commit0git blame – Determine who made a specific change
Questions?
0 Lots of information is in the Pro Git book for free at: http://git-scm.com/documentation
0 More Documentation: http://gitref.org/0 BeanStalk App/Google Talk deployment notifications:
https://github.com/brianlayman/Google-Talk-Notifications
0 Cheat Sheets: 0 http://
zrusin.blogspot.com/2007/09/git-cheat-sheet.html0 http://blog.fournova.com/2011/06/git-cheat-sheet/
Thank You!Brian Layman – [email protected]
A gazillion ways to reach me:0 http://eHermitsInc.com0 http://TheCodeCave.com0 http://Twitter.com/BrianLayman0 http://www.facebook.com/ehermit 0 http://github.com/BrianLayman 0 http://www.linkedin.com/in/brianlayman0 http://profiles.wordpress.org/brianlayman/ 0 http://www.meetup.com/NEOWordPress/