Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
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 Xue...
Who am I
Blackie Tsai
Senior IT consultant of Xuenn
Full stack developer
Major on development of real-time transaction sys...
Facing problems of Development
• Some CR require a long-period of development like 1 month
or more. And we have a lot of t...
Facing problems of Deployment
• No choice for release packages even we know this version
have defects.
• Hard to revert to...
Facing problems of Project Management
• Can not doing frequently change with long-period development, even you
have enough...
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 P...
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...
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 U...
Git Object Types
Blob
Just a bunch of bytes that could be anything, like a text file, source code, or a picture, etc.
Tree...
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 var...
Conclusion
Cheap Local Branching
Everything is Local
Git is Fast
Git is Small
The Staging Area
Distributed
Any Workflow
Ea...
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 day...
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...
Others…
From SVN to Git
為何改用 Git ?
我從 SVN 退役轉 Git 的三月有感
SVN is good but…
Git - Branching
It means you can do something like below:
Change with experimental nature, for example you want to rewrite...
Git - Merging
Straight merge
Default mode of merge, there will be all merged branch commits record with a merge-commit, it...
Git - Merging : Fast-Forward
Merge with Fast-Forward
git merge --ff feature1
Merge without Fast-Forward
git merge --no-ff ...
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 yo...
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/
IMPLEMENT GIT ON XUENN
Git Server
Practice : Bonobo
Git server with GUI support and hosted on windows IIS
Integrating with AD
Formal : GitLab
Sim...
Git Tool
SVN Git migration
SubGit
介紹好用工具:SubGit ( 輕鬆將 SVN 專案移轉到 Git 的工具 )
Git-SVN
Git Command with SVN repository
Follow t...
Git Client - Setup
Basic
git config --global user.name Your Name
git config --global user.email your@email.com
git config ...
Git Client - .gitignore
Specifies intentionally untracked files to ignore
A gitignore file specifies intentionally untrack...
Recap Git tutorial
Create new repository or Clone someone
git init or git clone
Add new file from working directory to sta...
Git Client - SourceTree
SourceTree is a free Mercurial and Git Client for Windows and Mac that provides a graphical interf...
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 Depl...
DNG Team
Development
• Specify
• Code
• Unit Test
• Integration Test
• Version Control
CI/CD
• Build
• Auto Test
• Human V...
YT Support Monitoring
Daily Monitoring
Connection
Memory
CPU
RTX Support Site
LogCollector+ LogParser
LogCollecotr
Bat
Client
Server
LogFileMaintainer
LogToSQL
PurgeLog
LogParser
Visualize result of c...
Jenkins Automation Test and Daily Release
Unit Test(Single domain)
Integration Test(Multiple domain)
Auto Test(Using selen...
Simple Continue Integration with Git - Graphic
Git, Feature Branches, and Jenkins – or how I learned to stop worrying abou...
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 ...
Git Regular Release Flow
Master
(PRD)
Test
Env.
QAT UAT
Test
Env.
DEV
ITC
Local
Get new CR
or ticket
Checkout
for fix bug
...
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...
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
P...
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...
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 Introd...
Git essential training & sharing self
Git essential training & sharing self
Git essential training & sharing self
Upcoming SlideShare
Loading in …5
×

7

Share

Download to read offline

Git essential training & sharing self

Download to read offline

Git sharing from my lesson learn and practice of job.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Git essential training & sharing self

  1. 1. Continuous Integration with Git 2015.10.6 Blackie
  2. 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. 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. 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. 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. 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.
  7. 7. Today Deployment Flow Hotfix Normal
  8. 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. 9. A B C Use Case - Revert : SVN CR-1 CR-2 CR-1 CR-2 CR-1 CR-2
  10. 10. Use Case – Revert : Git A B C CR-1 CR-1 CR-2CR-2 CR-1 CR-2 CR-1 CR-2
  11. 11. WHAT IS GIT
  12. 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).
  13. 13. DIFFERENT BETWEEN GIT AND SVN
  14. 14. Staging Area Staging Area
  15. 15. Distribution Distributed Difference between SVN and Git Or
  16. 16. Small and Fast - Fast Small and Fast
  17. 17. Small and Fast - Size comparison Original Git vs converted SVN. Original SVN vs converted Git.
  18. 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. 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
  20. 20. Data Assurance - Blob
  21. 21. Data Assurance - Tree
  22. 22. Data Assurance - Commit
  23. 23. Data Assurance – Commit(Multiple)
  24. 24. Branching-and-merging Branching-and-merging
  25. 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. 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. 27. HOW COULD WE BECOME "STRONGER" THROUGH THE GIT
  28. 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. 29. Local VCS • Unable Collaborative Development e.g. Paste Folder/Files manually
  30. 30. Centralized VCS • Need connect central server and damn slow • Single point of failure e.g. CVS, SVN, Perforce
  31. 31. Distributed VCS e.g. Git, Mercuria, Bazaar • Fast and support offline • Multivariate workflows • Distributed, enable scale out
  32. 32. Others… From SVN to Git 為何改用 Git ? 我從 SVN 退役轉 Git 的三月有感
  33. 33. SVN is good but…
  34. 34. 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 然後再切回剛剛實 驗用的分支,把它合併進來。或結果發現這樣行不通就刪掉這個分支;放棄一個分支,甚至沒有任何人知道它 曾經存在 (同時你還可以把其他的分支公佈出去)。 有一個分支只用來放要釋出的版本,另一個用來合併開發中的部份供測試,其他幾個小分支用來放每天的開發 工作,當正式環境需要哪一個版本的功能就拿該版本去發行使用。 替每一個你正在實做的新功能建立新的分支,然後你就可以平順的在它們之中切換,最後刪除掉每一個新功能 已經合併回主線的分支並且成功保留每個修改紀錄。
  35. 35. 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
  36. 36. 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 的差別
  37. 37. Git - Theory Git rebase 和 merge 合併操作示範錄影
  38. 38. Git - Merging : Rebase + Merge http://www.librador.com/2013/11/15/Avoid-pull-merge-mess-in-Git/ Straight merge Rebase+Merge
  39. 39. 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
  40. 40. GIT TUTORIAL
  41. 41. Basic Git Flow Recap Git Workflows Book
  42. 42. Git and SVN Command Command Course http://git.or.cz/course/svn.html
  43. 43. Git Flow and Command https://github.com/mattharrison/Git-Supervisual-Cheatsheet
  44. 44. Code School – Try Git https://try.github.io/
  45. 45. IMPLEMENT GIT ON XUENN
  46. 46. 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?
  47. 47. 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
  48. 48. 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
  49. 49. 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
  50. 50. 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
  51. 51. 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 簡介
  52. 52. Git Client – SourceTree : UI
  53. 53. Git Client – SourceTree : Configuration
  54. 54. Git Client – SourceTree : New Git Project
  55. 55. Git Client – SourceTree : Commit change
  56. 56. Git Client – SourceTree : Pull
  57. 57. Git Client – SourceTree : Push
  58. 58. CI&CD EXAMPLE WITH DNG TEAM
  59. 59. Development Evolution Plan Code Build Test Release Deploy Operate Agile Development Continuous Integration Continuous Deployment DevOps
  60. 60. 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
  61. 61. YT Support Monitoring Daily Monitoring Connection Memory CPU
  62. 62. RTX Support Site
  63. 63. LogCollector+ LogParser LogCollecotr Bat Client Server LogFileMaintainer LogToSQL PurgeLog LogParser Visualize result of chart
  64. 64. Jenkins Automation Test and Daily Release Unit Test(Single domain) Integration Test(Multiple domain) Auto Test(Using selenium)
  65. 65. Simple Continue Integration with Git - Graphic Git, Feature Branches, and Jenkins – or how I learned to stop worrying about broken builds
  66. 66. Simple Continue Integration with Git - Flow
  67. 67. 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
  68. 68. 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
  69. 69. 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
  70. 70. 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
  71. 71. Gateway CheckIn Pattern = Jenkins + Git Good Practice JenkinsとGitで実装するGatewayCheckIn Pattern
  72. 72. Gateway CheckIn Pattern : Single Developer
  73. 73. Gateway CheckIn Pattern : Multiple Developer
  74. 74. 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
  75. 75. No Silver Bullet
  76. 76. Continuous Improvement on Xuenn
  77. 77. 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堂課
  • leap2k1

    Jan. 9, 2017
  • 100001353229924

    Oct. 23, 2015
  • larrynung

    Oct. 19, 2015
  • AlanYAChen

    Oct. 3, 2015
  • rockycheng96

    Oct. 3, 2015
  • s80275

    Oct. 2, 2015
  • imagefish1

    Oct. 1, 2015

Git sharing from my lesson learn and practice of job.

Views

Total views

3,403

On Slideshare

0

From embeds

0

Number of embeds

10

Actions

Downloads

29

Shares

0

Comments

0

Likes

7

×