Git - 🐘
Topics 💬
1. What is GIT ?
2. Why GIT is needed?
3. GIT Basic
4. GIT Rules
○ Do
○ Don’t
5. GIT flow
2
Hello! ✋
I am Kelvin Ho
DCS
play with nodejs / php
You can find me at @kelvin2go
https://github.com/kelvin2go
March, 2019
3
What is GIT ? 👼
The introduction of GIT
- Control system
- Version control system
- Distributed version control system
1
“
5
Control System
- Store content / Code / file
- Content tracker
“
6
Version Control
System
- Allow developer add code in parallel
- Keep history of changes
- Git provide branches, merges,
comparing
Distributed Version
Control System
- Decentralized but centralized
- Git has remote repo (which is
same as everyone)
- Every develop has own local
repo
- All develop have a copy of the
code
7
Why GIT is needed?🚀
The reason of using git
2
“
9
Why Git is needed?
- The life before ({date}.zip, ftp, mess... )
- Flexibility
- Allow different working Env ☝
- Allow different developers works on
same project (add / changing code)
- Peer reviews
- Adding / revert version of the project
- 70% dev (stackoverflow), Basic
standard of code sharing
“
10
Why Git is needed? (2)
- Performance
- Fast comparing commit
- Security (user / ssh / code transmit)
- continuous integration
- automated test
- https://about.gitlab.com/product/conti
nuous-integration/
GIT basic 🍎
The basic structure of GIT
3
“
12
GIT basic
- Git clone
- Git pull
- Git status
- Git add
- Git checkout
- Git commit -m
- Git push
Demo: https://github.com/kelvin2go?tab=repositories
Short cuts: https://github.com/kelvin2go/basic_init/blob/master/.bashrc#L15
“
13
GIT Structure
“
14
GIT Structure
Master
- always product-ready. Always GIT PULL
REQUEST only. No direct commit
Develop
- always latest branch before next release.
Always merge / git pull request from
feature branch.
Feature
- New feature: when done, delete this branch
Details: https://nvie.com/posts/a-successful-git-branching-model/
GIT Rules 👪
When we share a git repo, we
need to follow some rules to keep
it clean for everyone to access
15
◇ Use .gitingore to avoid sharing privacy file
◇ git pull before work on anything
◇ Always pull from develop to start
◇ Each ENV (DEV / prod) should belong to one branch
◇ keep branch short life (* except develop / master)
◇ Long live branch don’t diverge (locale commit)
◇ Keep clean and easy to track for everyone
◇ Use Label / Tag if need other to notice
◇ Each feature branch should be follow a ticket
◇ Check the code after pull request
+ continuous integration
Please Do 🙆 ✅
16
Don’t Don’t ...🙅 ❌
◇ Use GIT as a file storage / NAS
■ Its keep track of code and project version
◇ Don’t commit / add private keys 🔑 / hash / token (it leaves in git history)
◇ Local merge without pushing ( all others cant keep track )
◇ Don’t directly commit to master
◇ If doing HK, TW, KR , … , don’t one branch HK, TW, KR. using env to config
◇ Don’t open your own branch. Eg. Kelvin branch which is not shareable /
distributed to anyone.
◇ Don’t Pull request / commit if the feature is not done
■ If we have to, label ‘not complete’
◇ Don’t Commit conflict
17
GIT FLOW 🐘 > 🐉
- Rules + structure = git dev standard => GIT FLOW
- There has many ways
- Ready made command for easier git
apt-get install git-flow
git flow init
Detail : https://danielkummer.github.io/git-flow-cheatsheet/
18
Feature : the feature going add on develop
每一個 task 一條feature 用完 Merge 就 delete feature branch
1. Start: git flow feature start MYFEATURE
2. git add / git commit
3. done: git flow feature publish MYFEATURE
4. make a pull request
5. after merge, remove feature branch
feature/{new}
19
https://github.com/VinceG/vue-web-cam
Git clone ? Git Fork
Whats the different
- Adding vue cam + google vision > fork
DEMO - Git project
20
Review
What & why GIT Basic GIT
Follow rules
=
GIT FLOW
21
Thanks!
Any questions?
◇ @kelvin2go
Github https://github.com/kelvin2go
Web https://kelvinho.js.org
22
Credits
◇ Victor's GIT Presentation
◇ What is git
◇ Why git
Basic git https://guides.github.com/introduction/git-handbook/
Git flow https://gitbook.tw/chapters/gitflow/why-need-git-flow.html
23

Git kelvin

  • 1.
  • 2.
    Topics 💬 1. Whatis GIT ? 2. Why GIT is needed? 3. GIT Basic 4. GIT Rules ○ Do ○ Don’t 5. GIT flow 2
  • 3.
    Hello! ✋ I amKelvin Ho DCS play with nodejs / php You can find me at @kelvin2go https://github.com/kelvin2go March, 2019 3
  • 4.
    What is GIT? 👼 The introduction of GIT - Control system - Version control system - Distributed version control system 1
  • 5.
    “ 5 Control System - Storecontent / Code / file - Content tracker
  • 6.
    “ 6 Version Control System - Allowdeveloper add code in parallel - Keep history of changes - Git provide branches, merges, comparing
  • 7.
    Distributed Version Control System -Decentralized but centralized - Git has remote repo (which is same as everyone) - Every develop has own local repo - All develop have a copy of the code 7
  • 8.
    Why GIT isneeded?🚀 The reason of using git 2
  • 9.
    “ 9 Why Git isneeded? - The life before ({date}.zip, ftp, mess... ) - Flexibility - Allow different working Env ☝ - Allow different developers works on same project (add / changing code) - Peer reviews - Adding / revert version of the project - 70% dev (stackoverflow), Basic standard of code sharing
  • 10.
    “ 10 Why Git isneeded? (2) - Performance - Fast comparing commit - Security (user / ssh / code transmit) - continuous integration - automated test - https://about.gitlab.com/product/conti nuous-integration/
  • 11.
    GIT basic 🍎 Thebasic structure of GIT 3
  • 12.
    “ 12 GIT basic - Gitclone - Git pull - Git status - Git add - Git checkout - Git commit -m - Git push Demo: https://github.com/kelvin2go?tab=repositories Short cuts: https://github.com/kelvin2go/basic_init/blob/master/.bashrc#L15
  • 13.
  • 14.
    “ 14 GIT Structure Master - alwaysproduct-ready. Always GIT PULL REQUEST only. No direct commit Develop - always latest branch before next release. Always merge / git pull request from feature branch. Feature - New feature: when done, delete this branch Details: https://nvie.com/posts/a-successful-git-branching-model/
  • 15.
    GIT Rules 👪 Whenwe share a git repo, we need to follow some rules to keep it clean for everyone to access 15
  • 16.
    ◇ Use .gitingoreto avoid sharing privacy file ◇ git pull before work on anything ◇ Always pull from develop to start ◇ Each ENV (DEV / prod) should belong to one branch ◇ keep branch short life (* except develop / master) ◇ Long live branch don’t diverge (locale commit) ◇ Keep clean and easy to track for everyone ◇ Use Label / Tag if need other to notice ◇ Each feature branch should be follow a ticket ◇ Check the code after pull request + continuous integration Please Do 🙆 ✅ 16
  • 17.
    Don’t Don’t ...🙅❌ ◇ Use GIT as a file storage / NAS ■ Its keep track of code and project version ◇ Don’t commit / add private keys 🔑 / hash / token (it leaves in git history) ◇ Local merge without pushing ( all others cant keep track ) ◇ Don’t directly commit to master ◇ If doing HK, TW, KR , … , don’t one branch HK, TW, KR. using env to config ◇ Don’t open your own branch. Eg. Kelvin branch which is not shareable / distributed to anyone. ◇ Don’t Pull request / commit if the feature is not done ■ If we have to, label ‘not complete’ ◇ Don’t Commit conflict 17
  • 18.
    GIT FLOW 🐘> 🐉 - Rules + structure = git dev standard => GIT FLOW - There has many ways - Ready made command for easier git apt-get install git-flow git flow init Detail : https://danielkummer.github.io/git-flow-cheatsheet/ 18
  • 19.
    Feature : thefeature going add on develop 每一個 task 一條feature 用完 Merge 就 delete feature branch 1. Start: git flow feature start MYFEATURE 2. git add / git commit 3. done: git flow feature publish MYFEATURE 4. make a pull request 5. after merge, remove feature branch feature/{new} 19
  • 20.
    https://github.com/VinceG/vue-web-cam Git clone ?Git Fork Whats the different - Adding vue cam + google vision > fork DEMO - Git project 20
  • 21.
    Review What & whyGIT Basic GIT Follow rules = GIT FLOW 21
  • 22.
    Thanks! Any questions? ◇ @kelvin2go Githubhttps://github.com/kelvin2go Web https://kelvinho.js.org 22
  • 23.
    Credits ◇ Victor's GITPresentation ◇ What is git ◇ Why git Basic git https://guides.github.com/introduction/git-handbook/ Git flow https://gitbook.tw/chapters/gitflow/why-need-git-flow.html 23