Barcamp Macau 2014 - Introduction to GIT

32
Barcamp Macau 2014 Introduction to GIT Edison Wong 2014 Oct 4th

description

What is GIT? Why GIT? 15mins Tutorial Advanced Topic(s)

Transcript of Barcamp Macau 2014 - Introduction to GIT

Page 1: Barcamp Macau 2014 - Introduction to GIT

Barcamp Macau 2014

Introduction to GIT

Edison Wong2014 Oct 4th

Page 2: Barcamp Macau 2014 - Introduction to GIT

Edison Wong

● CEO, PantaRei Design– [email protected]

● Drupal developer & contributor– https://drupal.org/user/33940

● HKDUG Co-founder– https://groups.drupal.org/drupalhk

● Startup founder– 2009 - PantaRei Design founded

– 2010 - YBHK applicant

– 2011 - ITF SERAP applicant

– 2011 - HKSTP Incu-Tech applicant

Page 3: Barcamp Macau 2014 - Introduction to GIT

PantaRei Design

● Hong Kong based Free and Open Source Software (FOSS) service provider– Content Management System (CMS) with Drupal

– Cloud hosting with Amazon Web Services (AWS)

– Team collaborate solution with Atlassian

● Business Partnership– 2012 - AWS Consulting Partner

– 2013 - Acquia Partner

– 2013 - Atlassian Experts

– 2014 - Rackspace Hosting Partner

● FOSS Contributor– 2008 - Hong Kong Drupal User Group Co-founder

– 2012 - Drupal Services Provider

Page 4: Barcamp Macau 2014 - Introduction to GIT
Page 5: Barcamp Macau 2014 - Introduction to GIT
Page 6: Barcamp Macau 2014 - Introduction to GIT
Page 7: Barcamp Macau 2014 - Introduction to GIT

Outline

● What is GIT?● Why GIT?● 15mins Tutorial● Advanced Topic(s)

Page 8: Barcamp Macau 2014 - Introduction to GIT

What is GIT?

● Distributed revision control and source codemanagement (SCM) system

● Designed to handle everything from small tovery large projects

● Designed and developed by Linus Torvalds forLinux kernel development in 2005

Page 9: Barcamp Macau 2014 - Introduction to GIT
Page 10: Barcamp Macau 2014 - Introduction to GIT

Why GIT?

● Manage code changes by rename file will soonreach its limitation, e.g.– mycode-20140308.php

– mycode-201403080930.php

● Archive entire folder will make case even worse– Need to extract before compare the changes

● Share progress with co-workers becomenightmare

Page 11: Barcamp Macau 2014 - Introduction to GIT

Why GIT? (cont.)

● CVS– Manage revision per file (rename not support)

– Remote repository server required (no local folderoffline management)

– Single commit management (other else contributeby submit patches)

– TOOOOO OLD (well...)● Used by Drupal during 7.x development cycle● After Drupal 7 released, soon migrated to GIT

Page 12: Barcamp Macau 2014 - Introduction to GIT

Why GIT? (cont.)

● SVN– Manage revision per folder

– Remote repository server required

– Single commit management

– A bit better than CVS, but branching model stilllooks crazy

● At least, we now have GIT, why still using SVN?

Page 13: Barcamp Macau 2014 - Introduction to GIT

Why GIT? (cont.)

● GIT– Manage revision per entire project

– Remote/local repository supported● git init● git add --all .● git commit -am 'Initial commit'● git log● git status

– Distributed workflows

– Used by https://drupal.org/ since Drupal 7

– You also know https://github.com/, isn't it?

Page 14: Barcamp Macau 2014 - Introduction to GIT
Page 15: Barcamp Macau 2014 - Introduction to GIT

15mins Tutorial

● git init● git status● git add● git rm● git commit● git log● git remote

● git push● git pull● git diff● git reset● git checkout● git branch● git merge

Page 17: Barcamp Macau 2014 - Introduction to GIT

Advanced Topic(s)

● Continuous Integration (CI)● Migrate to GIT from SVN● Dropbox-like File Sharing

Page 18: Barcamp Macau 2014 - Introduction to GIT

Continuous Integration (CI)

● Test-Driven Development (TDD) or Behavior-Driven Development (BDD)

● Combination with automated unit tests, e.g.running phpunit per each GIT commit– GitHub → Travis CI

– Stash → Bamboo

Page 22: Barcamp Macau 2014 - Introduction to GIT

Migrate to GIT from SVN

● Prepare your environment for the migration.● Convert the SVN repository to a local GIT repository.● Synchronize the local GIT repository when the SVN

repository changes.● Share the GIT repository with your developers via

Bitbucket.● Migrate your development efforts from SVN to GIT.

Page 24: Barcamp Macau 2014 - Introduction to GIT

Dropbox-like File Sharing

● Dropbox– Public cloud-based file hosting service

● GIT– Repository management with history

● SparkleShare– GIT-based file hosting solution with history

– Just manage share and permission as normal GIT repository

– Support public (e.g. GitHub, BitBucket) or private (e.g. Stash, GitLab) GITrepository

– Suitable for small size file sharing

– Dropbox-like operation, NO GIT command is required!!

Page 26: Barcamp Macau 2014 - Introduction to GIT
Page 27: Barcamp Macau 2014 - Introduction to GIT

Dropbox-like File Sharing (cont.)

● BitTorrent Sync– Peer-to-peer file synchronization

– Over the Internet via secure, distributed P2P technology

● Unlike GIT-based solution:– Suitable for large-size binary file hosting

– No complete history support

● How we use SparkleShare and BitTorrent Sync?– BitTorrent Sync: Short-term working copy sharing

– SparkleShare: Long-lasting archive with history

Page 29: Barcamp Macau 2014 - Introduction to GIT
Page 30: Barcamp Macau 2014 - Introduction to GIT

Q&A

Page 31: Barcamp Macau 2014 - Introduction to GIT

References

● http://git-scm.com/● https://try.github.io/levels/1/challenges/1● http://www.slideshare.net/svenpeters/getting-git-

right● https://www.atlassian.com/git/tutorials● http://www.webupd8.org/2011/03/set-up-sparkle

share-with-your-own.html● http://www.webupd8.org/2014/03/install-bittorre

nt-sync-gui-in-ubuntu.html

Page 32: Barcamp Macau 2014 - Introduction to GIT

Thank You

● Please feel free to contact us:– Unit 207, 2/F IC Development Centre, No.6 Science

Park West Avenue, Hong Kong Science Park,Shatin, N.T.

– +852 3576 3812

– http://pantarei-design.com/

[email protected]