Date post: | 15-Apr-2017 |
Category: |
Software |
Upload: | ping-onn-cheng |
View: | 563 times |
Download: | 2 times |
GIT: VERSION CONTROLTAR COLLEGE GUEST LECTUREBy /
Founder & CTO
Neruti Technology Sdn Bhd
Cheng Ping Onn @pocheng
NERUTI TECHNOLOGY
Build cloudbased regulatory compliance and risk managemen softwareHighly regulated industriesnode.js, message queue, cloud foundry, nosql, Agile (Scrum)backbone.js, bootstrap.js, SASSWe are HIRING!
GIT INTRODUCTION
What's Version Control?Why?Philosophy
distributedcompletenessscalabilityaccountabilityimmutability
BASIC CONFIGURATION
Duration: 5 minutes
$ git config --global user.name "Cheng Ping Onn"$ git config --global user.email [email protected] $ git config --listuser.name=Cheng Ping [email protected]=0core.filemode=truecore.bare=falsecore.logallrefupdates=true
CONFIGURE ALIAS
Duration: 3 minutes
$ git config --global alias.s status -s$ git config –global alias.lg 'log --oneline --all --graph --decorate'
CONFIGURE AUTOCRLF
Duration: 3 minutes
$ git config –global core.autocrlf input
$ git config --listuser.name=Cheng Ping [email protected]=vimalias.s=statuspush.default=simplecore.repositoryformatversion=0core.filemode=truecore.bare=falsecore.logallrefupdates=truecore.autocrlf=inputalias.lg=log --oneline --all --graph --decorate
COMMIT
Atomic changesetMust have commit messageExplicit reference SHA1 hashImplicit reference HEAD
DEMO
initializationstaging
unstaging everythingunstaging a file
view indexcommit
relative namereset (delete commit, make sure you know what you are doing!)
CREATE REPO AND COMMIT
Duration: 5 minutes
$ git init tarc$ cd tarc$ git status$ touch index.html$ git status$ git add index.html$ git status$ touch index.css$ git status$ git add .$ git status$ git commit -m'added homepage'$ git status
STAGING
Duration: 5 minutes
$ touch about.html about.css contact.html contact.css$ ls$ git status$ git add ab*$ git s$ git commit -m'added about us page'$ git add .$ git commit -m'added contact page'
SHA1 HASH
Probability of Collision160 bits = 2^160 ~ 10^80 hashes
A trillion people, trillion unique hashes/sec for a trillion years = 10^43Avalanche effect
OBJECT STORE
Blobsany dataopaqueno metadata
Treesdirectory info
CommitsAuthor, committer, data, log
Tagshuman readable indicator
CREATE & CHECKOUT BRANCH
Duration: 3 minutes
$ git branch$ git branch search$ git checkout search$ touch search.html search.css$ git add .$ git commit -m'added search page'$ git lg$ git checkout master$ ls
DETACHED HEAD
Duration: 3 minutes
// git checkout a previous commit$ git lg$ touch new.html$ git add .$ git commit -m'added new file'$ git lg$ git branch
FAST FORWARD MERGE
Duration: 5 minutes
//Add student branch$ git checkout master$ git checkout -b student$ git branch$ touch student.html$ git add .$ git commit -m'added student page'
//Add alumni branch$ git checkout master$ git checkout -b alumni$ touch alumni.html$ git add .$ git commit -m 'added alumni page'$ history$ git lg
//Fast-Forward Merge$ git checkout master$ git merge alumni$ git branch -d alumni$ git lg
RECURSIVE MERGE
Duration: 3 minutes
$ git branch //verify to be in master branch$ git merge student$ git lg
TOOLS USED IN THIS PRESENTATION
Ubuntu LinuxVIMVIM Plugin fugitive.vimPresentation reveal.js, npm,grunt
THANK YOU!Cheng Ping Onn Founder & [email protected], @pocheng Neruti Technology Sdn Bhd