SlideShare a Scribd company logo
1 of 80
Download to read offline
Continuous Integration with Git
2015.10.6
Blackie
What is Git
Different between Git and SVN
How could we become "Stronger" through the Git
Git tutorial
Implement Git on Xuenn
CI&CD example with DNG Team
Who am I
Blackie Tsai
Senior IT consultant of Xuenn
Full stack developer
Major on development of real-time transaction system with low latency and high concurrent
Learning CI&CD and run with Agile&LEAN
Blog
http://www.dotblogs.com.tw/blackie1019
Facing problems of Development
• Some CR require a long-period of development like 1 month
or more. And we have a lot of tickets need to patch to
UAT/PROD.
• Hard to merge with branch, and always miss some commit
logs when merge from each branch to trunk every time.
• Each branch will need create on the central repository and it
will bothering other people who collaborate with you.
• Some modules not own by the same team but need to
modify with another team change request.
• Every action will need connect to server and it’s slow and not
prevent for single point of failure.
Facing problems of Deployment
• No choice for release packages even we know this version
have defects.
• Hard to revert to any previous version, even we using SVN.
• If we need Jenkins help doing some automation with branch
out new repository . Always will need to modify/add some
steps of setting of Jenkins.
Facing problems of Project Management
• Can not doing frequently change with long-period development, even you
have enough development resource.
• Too many working hour waste on Merging and Releasing check.
• No quality when doing revert to any previous version.
Today Deployment Flow
Hotfix
Normal
Use Case - Revert
Now we have CR-1 and CR-2 deploy to UAT, but…
I found critical issue on CR-1, it cannot be
deployed to PROD.
Ok… revert CR-1 on UAT, I hope CR-2 can go live on
schedule.
I don’t have any build version can revert,
I need …..
A B C
Use Case - Revert : SVN
CR-1 CR-2
CR-1
CR-2
CR-1
CR-2
Use Case – Revert : Git
A B C
CR-1 CR-1 CR-2CR-2
CR-1 CR-2
CR-1 CR-2
WHAT IS GIT
Git Introduction
Git is a Free widely used version control system for software development. It is a version control system
with an emphasis on Speed, Data Integrity, and support for Distributed, Non-linear Workflows.
Git was born on 2005 to support Linux Kernal for source code management(they using Bitkeeper VCS
before Git) and handling thousands of developer operating in the same time(First commit with 670 billions
line of code).
Code Review become easy with using Pull request on Git(e.g. Github, BitBucket, Gitlab…etc).
DIFFERENT BETWEEN GIT AND SVN
Staging Area
Staging Area
Distribution
Distributed
Difference between SVN and Git
Or
Small and Fast - Fast
Small and Fast
Small and Fast - Size comparison
Original Git vs converted SVN. Original SVN vs converted Git.
Data Assurance
Data Assurance
Git is content-addressable file system
Git using KeyValue with SHA-1 to stored data with a UUID.
If the file contents are damaged, you will find different with SHA1.
If the tree to change the file name will be found.
This is important in distributed systems when data from one developer to another developer, ensure that the
information has not been modified
Git Object Types
Blob
Just a bunch of bytes that could be anything, like a text file, source code, or a picture, etc.
Tree
like a file system directory. A Git tree can point to, or include:
Git “blob” objects (similar to a file system directory includes file system files).
Other git trees (similar to a file system directory can have subdirectories).
Commit
Information about who committed (made) the change/check-in/commit. For example, it stores the name and email
address.
A pointer to the git tree object that represents the Git repository when the commit was done
The parent commit to this commit (so we can easily find out the situation at the previous commit).
Tag
Points to any Git commit object.
A Git tag can be used to refer to a specific tree, rather than having to
remember or use the hash of the tree.
ihower.tw - Git 內部原理、Git-內部原理-Git-物件、All Git Object Types: Blob, Tree, Commit And Tag
Data Assurance - Blob
Data Assurance - Tree
Data Assurance - Commit
Data Assurance – Commit(Multiple)
Branching-and-merging
Branching-and-merging
Pros and Cons
SVN Git
Pros • Newer system based on CVS
• Includes atomic operations
• Cheaper branch operations
• Wide variety of plug-ins for IDEs
• Does not use peer-to-peer model
• Great for those who hate CVS/SVN
• Dramatic increase in operation speed
• Cheap branch operations
• Full history tree available offline
• Distributed, peer-to-peer model
Cons • Still contains bugs relating to renaming files and
directories
• Insufficient repository management commands
• Slower comparative speed
• Learning curve for those used to SVN
• Not optimal for single developers
• Limited Windows support compared to Linux
http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/
Conclusion
Cheap Local Branching
Everything is Local
Git is Fast
Git is Small
The Staging Area
Distributed
Any Workflow
Easy to Learn
SaaS support like GitHub or Bitbucket
HOW COULD WE BECOME "STRONGER" THROUGH THE GIT
Recap Version Control System
Why we need it
Archives by others or themselves cover, even missing
Want to recover a few days ago version
Want to know where are the difference between writing before latest change.
Who changed this code and why
Need to be divided into Developer Edition and Production Edition
What are a VCS requirements
Establish Repository (repository), used to store code.
Easy to spread the program to the team, efficient collaborative development.
Records who changed what, at what time, for what reason.
Branch (branch), can be developed separately due to the different scenarios
Tag (Tag) an important milestone for reference
Local VCS
• Unable Collaborative
Development
e.g. Paste Folder/Files manually
Centralized VCS
• Need connect central
server and damn slow
• Single point of failure
e.g. CVS, SVN, Perforce
Distributed VCS
e.g. Git, Mercuria, Bazaar
• Fast and support offline
• Multivariate workflows
• Distributed, enable
scale out
Others…
From SVN to Git
為何改用 Git ?
我從 SVN 退役轉 Git 的三月有感
SVN is good but…
Git essential training & sharing self
Git - Branching
It means you can do something like below:
Change with experimental nature, for example you want to rewrite the new algorithm, code refactoring, etc.
CRG level change request development
Bug fixes, but you may need to do some experiments in the end did not know how to fix it
Example:
建立一個分支來試試新點子,提交 (commit) 個幾次然後切回你原本的分支,加上一個 patch 然後再切回剛剛實
驗用的分支,把它合併進來。或結果發現這樣行不通就刪掉這個分支;放棄一個分支,甚至沒有任何人知道它
曾經存在 (同時你還可以把其他的分支公佈出去)。
有一個分支只用來放要釋出的版本,另一個用來合併開發中的部份供測試,其他幾個小分支用來放每天的開發
工作,當正式環境需要哪一個版本的功能就拿該版本去發行使用。
替每一個你正在實做的新功能建立新的分支,然後你就可以平順的在它們之中切換,最後刪除掉每一個新功能
已經合併回主線的分支並且成功保留每個修改紀錄。
Git - Merging
Straight merge
Default mode of merge, there will be all merged branch commits record with a merge-commit, it look like two parent
lines, and retains all commit log.
Squashed commit
Compressed into only a merge-commit, will not remain the merged logs. Just like SVN merge.
Cherry-pick
Merge specific commit.
Rebase
Change branch point of the branch: Re-apply (or so-called patch) the current branch of commits to the branch of
rebase. This way just fit for not ready to sharing with others from local branch, cause they will delete all commits
record of current one.
For example, in "A" branch we branch a "B" branch as rebase one, will put all of A commits after recording the original
branch point, and then modify on the B branch commit, and after that commit into a new branch point of the latest
commit B branch.
https://ihower.tw/blog/archives/2620
Git - Merging : Fast-Forward
Merge with Fast-Forward
git merge --ff feature1
Merge without Fast-Forward
git merge --no-ff feature1
Git merge 時使用 fast-forward 的差別
Git - Theory
Git rebase 和 merge 合併操作示範錄影
Git - Merging : Rebase + Merge
http://www.librador.com/2013/11/15/Avoid-pull-merge-mess-in-Git/
Straight merge Rebase+Merge
Pull Request on other team repository
Fork
• Fork this project to your account.
Create
• Create a branch for the change you intend to make.
Commit
• Make your changes to your fork.
Request
• Send a pull request from your fork’s branch to our master branch.
Merge
• Owner review Contributor pull request and merge it to master branch.
Git-SCM : Git Request-Pull、Example with g0v
GIT TUTORIAL
Basic Git Flow Recap
Git Workflows Book
Git and SVN Command
Command Course
http://git.or.cz/course/svn.html
Git Flow and Command
https://github.com/mattharrison/Git-Supervisual-Cheatsheet
Code School – Try Git
https://try.github.io/
Git essential training & sharing self
IMPLEMENT GIT ON XUENN
Git Server
Practice : Bonobo
Git server with GUI support and hosted on windows IIS
Integrating with AD
Formal : GitLab
Similar with GitHub
Using Docker to setup GitLab CE
http://notes.jigsawye.com/2015/09/25/gitlab-ce-in-docker/
Evaluating : GitHub Enterprise
Just same with Github but using VM to provider data storage(Just like LDAP and CAS)
What is the best hosted version control service?
Git Tool
SVN Git migration
SubGit
介紹好用工具:SubGit ( 輕鬆將 SVN 專案移轉到 Git 的工具 )
Git-SVN
Git Command with SVN repository
Follow these guidelines(Git-SCM : Git 與 Subversion):
Keep a linear Git history that doesn’t contain merge commits made by Git merge. Rebase any work you do outside of your
mainline branch back onto it; don’t merge it in.
Don’t set up and collaborate on a separate Git server. Possibly have one to speed up clones for new developers, but don’t push
anything to it that doesn’t have a git-svn-id entry. You may even want to add a pre-receive hook that checks each commit
message for a git-svn-id and rejects pushes that contain commits without it.
Git Client
Git for windows (mysysGit) = GitBash + Git GUI
TortoiseGit
SourceTree
MVA: Using Git with Visual Studio 2013 Jump Start
Git Client - Setup
Basic
git config --global user.name Your Name
git config --global user.email your@email.com
git config --global color.ui true
Windows : new line issue
git config --global core.autocrlf true
git config --global core.safecrlf true
If you need proxy(http, https) or SSL setting
git config --global http.proxy http://account:password@proxy Domain:port
git config --global https.proxy https://account:password@proxy Domain:port
git config --global http.sslcainfo /bin/curl-ca-bundle.crt
* If the text you enter with special characters (such as $ #% ^ ... and other text), you need to convert content
into a special format character codes with HTML character codes .
Example:
If password is $RFV5tgb, it will need typing %24RFV5tgb to the setting
[Git]Using Git bash with Proxy setting
Git Client - .gitignore
Specifies intentionally untracked files to ignore
A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are
not affected; see the NOTES below for details.
A collection of .gitignore templates
https://github.com/github/gitignore
Recap Git tutorial
Create new repository or Clone someone
git init or git clone
Add new file from working directory to staging area
git add
Commit change (staging area to Git repository)
git commit -m “Do some change”
Check out now repository
git checkout
Revert to taget version with specific SHA1
git revert e37c75787
Do another modify and add to staging area
git add
Commit change
git commit -m “Revert to e37c75787 and do some change”
Push to Server
git push
Pull/Fetch from Server
git pull/ git fetch
Git Client - SourceTree
SourceTree is a free Mercurial and Git Client for Windows and Mac that provides a graphical interface for
your Hg and Git repositories.
Source Tree 簡介
Git Client – SourceTree : UI
Git Client – SourceTree : Configuration
Git Client – SourceTree : New Git Project
Git Client – SourceTree : Commit change
Git Client – SourceTree : Pull
Git Client – SourceTree : Push
CI&CD EXAMPLE WITH DNG TEAM
Development Evolution
Plan Code Build Test Release Deploy Operate
Agile Development
Continuous Integration
Continuous Deployment
DevOps
DNG Team
Development
• Specify
• Code
• Unit Test
• Integration Test
• Version Control
CI/CD
• Build
• Auto Test
• Human Verify
• Release Control
• PROD Release
Ops
• Logging
• Monitoring
YT Support Monitoring
Daily Monitoring
Connection
Memory
CPU
RTX Support Site
LogCollector+ LogParser
LogCollecotr
Bat
Client
Server
LogFileMaintainer
LogToSQL
PurgeLog
LogParser
Visualize result of chart
Jenkins Automation Test and Daily Release
Unit Test(Single domain)
Integration Test(Multiple domain)
Auto Test(Using selenium)
Simple Continue Integration with Git - Graphic
Git, Feature Branches, and Jenkins – or how I learned to stop worrying about broken builds
Simple Continue Integration with Git - Flow
SVN Regular Release Flow
ITC
Local
DEV QAT UAT PROD
Get new CR
or ticket
Checkout
for fix bug
Build
Deploy
Unit Test
Auto test
Sanity test
Push to UAT
Deployment
Merge to PROD
Deployment
Merge to QAT
Commit
Build
Deploy
Unit Test
Auto test
Git Regular Release Flow
Master
(PRD)
Test
Env.
QAT UAT
Test
Env.
DEV
ITC
Local
Get new CR
or ticket
Checkout
for fix bug
Build
Deploy
Unit Test
Auto test
All success
Push and merge
to DEV
Follow this rule to
make each ticket as a
node
Build
Deploy
Unit Test
Auto test
All success
Merge to QAT
Now we get other
QAT note
After QA human test,
There only two days
QAT can merge to UAT
Rebase to Master,
do PROD deployment
Git UAT Patch Flow
Master
(PRD)
Test
Env.
QAT UAT
Test
Env.
DEV
ITC
Local
Merge to UAT to do RUU
then rebase to Master
UAT has issue
Checkout
for patch
Build
Deploy
Unit Test
Auto test
All success
Push and merge to
DEV
Now we can merge
this to any
environment.
Rebase to Master,
do hotfix
Git PROD Hotfix Flow
Master
(PRD)
Test
Env.
QAT UAT
Test
Env.
DEV
ITC
Local
Merge to UAT to do RUU
then rebase to Master
PROD has issue
needs hotfix
Checkout
for hotfix
Build
Deploy
Unit Test
Auto test
All success
Push and merge to
DEV
Now we can merge
this to any
environment.
Rebase to Master,
do hotfix
Gateway CheckIn Pattern = Jenkins + Git Good Practice
JenkinsとGitで実装するGatewayCheckIn Pattern
Gateway CheckIn Pattern : Single Developer
Gateway CheckIn Pattern : Multiple Developer
DNG Team Next Move
Development
• Specify
• Code
• Unit Test
• Integration Test
• Version Control
CI/CD
• Build
• Auto Test
• Human Verify
• Release Control
• PROD Release
Ops
• Logging
• Monitoring
No Silver Bullet
Continuous Improvement on Xuenn
Reference
GitSvnComparison
Why Git is Better than X
Which repository is more compact: Git or SVN?
Git more done
Git Introduction
Git Tutorial from Alpha Camp
Merging vs Rebasing
Pro Git
版本控制使用Git - 第二版
完整學會Git GitHub Git Server的24堂課
Git essential training & sharing self

More Related Content

What's hot

Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...fureigh
 
Docs or it didn’t happen
Docs or it didn’t happenDocs or it didn’t happen
Docs or it didn’t happenAll Things Open
 
Continuous Delivery NYC: From GitOps to an adaptable CI/CD Pattern for Kubern...
Continuous Delivery NYC: From GitOps to an adaptable CI/CD Pattern for Kubern...Continuous Delivery NYC: From GitOps to an adaptable CI/CD Pattern for Kubern...
Continuous Delivery NYC: From GitOps to an adaptable CI/CD Pattern for Kubern...Andrew Phillips
 
2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_finalMythri P K
 
Preventing Supply Chain Attacks on Open Source Software
Preventing Supply Chain Attacks on Open Source SoftwarePreventing Supply Chain Attacks on Open Source Software
Preventing Supply Chain Attacks on Open Source SoftwareAll Things Open
 
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...Edureka!
 
Docker New York City: From GitOps to a scalable CI/CD Pattern for Kubernetes
Docker New York City: From GitOps to a scalable CI/CD Pattern for KubernetesDocker New York City: From GitOps to a scalable CI/CD Pattern for Kubernetes
Docker New York City: From GitOps to a scalable CI/CD Pattern for KubernetesAndrew Phillips
 
Master Continuous Delivery with CloudBees Jenkins Platform
Master Continuous Delivery with CloudBees Jenkins PlatformMaster Continuous Delivery with CloudBees Jenkins Platform
Master Continuous Delivery with CloudBees Jenkins Platformdcjuengst
 
Building our Component Library
Building our Component LibraryBuilding our Component Library
Building our Component LibraryClement Ho
 
Continuous Lifecycle London 2018 Event Keynote
Continuous Lifecycle London 2018 Event KeynoteContinuous Lifecycle London 2018 Event Keynote
Continuous Lifecycle London 2018 Event KeynoteWeaveworks
 
Using Git/Gerrit and Jenkins to Manage the Code Review Processord
Using Git/Gerrit and Jenkins to Manage the Code Review ProcessordUsing Git/Gerrit and Jenkins to Manage the Code Review Processord
Using Git/Gerrit and Jenkins to Manage the Code Review ProcessordMarc Karasek
 
The journey to GitOps
The journey to GitOpsThe journey to GitOps
The journey to GitOpsNicola Baldi
 
Speeding up your team with GitOps
Speeding up your team with GitOpsSpeeding up your team with GitOps
Speeding up your team with GitOpsBrice Fernandes
 
Git strategies for DevOps
Git strategies for DevOpsGit strategies for DevOps
Git strategies for DevOpsAhmad Iqbal Ali
 
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14msohn
 

What's hot (20)

Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...Git in gear: How to track changes, travel back in time, and code nicely with ...
Git in gear: How to track changes, travel back in time, and code nicely with ...
 
Docs or it didn’t happen
Docs or it didn’t happenDocs or it didn’t happen
Docs or it didn’t happen
 
Continuous Delivery NYC: From GitOps to an adaptable CI/CD Pattern for Kubern...
Continuous Delivery NYC: From GitOps to an adaptable CI/CD Pattern for Kubern...Continuous Delivery NYC: From GitOps to an adaptable CI/CD Pattern for Kubern...
Continuous Delivery NYC: From GitOps to an adaptable CI/CD Pattern for Kubern...
 
2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final
 
Preventing Supply Chain Attacks on Open Source Software
Preventing Supply Chain Attacks on Open Source SoftwarePreventing Supply Chain Attacks on Open Source Software
Preventing Supply Chain Attacks on Open Source Software
 
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
 
Docker New York City: From GitOps to a scalable CI/CD Pattern for Kubernetes
Docker New York City: From GitOps to a scalable CI/CD Pattern for KubernetesDocker New York City: From GitOps to a scalable CI/CD Pattern for Kubernetes
Docker New York City: From GitOps to a scalable CI/CD Pattern for Kubernetes
 
Git best practices 2016
Git best practices 2016Git best practices 2016
Git best practices 2016
 
Master Continuous Delivery with CloudBees Jenkins Platform
Master Continuous Delivery with CloudBees Jenkins PlatformMaster Continuous Delivery with CloudBees Jenkins Platform
Master Continuous Delivery with CloudBees Jenkins Platform
 
Building our Component Library
Building our Component LibraryBuilding our Component Library
Building our Component Library
 
版本控制Git
版本控制Git版本控制Git
版本控制Git
 
Continuous Lifecycle London 2018 Event Keynote
Continuous Lifecycle London 2018 Event KeynoteContinuous Lifecycle London 2018 Event Keynote
Continuous Lifecycle London 2018 Event Keynote
 
Gerrit Code Review
Gerrit Code ReviewGerrit Code Review
Gerrit Code Review
 
Using Git/Gerrit and Jenkins to Manage the Code Review Processord
Using Git/Gerrit and Jenkins to Manage the Code Review ProcessordUsing Git/Gerrit and Jenkins to Manage the Code Review Processord
Using Git/Gerrit and Jenkins to Manage the Code Review Processord
 
The journey to GitOps
The journey to GitOpsThe journey to GitOps
The journey to GitOps
 
Gerrit Workshop
Gerrit WorkshopGerrit Workshop
Gerrit Workshop
 
Gerrit Code Review
Gerrit Code ReviewGerrit Code Review
Gerrit Code Review
 
Speeding up your team with GitOps
Speeding up your team with GitOpsSpeeding up your team with GitOps
Speeding up your team with GitOps
 
Git strategies for DevOps
Git strategies for DevOpsGit strategies for DevOps
Git strategies for DevOps
 
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
 

Similar to Git essential training & sharing self

Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)Yeasin Abedin
 
BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersMartin Jinoch
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow Sebin Benjamin
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02Gourav Varma
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystemFrançois D'Agostini
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdfAliaaTarek5
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticlePRIYATHAMDARISI
 
Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | EdurekaEdureka!
 
You can git
You can gitYou can git
You can gitYu GUAN
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 

Similar to Git essential training & sharing self (20)

Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes Developers
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Git session 1
Git session 1Git session 1
Git session 1
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Git and Github - A primer
Git and Github - A primerGit and Github - A primer
Git and Github - A primer
 
Git Training
Git TrainingGit Training
Git Training
 
Webinar : SVN to GIT Migration
Webinar : SVN to GIT Migration Webinar : SVN to GIT Migration
Webinar : SVN to GIT Migration
 
Git Presentation
Git PresentationGit Presentation
Git Presentation
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystem
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Git
GitGit
Git
 
Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | Edureka
 
Git introduction
Git introductionGit introduction
Git introduction
 
You can git
You can gitYou can git
You can git
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Introduction to git & github
Introduction to git & githubIntroduction to git & github
Introduction to git & github
 

More from Chen-Tien Tsai

關於軟體工程師職涯的那些事
關於軟體工程師職涯的那些事關於軟體工程師職涯的那些事
關於軟體工程師職涯的那些事Chen-Tien Tsai
 
Artifacts management with CI and CD
Artifacts management with CI and CDArtifacts management with CI and CD
Artifacts management with CI and CDChen-Tien Tsai
 
.NET Security Application/Web Development - Part IV
.NET Security Application/Web Development - Part IV.NET Security Application/Web Development - Part IV
.NET Security Application/Web Development - Part IVChen-Tien Tsai
 
.NET Security Application/Web Development - Part III
.NET Security Application/Web Development - Part III.NET Security Application/Web Development - Part III
.NET Security Application/Web Development - Part IIIChen-Tien Tsai
 
.NET Security Application/Web Development - Part II
.NET Security Application/Web Development - Part II.NET Security Application/Web Development - Part II
.NET Security Application/Web Development - Part IIChen-Tien Tsai
 
.NET Security Application/Web Development - Part I
.NET Security Application/Web Development - Part I.NET Security Application/Web Development - Part I
.NET Security Application/Web Development - Part IChen-Tien Tsai
 
.NET Security Application/Web Development - Overview
.NET Security Application/Web Development - Overview.NET Security Application/Web Development - Overview
.NET Security Application/Web Development - OverviewChen-Tien Tsai
 
Designing distributedsystems cht6
Designing distributedsystems cht6Designing distributedsystems cht6
Designing distributedsystems cht6Chen-Tien Tsai
 
Reactive application with akka.NET & .NET Core
Reactive application with akka.NET & .NET CoreReactive application with akka.NET & .NET Core
Reactive application with akka.NET & .NET CoreChen-Tien Tsai
 
The Cloud - What's different
The Cloud - What's differentThe Cloud - What's different
The Cloud - What's differentChen-Tien Tsai
 
How to be a professional speaker
How to be a professional speakerHow to be a professional speaker
How to be a professional speakerChen-Tien Tsai
 
響應式程式開發之 .NET Core 應用 
響應式程式開發之 .NET Core 應用 響應式程式開發之 .NET Core 應用 
響應式程式開發之 .NET Core 應用 Chen-Tien Tsai
 
Artifacts management with DevOps
Artifacts management with DevOpsArtifacts management with DevOps
Artifacts management with DevOpsChen-Tien Tsai
 
Web optimization with service woker
Web optimization with service wokerWeb optimization with service woker
Web optimization with service wokerChen-Tien Tsai
 
GCPUG.TW Meetup #25 - ASP.NET Core with GCP
GCPUG.TW Meetup #25 - ASP.NET Core with GCPGCPUG.TW Meetup #25 - ASP.NET Core with GCP
GCPUG.TW Meetup #25 - ASP.NET Core with GCPChen-Tien Tsai
 
.NET Study Group - ASP.NET Core with GCP
.NET Study Group - ASP.NET Core with GCP.NET Study Group - ASP.NET Core with GCP
.NET Study Group - ASP.NET Core with GCPChen-Tien Tsai
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance OptimizationChen-Tien Tsai
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactChen-Tien Tsai
 
Website Auto scraping with Autoit and .Net HttpRequest
Website Auto scraping with Autoit and .Net HttpRequestWebsite Auto scraping with Autoit and .Net HttpRequest
Website Auto scraping with Autoit and .Net HttpRequestChen-Tien Tsai
 

More from Chen-Tien Tsai (20)

關於軟體工程師職涯的那些事
關於軟體工程師職涯的那些事關於軟體工程師職涯的那些事
關於軟體工程師職涯的那些事
 
Artifacts management with CI and CD
Artifacts management with CI and CDArtifacts management with CI and CD
Artifacts management with CI and CD
 
.NET Security Application/Web Development - Part IV
.NET Security Application/Web Development - Part IV.NET Security Application/Web Development - Part IV
.NET Security Application/Web Development - Part IV
 
.NET Security Application/Web Development - Part III
.NET Security Application/Web Development - Part III.NET Security Application/Web Development - Part III
.NET Security Application/Web Development - Part III
 
.NET Security Application/Web Development - Part II
.NET Security Application/Web Development - Part II.NET Security Application/Web Development - Part II
.NET Security Application/Web Development - Part II
 
.NET Security Application/Web Development - Part I
.NET Security Application/Web Development - Part I.NET Security Application/Web Development - Part I
.NET Security Application/Web Development - Part I
 
.NET Security Application/Web Development - Overview
.NET Security Application/Web Development - Overview.NET Security Application/Web Development - Overview
.NET Security Application/Web Development - Overview
 
Designing distributedsystems cht6
Designing distributedsystems cht6Designing distributedsystems cht6
Designing distributedsystems cht6
 
Reactive application with akka.NET & .NET Core
Reactive application with akka.NET & .NET CoreReactive application with akka.NET & .NET Core
Reactive application with akka.NET & .NET Core
 
The Cloud - What's different
The Cloud - What's differentThe Cloud - What's different
The Cloud - What's different
 
How to be a professional speaker
How to be a professional speakerHow to be a professional speaker
How to be a professional speaker
 
Agile tutorial
Agile tutorialAgile tutorial
Agile tutorial
 
響應式程式開發之 .NET Core 應用 
響應式程式開發之 .NET Core 應用 響應式程式開發之 .NET Core 應用 
響應式程式開發之 .NET Core 應用 
 
Artifacts management with DevOps
Artifacts management with DevOpsArtifacts management with DevOps
Artifacts management with DevOps
 
Web optimization with service woker
Web optimization with service wokerWeb optimization with service woker
Web optimization with service woker
 
GCPUG.TW Meetup #25 - ASP.NET Core with GCP
GCPUG.TW Meetup #25 - ASP.NET Core with GCPGCPUG.TW Meetup #25 - ASP.NET Core with GCP
GCPUG.TW Meetup #25 - ASP.NET Core with GCP
 
.NET Study Group - ASP.NET Core with GCP
.NET Study Group - ASP.NET Core with GCP.NET Study Group - ASP.NET Core with GCP
.NET Study Group - ASP.NET Core with GCP
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance Optimization
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
 
Website Auto scraping with Autoit and .Net HttpRequest
Website Auto scraping with Autoit and .Net HttpRequestWebsite Auto scraping with Autoit and .Net HttpRequest
Website Auto scraping with Autoit and .Net HttpRequest
 

Recently uploaded

JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIIvo Andreev
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeNeo4j
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesShyamsundar Das
 
Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxJoão Esperancinha
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorShane Coughlan
 
Enterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze IncEnterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze Incrobinwilliams8624
 
Kawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampVICTOR MAESTRE RAMIREZ
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilVICTOR MAESTRE RAMIREZ
 
eAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionseAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionsNirav Modi
 
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsYour Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsJaydeep Chhasatia
 
AI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyAI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyRaymond Okyere-Forson
 
How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?AmeliaSmith90
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdfMeon Technology
 
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfTobias Schneck
 
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLBig Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLAlluxio, Inc.
 
Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesSoftwareMill
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Jaydeep Chhasatia
 
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageSales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageDista
 

Recently uploaded (20)

JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AI
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG time
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security Challenges
 
Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptx
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS Calculator
 
Enterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze IncEnterprise Document Management System - Qualityze Inc
Enterprise Document Management System - Qualityze Inc
 
Kawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in TrivandrumKawika Technologies pvt ltd Software Development Company in Trivandrum
Kawika Technologies pvt ltd Software Development Company in Trivandrum
 
Salesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptxSalesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptx
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - Datacamp
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-Council
 
eAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspectionseAuditor Audits & Inspections - conduct field inspections
eAuditor Audits & Inspections - conduct field inspections
 
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsYour Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
 
AI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyAI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human Beauty
 
How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdf
 
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
 
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLBig Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
 
Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retries
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
 
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageSales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
 

Git essential training & sharing self

  • 1. Continuous Integration with Git 2015.10.6 Blackie
  • 2. What is Git Different between Git and SVN How could we become "Stronger" through the Git Git tutorial Implement Git on Xuenn CI&CD example with DNG Team
  • 3. Who am I Blackie Tsai Senior IT consultant of Xuenn Full stack developer Major on development of real-time transaction system with low latency and high concurrent Learning CI&CD and run with Agile&LEAN Blog http://www.dotblogs.com.tw/blackie1019
  • 4. Facing problems of Development • Some CR require a long-period of development like 1 month or more. And we have a lot of tickets need to patch to UAT/PROD. • Hard to merge with branch, and always miss some commit logs when merge from each branch to trunk every time. • Each branch will need create on the central repository and it will bothering other people who collaborate with you. • Some modules not own by the same team but need to modify with another team change request. • Every action will need connect to server and it’s slow and not prevent for single point of failure.
  • 5. Facing problems of Deployment • No choice for release packages even we know this version have defects. • Hard to revert to any previous version, even we using SVN. • If we need Jenkins help doing some automation with branch out new repository . Always will need to modify/add some steps of setting of Jenkins.
  • 6. Facing problems of Project Management • Can not doing frequently change with long-period development, even you have enough development resource. • Too many working hour waste on Merging and Releasing check. • No quality when doing revert to any previous version.
  • 8. Use Case - Revert Now we have CR-1 and CR-2 deploy to UAT, but… I found critical issue on CR-1, it cannot be deployed to PROD. Ok… revert CR-1 on UAT, I hope CR-2 can go live on schedule. I don’t have any build version can revert, I need …..
  • 9. A B C Use Case - Revert : SVN CR-1 CR-2 CR-1 CR-2 CR-1 CR-2
  • 10. Use Case – Revert : Git A B C CR-1 CR-1 CR-2CR-2 CR-1 CR-2 CR-1 CR-2
  • 12. Git Introduction Git is a Free widely used version control system for software development. It is a version control system with an emphasis on Speed, Data Integrity, and support for Distributed, Non-linear Workflows. Git was born on 2005 to support Linux Kernal for source code management(they using Bitkeeper VCS before Git) and handling thousands of developer operating in the same time(First commit with 670 billions line of code). Code Review become easy with using Pull request on Git(e.g. Github, BitBucket, Gitlab…etc).
  • 16. Small and Fast - Fast Small and Fast
  • 17. Small and Fast - Size comparison Original Git vs converted SVN. Original SVN vs converted Git.
  • 18. Data Assurance Data Assurance Git is content-addressable file system Git using KeyValue with SHA-1 to stored data with a UUID. If the file contents are damaged, you will find different with SHA1. If the tree to change the file name will be found. This is important in distributed systems when data from one developer to another developer, ensure that the information has not been modified
  • 19. Git Object Types Blob Just a bunch of bytes that could be anything, like a text file, source code, or a picture, etc. Tree like a file system directory. A Git tree can point to, or include: Git “blob” objects (similar to a file system directory includes file system files). Other git trees (similar to a file system directory can have subdirectories). Commit Information about who committed (made) the change/check-in/commit. For example, it stores the name and email address. A pointer to the git tree object that represents the Git repository when the commit was done The parent commit to this commit (so we can easily find out the situation at the previous commit). Tag Points to any Git commit object. A Git tag can be used to refer to a specific tree, rather than having to remember or use the hash of the tree. ihower.tw - Git 內部原理、Git-內部原理-Git-物件、All Git Object Types: Blob, Tree, Commit And Tag
  • 23. Data Assurance – Commit(Multiple)
  • 25. Pros and Cons SVN Git Pros • Newer system based on CVS • Includes atomic operations • Cheaper branch operations • Wide variety of plug-ins for IDEs • Does not use peer-to-peer model • Great for those who hate CVS/SVN • Dramatic increase in operation speed • Cheap branch operations • Full history tree available offline • Distributed, peer-to-peer model Cons • Still contains bugs relating to renaming files and directories • Insufficient repository management commands • Slower comparative speed • Learning curve for those used to SVN • Not optimal for single developers • Limited Windows support compared to Linux http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/
  • 26. Conclusion Cheap Local Branching Everything is Local Git is Fast Git is Small The Staging Area Distributed Any Workflow Easy to Learn SaaS support like GitHub or Bitbucket
  • 27. HOW COULD WE BECOME "STRONGER" THROUGH THE GIT
  • 28. Recap Version Control System Why we need it Archives by others or themselves cover, even missing Want to recover a few days ago version Want to know where are the difference between writing before latest change. Who changed this code and why Need to be divided into Developer Edition and Production Edition What are a VCS requirements Establish Repository (repository), used to store code. Easy to spread the program to the team, efficient collaborative development. Records who changed what, at what time, for what reason. Branch (branch), can be developed separately due to the different scenarios Tag (Tag) an important milestone for reference
  • 29. Local VCS • Unable Collaborative Development e.g. Paste Folder/Files manually
  • 30. Centralized VCS • Need connect central server and damn slow • Single point of failure e.g. CVS, SVN, Perforce
  • 31. Distributed VCS e.g. Git, Mercuria, Bazaar • Fast and support offline • Multivariate workflows • Distributed, enable scale out
  • 32. Others… From SVN to Git 為何改用 Git ? 我從 SVN 退役轉 Git 的三月有感
  • 33. SVN is good but…
  • 35. Git - Branching It means you can do something like below: Change with experimental nature, for example you want to rewrite the new algorithm, code refactoring, etc. CRG level change request development Bug fixes, but you may need to do some experiments in the end did not know how to fix it Example: 建立一個分支來試試新點子,提交 (commit) 個幾次然後切回你原本的分支,加上一個 patch 然後再切回剛剛實 驗用的分支,把它合併進來。或結果發現這樣行不通就刪掉這個分支;放棄一個分支,甚至沒有任何人知道它 曾經存在 (同時你還可以把其他的分支公佈出去)。 有一個分支只用來放要釋出的版本,另一個用來合併開發中的部份供測試,其他幾個小分支用來放每天的開發 工作,當正式環境需要哪一個版本的功能就拿該版本去發行使用。 替每一個你正在實做的新功能建立新的分支,然後你就可以平順的在它們之中切換,最後刪除掉每一個新功能 已經合併回主線的分支並且成功保留每個修改紀錄。
  • 36. Git - Merging Straight merge Default mode of merge, there will be all merged branch commits record with a merge-commit, it look like two parent lines, and retains all commit log. Squashed commit Compressed into only a merge-commit, will not remain the merged logs. Just like SVN merge. Cherry-pick Merge specific commit. Rebase Change branch point of the branch: Re-apply (or so-called patch) the current branch of commits to the branch of rebase. This way just fit for not ready to sharing with others from local branch, cause they will delete all commits record of current one. For example, in "A" branch we branch a "B" branch as rebase one, will put all of A commits after recording the original branch point, and then modify on the B branch commit, and after that commit into a new branch point of the latest commit B branch. https://ihower.tw/blog/archives/2620
  • 37. Git - Merging : Fast-Forward Merge with Fast-Forward git merge --ff feature1 Merge without Fast-Forward git merge --no-ff feature1 Git merge 時使用 fast-forward 的差別
  • 38. Git - Theory Git rebase 和 merge 合併操作示範錄影
  • 39. Git - Merging : Rebase + Merge http://www.librador.com/2013/11/15/Avoid-pull-merge-mess-in-Git/ Straight merge Rebase+Merge
  • 40. Pull Request on other team repository Fork • Fork this project to your account. Create • Create a branch for the change you intend to make. Commit • Make your changes to your fork. Request • Send a pull request from your fork’s branch to our master branch. Merge • Owner review Contributor pull request and merge it to master branch. Git-SCM : Git Request-Pull、Example with g0v
  • 42. Basic Git Flow Recap Git Workflows Book
  • 43. Git and SVN Command Command Course http://git.or.cz/course/svn.html
  • 44. Git Flow and Command https://github.com/mattharrison/Git-Supervisual-Cheatsheet
  • 45. Code School – Try Git https://try.github.io/
  • 48. Git Server Practice : Bonobo Git server with GUI support and hosted on windows IIS Integrating with AD Formal : GitLab Similar with GitHub Using Docker to setup GitLab CE http://notes.jigsawye.com/2015/09/25/gitlab-ce-in-docker/ Evaluating : GitHub Enterprise Just same with Github but using VM to provider data storage(Just like LDAP and CAS) What is the best hosted version control service?
  • 49. Git Tool SVN Git migration SubGit 介紹好用工具:SubGit ( 輕鬆將 SVN 專案移轉到 Git 的工具 ) Git-SVN Git Command with SVN repository Follow these guidelines(Git-SCM : Git 與 Subversion): Keep a linear Git history that doesn’t contain merge commits made by Git merge. Rebase any work you do outside of your mainline branch back onto it; don’t merge it in. Don’t set up and collaborate on a separate Git server. Possibly have one to speed up clones for new developers, but don’t push anything to it that doesn’t have a git-svn-id entry. You may even want to add a pre-receive hook that checks each commit message for a git-svn-id and rejects pushes that contain commits without it. Git Client Git for windows (mysysGit) = GitBash + Git GUI TortoiseGit SourceTree MVA: Using Git with Visual Studio 2013 Jump Start
  • 50. Git Client - Setup Basic git config --global user.name Your Name git config --global user.email your@email.com git config --global color.ui true Windows : new line issue git config --global core.autocrlf true git config --global core.safecrlf true If you need proxy(http, https) or SSL setting git config --global http.proxy http://account:password@proxy Domain:port git config --global https.proxy https://account:password@proxy Domain:port git config --global http.sslcainfo /bin/curl-ca-bundle.crt * If the text you enter with special characters (such as $ #% ^ ... and other text), you need to convert content into a special format character codes with HTML character codes . Example: If password is $RFV5tgb, it will need typing %24RFV5tgb to the setting [Git]Using Git bash with Proxy setting
  • 51. Git Client - .gitignore Specifies intentionally untracked files to ignore A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected; see the NOTES below for details. A collection of .gitignore templates https://github.com/github/gitignore
  • 52. Recap Git tutorial Create new repository or Clone someone git init or git clone Add new file from working directory to staging area git add Commit change (staging area to Git repository) git commit -m “Do some change” Check out now repository git checkout Revert to taget version with specific SHA1 git revert e37c75787 Do another modify and add to staging area git add Commit change git commit -m “Revert to e37c75787 and do some change” Push to Server git push Pull/Fetch from Server git pull/ git fetch
  • 53. Git Client - SourceTree SourceTree is a free Mercurial and Git Client for Windows and Mac that provides a graphical interface for your Hg and Git repositories. Source Tree 簡介
  • 54. Git Client – SourceTree : UI
  • 55. Git Client – SourceTree : Configuration
  • 56. Git Client – SourceTree : New Git Project
  • 57. Git Client – SourceTree : Commit change
  • 58. Git Client – SourceTree : Pull
  • 59. Git Client – SourceTree : Push
  • 60. CI&CD EXAMPLE WITH DNG TEAM
  • 61. Development Evolution Plan Code Build Test Release Deploy Operate Agile Development Continuous Integration Continuous Deployment DevOps
  • 62. DNG Team Development • Specify • Code • Unit Test • Integration Test • Version Control CI/CD • Build • Auto Test • Human Verify • Release Control • PROD Release Ops • Logging • Monitoring
  • 63. YT Support Monitoring Daily Monitoring Connection Memory CPU
  • 66. Jenkins Automation Test and Daily Release Unit Test(Single domain) Integration Test(Multiple domain) Auto Test(Using selenium)
  • 67. Simple Continue Integration with Git - Graphic Git, Feature Branches, and Jenkins – or how I learned to stop worrying about broken builds
  • 68. Simple Continue Integration with Git - Flow
  • 69. SVN Regular Release Flow ITC Local DEV QAT UAT PROD Get new CR or ticket Checkout for fix bug Build Deploy Unit Test Auto test Sanity test Push to UAT Deployment Merge to PROD Deployment Merge to QAT Commit Build Deploy Unit Test Auto test
  • 70. Git Regular Release Flow Master (PRD) Test Env. QAT UAT Test Env. DEV ITC Local Get new CR or ticket Checkout for fix bug Build Deploy Unit Test Auto test All success Push and merge to DEV Follow this rule to make each ticket as a node Build Deploy Unit Test Auto test All success Merge to QAT Now we get other QAT note After QA human test, There only two days QAT can merge to UAT Rebase to Master, do PROD deployment
  • 71. Git UAT Patch Flow Master (PRD) Test Env. QAT UAT Test Env. DEV ITC Local Merge to UAT to do RUU then rebase to Master UAT has issue Checkout for patch Build Deploy Unit Test Auto test All success Push and merge to DEV Now we can merge this to any environment. Rebase to Master, do hotfix
  • 72. Git PROD Hotfix Flow Master (PRD) Test Env. QAT UAT Test Env. DEV ITC Local Merge to UAT to do RUU then rebase to Master PROD has issue needs hotfix Checkout for hotfix Build Deploy Unit Test Auto test All success Push and merge to DEV Now we can merge this to any environment. Rebase to Master, do hotfix
  • 73. Gateway CheckIn Pattern = Jenkins + Git Good Practice JenkinsとGitで実装するGatewayCheckIn Pattern
  • 74. Gateway CheckIn Pattern : Single Developer
  • 75. Gateway CheckIn Pattern : Multiple Developer
  • 76. DNG Team Next Move Development • Specify • Code • Unit Test • Integration Test • Version Control CI/CD • Build • Auto Test • Human Verify • Release Control • PROD Release Ops • Logging • Monitoring
  • 79. Reference GitSvnComparison Why Git is Better than X Which repository is more compact: Git or SVN? Git more done Git Introduction Git Tutorial from Alpha Camp Merging vs Rebasing Pro Git 版本控制使用Git - 第二版 完整學會Git GitHub Git Server的24堂課

Editor's Notes

  1. Git 是Linux開發人 Linus Torvalds用英國俚語裡面笨蛋或呆子的意思來命名, 另外有一群人則稱為Global Information Tracker Who using Git: Git ‧Linux Kernel ‧Ruby on Rails ‧Perl ‧Eclipse ‧Android ‧PostgreSQL 18 ‧Google ‧Microsoft ‧Facebook ‧Twiter ‧LinkedIn ‧Adobe ‧IBM
  2. 和其他系統不一樣,Git 有它稱為 "staging area" 或 "index" 的東西。 這是一個中間地帶讓你可以在提交前設定你想要提交什麼。 Staging area 最酷的地方,讓 Git 遠遠拋開其他工具的,就是你可以輕易的 在工作告一段落後 stage 一些你的檔案,然後提交上去而不需要提交所有修改過的檔案,或是必須在命令列上列出所有想要提交的檔案。 這還允許你只 stage 修改過的檔案的一部分。 想像有一天你對一個檔案做了兩項毫不相關的修改,然後你發現忘了先提交其中一個。 現在你可以只 stage 你現在要提交的部份,然後在 stage 剩下的改變給下一次提交。 這個功能可擴大應用到任何你對檔案的改變。 當然了,Git 也可以很簡單的略過這些特性。 如果你不想要控制這麼多 — 只要加上 '-a' 到你的 commit 命令就可以一次把所有的修改都丟到 staging area 去。
  3. 任何分散式 SCM,當然包括 Git,最酷的功能之一就是它是分散式的。 這表示你不是只 "checkout" 目前最新版的原始碼,而是 "clone" 整個倉儲。 這表示甚至你是使用中央集中式的工作流程,每一位使用者都有會一份主伺服器的備份,每一份都可以在主伺服器當機或損壞時推上去取代主伺服器。 基本上使用 Git 不會因為遺失單一的點而造成災難,除非就只有那一個點。 而且這不會使得操作變慢太多。平均來說,一次 SVN 的 checkout 只比其他 DSCM 快一點。 當然在我測試過的 DSCM 中,Git 是最快的。 Git1m 59sHg2m 24sBzr5m 11sSVN1m 4s svn perforce 適用任何工作流程 其中一個 Git 令人驚訝的事情就是因為它的分散式設計以及超級分支系統,你可以輕易的實做出幾乎任何你想得到的工作流程。 Subversion 式的工作流程 這是一種很常見的 Git 工作流程,特別是那些從集中管理式系統轉換過來的人會使用的,是一種集中管理式的工作流程。 如果在你最後一次 fetch 後有人發布過改變,Git 不會允許你跟著發布,所以使用這種集中式的模型,所有的開發人員都發布到同一個伺服器也可以工作的很好。 整合管理員工作流程 另外一種常見的 Git 工作流程就是有一個整合管理員 — 一個負責提交到 'blessed' 倉儲的人,然後其他數位開發人員從這個倉儲複製,發布到他們自己的獨立倉儲去,然後要求整合者 pull 他們的修改。 這是在開放原始碼界或是 GitHub 倉儲上常見的開發模型。 司令官與副手的工作流程 對於一些更複雜的專案,你可以讓你的開發人員們使用類似於 Linux 核心的開發流程,開發人員們各自負責專案中不同的子系統 (副手) 然後合併所有關於此子系統的改變。另外一位整合者 (司令官) 只可以從他的副手手上 pull 改變,然後發布到 'blessed' 倉儲讓所有人都可以複製回去。 在一次的,Git 是完全非常有彈性的,所以你可以混合和取用適合你的工作流程。
  4. Git 可以說是一種用檔案內容來定位的檔案系統,SHA1 是根據內容產生的,跟檔名無關。內容一樣的檔案,即使檔案名稱不同,在Repository裡仍然只存一份。解耦合(decouple)了內容與當時的檔名。 所謂的SHA-1是一種單向 Hash 雜湊加密演算法,例如它會將hello字串單向加密成為aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d。這個演算法有以下特性: 給定 message 容易計算出 hash 極度困難從 hash 推回 message 極度困難修改 message 而 hash 不變 極度困難不同的 messages 而 hash 一樣 hash 的分布很分散,跟 message 關聯不大 觀察 Git 內部如何儲存 Commit 隨便抓一個 Commit 的 SHA1 開始: git cat-file -p a08181bf3 
 (觀察這個 commit,找出 tree 位置 ) git cat-file -p ea44d629 
 (觀察這個 tree,找出任一個 blob SHA1) git cat-file -p d9647d8a 
 (觀察這個 blob 的內容) 參照 Reference Reference 會指向一個 Commit tag 不會移動,指向的 commit 都一樣 (帶有額外資訊的 tag 內部會用 Object 儲存) branch 指向該 branch 最新的 commit HEAD 指向 current branch
  5. Git 的 Repository 又稱作 Object Database 資料庫,共有四種 Objects 類型: Blob 記錄檔案內容 Tree 記錄該目錄下有哪些檔案(檔名、內容的SHA1)和 Trees Commit 記錄 commit 訊息、Root tree 和 Parent commits 的 SHA1 觀察 Git 內部如何儲存 Branch 分支 cat .git/HEAD 拿到目前工作目錄 current branch 是指向哪一個 branch cat .git/refs/heads/master 拿到 master branch 指向的 commit cat .git/refs/tags/foobar 拿到 foobar tag 指向的 commit 了解了 Git 如何儲存 Branch 之後,就再也不會想用中央儲存式的 SVN 了: svn 開分支和 merge 超痛苦,能避免開 branch 就避免開 branch svn 看 log 超痛苦,需要等待網路連線 svn commit 或 checkout 超慢,主機如果放國外常 commit 一半中斷
  6. 記錄檔案內容
  7. 記錄該⺫錄下有哪些檔案(檔名、內容的SHA1)和 Trees
  8. 記錄 commit 訊息、Root tree 和 Parent commits 的 SHA1
  9. Blob Just a bunch of bytes that could be anything, like a text file, source code, or a picture, etc. Tree like a file system directory. A Git tree can point to, or include: Git “blob” objects (similar to a file system directory includes file system files). Other git trees (similar to a file system directory can have subdirectories). Commit Information about who committed (made) the change/check-in/commit. For example, it stores the name and email address. A pointer to the git tree object that represents the Git repository when the commit was done The parent commit to this commit (so we can easily find out the situation at the previous commit). Tag Points to any Git commit object.  A Git tag can be used to refer to a specific tree, rather than having to remember or use the hash of the tree.
  10. Google Code 明年停止服務,協助用戶搬移資料到對手平台 轉到GitHub Google 自己本身也將自家開源專案移至 GitHub,如「libphonenumber」就是其中之一 GitHub 於 2008 年 2 月創立,比 Google Code 晚了兩年,現已有 900 萬名註冊用戶左右,為目前數一數二的開源專案託管平台。
  11. 悲觀鎖定 可以避免衝突但會有鎖定 如果有人讀取寫很久或忘記unlock就會讓其他人無法使用 樂觀鎖定 不會鎖定讀取 會有很多衝突 做什麼都需要網路
  12. Straight merge 預設的合併模式,會有全部的被合併的 branch commits 記錄加上一個 merge-commit,看線圖會有兩條 Parents 線,並保留所有 commit log。 Squashed commit 壓縮成只有一個 merge-commit,不會有被合併的 log。SVN 的 merge 即是如此。 Cherry-pick 只合併指定的 commit Rebase 變更 branch 的分支點:將目前 branch 的 commits,一個個重新重新 apply (或叫做patch) 到要被 rebase 的 branch 上。例如在 A branch rebase B branch,就會把原本分支點之後所有的 A commits 記錄,重新在 B branch 上再 commit 一遍,這時新分支點變成 B branch 的最新的 commit。這方式僅適合還沒分享給別人的 local branch,因為等於砍掉重練目前 branch 的 commits 記錄。
  13. 如果是新增功能的branch,個人認為使用non-fast-forward的方式比較好。 這樣可以很清楚的看出哪些是新增功能用的commit,哪些是原本master的commit。master才不會有太多不相干的commit交錯在一起。而且master要移除功能時,也只要處理一個commit就可以了。
  14. 只要有一個概念,理解 Git 最好的方法,就是用圖論中的節點(node)和指標(points)來思考,所有Git的指令操作,都是在操作這些節點,新增、修改、刪除、變更指標。
  15. git pull 預設的行為是將遠端的 repo. 與本地的 repo. 合併,這也是 DVCS 的初衷,將兩個 branch 合併。但是,很多時候會發生以下這種情形(左圖) 為什麼要rebase + merge 的 完美 合併法 (假設我們要將 feature branch 合併回主幹 develop) feature branch 很亂,不時 merge 與主幹同步 feature branch 有 typo,commit 訊息想改 feature branch 有些 commits 想合併或拆開 你會問說,有 conflict 怎麼辦? rebase 跟 merge 類似,出現 conflict 一會暫停 rebase 動作,需要你手動修復後,然後才可以繼續動作。這也是 rebase 比 merge 複雜一點的地方:merge 如果發生 conflict,你只需要解決衝突一次,然後 commit 出去就完成了。而 rebase 的 conflict 可能會發生在上述步驟 4 的每一次重新套用上,所以可能需要解決衝突好幾次 (rebase 時所謂的解決衝突,其實是直接修改你之前的變更內容,所以上圖中變成 D’ 跟 E’ )。 而當你做一個Rebase,你是重寫歷史。如右圖 實際上,你是要跟其他人說,“嘿,你知道這些事情發生在完全不同的時間表嗎?我要你把他同整併裝在這裡,合併他們發生的事情吧 結果是 超級乾淨,每⼀次的 merge commit 就代表⼀個功能完成
  16. 他是讓你花最少時間 (幾乎不用準備使用者對應檔) 就可以移轉成功的一套了,這套 SubGit 功能強大,不單單能當 Svn to Git 移轉工具,還能雙向同步於 SVN 與 Git 之間,非常厲害,所以相對的用起來也比較複雜些。http://blog.miniasp.com/post/2014/09/06/Useful-tools-SubGit-svn-to-git-migration.aspx Git-Svn 總結 git svn 工具集在當前不得不使用 Subversion 伺服器或者開發環境要求使用 Subversion 伺服器的時候格外有用。不妨把它看成一個跛腳的 Git. 然而,你還是有可能在轉換過程中碰到一些困惑你和合作者們的謎題。為了避免麻煩,試著遵守如下守則: 保持一個不包含由 git merge 產生的 commit 的線性提交歷史。將在主線分支外進行的開發通通衍合回主線;避免直接合併。 不要單獨建立和使用一個 Git 服務來搞合作。 可以為了加速新開發者的 clone 進程建立一個,但是不要向它提供任何不包含 git-svn-id 條目的內容。 甚至可以添加一個 pre-receive 掛鉤,在每一個提交資訊中檢查 git-svn-id,並拒絕提交那些不包含它的 commit。 如果遵循這些守則,在 Subversion 上工作還可以接受。然而,如果能遷徙到真正的 Git 伺服器,則能為團隊帶來更多好處。
  17. 《沒有銀彈:軟體工程的本質性與附屬性工作》(英語:No Silver Bullet — Essence and Accidents of Software Engineering)是IBM大型電腦之父佛瑞德·布魯克斯所發表一篇關於軟體工程的經典論文,原先是在1986年都柏林IFIP研討會的一篇受邀論文[1][2],隔年電機電子工程師學會《Computer》也轉載了這篇文章,他們用了幾張《倫敦狼人》(The Werewolf of London)之類的電影劇照來當作說明,[3]還加上了一段〈終結狼人〉的附註,用來引出非銀彈(silver bullet)則不能成功的(現代)傳說。該論述中強調由於軟體的複雜性本質,而使真正的銀彈[4]並不存在;所謂的沒有銀彈是指沒有任何一項技術或方法可使軟體工程的生產力在十年內提高十倍。