Date post: | 14-Jul-2015 |
Category: |
Technology |
Upload: | wong-hoi-sing-edison |
View: | 351 times |
Download: | 7 times |
Open Innovation Lab (OIL)
GIT Intro Workshop
PantaRei Design LimitedWong Hoi Sing, Edison
2015 Feb 27th
Wong Hoi Sing, Edison
● CEO, Founder, PantaRei Design– 2009, PantaRei Design founded
– 2010, HKFYG YBHK applicant
– 2011, ITF SERAP applicant
– 2011, HKSTP Incu-Tech applicant
● FOSS and Drupal Developer, Contributor and HKDUG Co-founder– 2000, Debian GNU/Linux 2.2 ('potato')
– 2005, Drupal Developer
– 2008, BarCamp HK Speaker
– 2008, HKDUG Co-founder
– 2011, Drupal 7.x Core Contributor
● [email protected]● https://www.drupal.org/u/hswong3i
PantaRei Design
● Hong Kong based FOSS service provider– Content Management System (CMS) with Drupal
– Cloud Hosting Solution with Amazon Web Services (AWS)
● Business Partner with industry leaders– 2012, AWS Consulting Partner
– 2013, Acquia Partner
– 2013, Atlassian Experts
– 2014, Rackspace Hosting Partner
Outline
● What is GIT?● Why GIT?● 15mins Tutorial● Advanced Topic(s)
What is GIT?
● Distributed revision control and source code management (SCM) system
● Designed to handle everything from small to very large projects
● Designed and developed by Linus Torvalds for Linux kernel development in 2005
Why GIT?
● Manage code changes by rename file will soon reach 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 become nightmare
Why GIT? (cont.)
● CVS– Manage revision per file (rename not support)
– Remote repository server required (no local folder offline management)
– Single commit management (other else contribute by submit patches)
– TOOOOO OLD (well...)● Used by Drupal during 7.x development cycle● After Drupal 7 released, soon migrated 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 still looks crazy
● At least, we now have GIT, why still using SVN?
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?
15mins Tutorial
● Installation– Debian/Ubuntu
● apt-get install git git-flow
– Mac● brew install git git-flow
– Windows● https://msysgit.github.io/
15mins Tutorial (cont.)
● Basic commands– git init
– git status
– git add
– git rm
– git commit
– git log
15mins Tutorial (cont.)
● Remote commands– git remote
– git push
– git pull
15mins Tutorial (cont.)
● Advanced commands– git diff
– git reset
– git checkout
– git branch
– git merge
Advanced Topic(s)
● Gitflow Workflow● Continuous Integration (CI)● Migrate to GIT from SVN● Dropbox-like File Sharing
Gitflow Workflow
● The Gitflow Workflow defines a strict branching model designed around the project release
● Developers work locally and push branches to the central repo
● The only difference is the branch structure of the project
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
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.
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) GIT repository
– Suitable for small size file sharing
– Dropbox-like operation, NO GIT command is required!!
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
Q&A
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://nvie.com/posts/a-successful-git-branching-model/
● https://github.com/nvie/gitflow
● https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow
● http://danielkummer.github.io/git-flow-cheatsheet/
● http://www.webupd8.org/2011/03/set-up-sparkleshare-with-your-own.html
● http://www.webupd8.org/2014/03/install-bittorrent-sync-gui-in-ubuntu.html
Thank You
● Please feel free to contact us:– PantaRei Design Limited– Unit 326, 3/F, Building 16W
No.16 Science Park West AvenueHong Kong Science Park, Shatin, N.T.
– Phone: +852 2576 3812
– Fax: +852 3753 3663– Email: [email protected]– Web: http://pantarei-design.com