how to git with the program - using git for version control

14
How to Git with the Program! Using Git for Version Control By Brian Layman

Upload: brian-layman

Post on 20-May-2015

1.974 views

Category:

Technology


0 download

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.

TRANSCRIPT

Page 1: How To Git With The Program - Using Git for Version Control

How to Git with the Program!Using Git for Version Control

By Brian Layman

Page 2: How To Git With The Program - Using Git for Version Control

Introduction

0Brian Layman0Twitter/Skype: @BrianLayman ( u 7 u ı q )ɐɯʎɐ ɐ ɹ

What I do:0Security Reviews of Plugins & Servers0Site Optimization0Hacked Site Rescue0Custom Plugin Creation0Managed WordPress Hosting

Page 3: How To Git With The Program - Using Git for Version Control

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

Page 4: How To Git With The Program - Using Git for Version Control

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.

Page 5: How To Git With The Program - Using Git for Version Control

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

Page 6: How To Git With The Program - Using Git for Version Control

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

Page 7: How To Git With The Program - Using Git for Version Control

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

Page 8: How To Git With The Program - Using Git for Version Control

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

Page 9: How To Git With The Program - Using Git for Version Control

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

Page 10: How To Git With The Program - Using Git for Version Control

Graphical UIs

0Native GitHub Mac/Windows/Android programs0On Windows there is SmartGit and TortoiseGit.0Lots more: http://bit.ly/GitUIs (mixed case)

0Demonstrations

Page 11: How To Git With The Program - Using Git for Version Control

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

Page 12: How To Git With The Program - Using Git for Version Control

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

Page 13: How To Git With The Program - Using Git for Version Control

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/

Page 14: How To Git With The Program - Using Git for Version Control

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/