Mini-training: Let’s Git It!

Betclic Everest Group Tech Team
Betclic Everest Group Tech TeamBetclic Everest Group Tech Team
Let’s Git It ! 
MAXIME LEMAITRE – 11/09/2014
Agenda 
• Back to basis 
• What is that GIT/git/Git thing ? 
• Git Concepts 
• Demos 
• Working with Git 
– GitHub 
– Git + TFS 
– Git Tools for on Visual Studio 
• Why Git ? 
• Questions 
“Git is a free and open 
source distributed version 
control system designed to 
handle everything from 
small to very large projects 
with speed and efficiency”
What’s a version control system ? 
“An application that allows you to record changes to 
your codebase in a structured and controlled fashion” 
• Makes it way easier to undo errors / roll back to earlier versions of code 
• Makes it way easier to share a codebase between developers without 
creating conflicts 
• Makes it way easier to deploy changes from development to staging or 
production environments
What is that GIT/git/Git thing? 
• Distributed Version Control System (DVCS) 
• Open source, free (GNU GPL V2) 
• Originally developed by Linus Torvalds for the development 
of the Linux Kernel in 2005 
• Used by a lot of public/private projects 
• Focus on speed and efficiency 
• Quite a unique design and therefore sometimes a bit scary 
and difficult to understand
Git Concepts 
Distributed vs. Centralized 
Centralized version control systems are based on 
the idea that there is a single central copy of your 
project somewhere (probably on a server), and 
programmers will “commit” their changes to this 
central copy. 
Distributed Version Control systems do not 
necessarily rely on a central server to store all the 
versions of a project’s files. Instead, every developer 
“clones” a copy of a repository and has 
the full history of the project on their own hard 
drive. This copy (or “clone”) has all of the metadata 
of the original.
Git Concepts 
Data Storage 
Most VCSs tend to store data as 
changes to a base version of each 
file. 
But Git stores data as snapshots of 
the project over time. Git thinks of 
its data more like a set of snapshots 
of a mini filesystem
Git Concepts 
Nearly Every Operation Is Local 
(Browse History, Commit, Branching, …). 
No need to be online. Very efficient and 
fast 
Git Has Integrity 
Everything is check-summed (SHA-1), it’s 
impossible to change the contents of any file 
or directory without Git knowing about it 
Git Generally Only Adds Data. 
Objects (blob, tree, commit, tag, ..) are 
immutable but references (branche, remote, 
…) always changes. 
Your files can reside in 3 states 
Modified means that you have changed 
the file but have not committed it to your 
database yet. 
Staged means that you have marked a 
modified file in its current version to go 
into your next commit snapshot 
Committed means that the data is safely 
stored in your local database.
Basic Git Actions 
Clone 
A clone is a copy of a repository that lives on your computer instead of on a website's server 
somewhere. With your clone you can edit the files in your preferred editor and use Git to keep 
track of your changes without having to be online. It is connected to the remote version so that 
changes can be synced between the two. 
Commit 
When committing in Git, you save your code to your local repository, which then is versioned. 
Push 
When you push your code in Git, it means that you send your changes to the repository on the 
server ; after a push, your changes will also be available for other consumers of the central 
repository. 
Fetch 
When a fetch in Git is performed, you get an overview of changes on the central repository, you 
can see a list of changes made to the code and decide if you want to get the latest version. 
Pull 
When a pull is performed, you get the latest version of the server’s repository, with all other 
changes of other team members, a merge is automatically performed, although as far as Git can 
handle the differences.
Git Demo 
try it at https://try.github.io/ 
// init a Git repository 
$ git init 
// start tracking changes made to all txt files => add them to the 
staging area 
$ git add '*.js' 
// Store our staged changes (current version) 
$ git commit -m 'Add all the js files' 
// add a remote remote repository (named origin) 
$ git remote add origin https://github.com/toto/mysuperproject.git 
// push local changes (commits) to the remote repo(branch master) 
$ git push -u origin master 
// pull down any new changes made by other people 
$ git pull origin master
Git Concepts 
Branching, Killer-feature 
• Branching is very cheap 
• Branching operations (creation, 
deletion, merge) are always local 
• You can have multiple local 
branches that can be entirely 
independent of each other 
• Git encourages a workflow that 
branches and merges often, even 
multiple times in a day 
be sure to be on master branch … 
// Switched to a new branch "fixes“ 
$ git checkout –b hotfix 
// fix code 
// commit staged changes (the fix) 
$ git commit -m ‘Fixed hard coded 
password' 
// return to master 
$ git checkout master 
// merge local hoxfix branch to master 
$ git merge hotfix 
// delete local hoxfix branch 
$ git branch -d hotfix 
// push merged fixed …
Git Concepts 
Branching workflow 
1 2 
3 4 
Standard workflow 
(Local branches)
Git Concepts 
Advanced Branching workflow
Git Concepts 
Git Hooks 
• Hooks are executables scripts that executed before or after important 
events 
– commit, push, merge, checkout, receive…. (client/server) 
• Built-in feature - no need to download anything, run locally. 
• Only limited by developer's imagination. Some example : 
– Deploy a web site 
– Check commit message 
– We want to run test suite to run automatically every time we change something 
– We want to make sure that our test coverage is high enough 
• … 
(GitHub doesn’t support fully support hooks, but provide WebHooks and 
Services)
Working with Git 
Git and/or TFS ? 
* Source Repos : Team Foundation Version Control or Git
Git for TFS users 
Git Actions TFS Command 
Clone Create Workspace and Get Latest 
Checkout Switch workspace / branch 
Commit CheckIn / Shelve 
Status Pending Changes 
Push CheckIn 
Pull Get Latest Version 
Sync CheckIn and Get Latest Version
Working with Git 
GitHub, Social Coding 
• Basically a Git repository hosting service… 
but it Provides a web-based graphical 
interface, desktop app for Mac, Linux, 
Windows 
• Adds many of its own features : issues, 
milestones, labels, wiki, API, team 
planning, graphs, … 
• Unlimited number of public repositories 
& collaborators 
• For private projects, you have to pay 
• You can clone any public repository, 
follow projects and developers, post 
comments, … 
10 Million Repositories (end of 2013) 
Most Starred, May 2014 
1 – twbs/bootstrap 
2 – jquery/jquery 
3 – joyent/node 
4 – mbostock/d3.js 
5 - angular/angular.js
Working with Git 
Git Shell/Bash 
Explorer extensions allow 
you to work direclty in any 
folder.. 
Command line is the 
standard way to use git. 
Even if there are GUI tools, 
you will have to use it at 
least once !
Working with Git 
GitHub for Windows 
Easiest way to use GitHub 
on Windows. 
https://windows.github.com/
Working with Git 
Git and Visual Studio 
• Visual Studio 2013 includes Git tools by default 
– Previously it requires an extension 
Work with Visual Studio on OSS projects !
How to contribute to an OSS Project ? 
Fork & Pull workflow 
Pull requests let you tell others about changes you've pushed 
to a GitHub repository. Once a pull request is sent, interested 
parties can review the set of changes, discuss potential 
modifications, and even push follow-up commits if necessary 
Pull requests = Commit + 
Comments + (issue ?) 
Remember to Follow project guidelines !
Why Git ? 
• Decentralized Allow developers to work offline, look in history, commit 
some changes and create branchs 
• It’s extremely fast as nearly everything is local 
• Local Branching and merging is cheap 
• Perfectly suited for Open Source projects and use by many leaders 
• Tool extremely flexible, can support a wide, wide variety of developer 
workflows 
• Huge community 
• Because of GitHub
Questions
References 
• https://try.github.io/ 
• http://nvie.com/posts/a-successful-git-branching-model/ 
• http://git-scm.com/ 
• http://johanleino.wordpress.com/2013/09/18/tfs-vs-git-or-is-it-tfs-with-git/ 
• http://www.slideshare.net/danielpcox/six3-getting-git 
• http://spring.io/blog/2010/12/21/social-coding-in-spring-projects 
• http://hashrocket.com/blog/posts/x-men-days-of-future-past-explained-in-git 
• http://gitready.com/ 
• http://stackoverflow.com/tags/git/info
1 von 23

Más contenido relacionado

Destacado(20)

Introduction into GitIntroduction into Git
Introduction into Git
Serhii Kartashov895 views
Git & git flowGit & git flow
Git & git flow
Amo Wu1.3K views
Git in a nutshellGit in a nutshell
Git in a nutshell
Nelson Tai10K views
Git As A Subversion ReplacementGit As A Subversion Replacement
Git As A Subversion Replacement
Josh Nichols16.2K views
Introduction to gitIntroduction to git
Introduction to git
Bo-Yi Wu19.5K views
Why Aren't You Using Git Flow?Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?
John Congdon3.9K views
Git flow IntroductionGit flow Introduction
Git flow Introduction
David Paluy9.4K views
Mastering GITMastering GIT
Mastering GIT
Hasnaeen Rahman406 views
Git flow for daily useGit flow for daily use
Git flow for daily use
Mediacurrent8K views
Advanced GitAdvanced Git
Advanced Git
segv19.3K views
Git Flow - An IntroductionGit Flow - An Introduction
Git Flow - An Introduction
Knoldus Inc.2K views

Similar a Mini-training: Let’s Git It!

Git overviewGit overview
Git overviewGowarthini
59 views14 Folien
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptxEshaan35
239 views56 Folien

Similar a Mini-training: Let’s Git It!(20)

Introduction to git hubIntroduction to git hub
Introduction to git hub
Naveen Pandey386 views
Git overviewGit overview
Git overview
Gowarthini59 views
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
AbelPhilipJoseph32 views
Introduction to Git & GitHubIntroduction to Git & GitHub
Introduction to Git & GitHub
Wasit Shafi19 views
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptx
Eshaan35239 views
Git training (basic)Git training (basic)
Git training (basic)
Arashdeepkaur1662 views
Git MasteryGit Mastery
Git Mastery
ShehryarSH143 views
Git installation and configurationGit installation and configuration
Git installation and configuration
Kishor Kumar722 views
Git TrainingGit Training
Git Training
Prabal Tyagi105 views
Introduction to gitIntroduction to git
Introduction to git
Nguyen Van Hung164 views
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
Chen-Tien Tsai3.5K views
Git Tutorial Git Tutorial
Git Tutorial
Ahmed Taha522 views
GitGit
Git
Okba Mahdjoub1K views
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Md Atique Ahmed Ziad121 views
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
Krunal Doshi830 views

Más de Betclic Everest Group Tech Team(20)

Mini training - Reactive Extensions (Rx)Mini training - Reactive Extensions (Rx)
Mini training - Reactive Extensions (Rx)
Betclic Everest Group Tech Team1.7K views
Mini training - Moving to xUnit.netMini training - Moving to xUnit.net
Mini training - Moving to xUnit.net
Betclic Everest Group Tech Team1.6K views
Mini training - Introduction to Microsoft Azure StorageMini training - Introduction to Microsoft Azure Storage
Mini training - Introduction to Microsoft Azure Storage
Betclic Everest Group Tech Team822 views
Akka.NetAkka.Net
Akka.Net
Betclic Everest Group Tech Team2.5K views
Mini training- Scenario Driven DesignMini training- Scenario Driven Design
Mini training- Scenario Driven Design
Betclic Everest Group Tech Team2.4K views
Email Management in OutlookEmail Management in Outlook
Email Management in Outlook
Betclic Everest Group Tech Team2.7K views
Mini-Training: SSO with Windows Identity FoundationMini-Training: SSO with Windows Identity Foundation
Mini-Training: SSO with Windows Identity Foundation
Betclic Everest Group Tech Team2.5K views
Training  - What is Performance ?Training  - What is Performance ?
Training - What is Performance ?
Betclic Everest Group Tech Team1.7K views
Mini-Training: DockerMini-Training: Docker
Mini-Training: Docker
Betclic Everest Group Tech Team1.5K views
Mini Training FlywayMini Training Flyway
Mini Training Flyway
Betclic Everest Group Tech Team2.2K views
Mini-Training: NDependMini-Training: NDepend
Mini-Training: NDepend
Betclic Everest Group Tech Team2K views
Management 3.0 WorkoutManagement 3.0 Workout
Management 3.0 Workout
Betclic Everest Group Tech Team2.5K views
Lean for BusinessLean for Business
Lean for Business
Betclic Everest Group Tech Team24.7K views
Training – Going AsyncTraining – Going Async
Training – Going Async
Betclic Everest Group Tech Team2.4K views
Mini-Training: Mobile UX TrendsMini-Training: Mobile UX Trends
Mini-Training: Mobile UX Trends
Betclic Everest Group Tech Team1.7K views
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
Betclic Everest Group Tech Team26.5K views
Mini-training: Personalization & Recommendation DemystifiedMini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation Demystified
Betclic Everest Group Tech Team676 views
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
Betclic Everest Group Tech Team25.8K views
Mini-Training: RoslynMini-Training: Roslyn
Mini-Training: Roslyn
Betclic Everest Group Tech Team1.3K views
Mini-Training: Netflix Simian ArmyMini-Training: Netflix Simian Army
Mini-Training: Netflix Simian Army
Betclic Everest Group Tech Team7.5K views

Último(20)

Java Platform Approach 1.0 - Picnic MeetupJava Platform Approach 1.0 - Picnic Meetup
Java Platform Approach 1.0 - Picnic Meetup
Rick Ossendrijver24 views
Liqid: Composable CXL PreviewLiqid: Composable CXL Preview
Liqid: Composable CXL Preview
CXL Forum120 views
ThroughputThroughput
Throughput
Moisés Armani Ramírez31 views
METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...
METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...
Prity Khastgir IPR Strategic India Patent Attorney Amplify Innovation24 views

Mini-training: Let’s Git It!

  • 1. Let’s Git It ! MAXIME LEMAITRE – 11/09/2014
  • 2. Agenda • Back to basis • What is that GIT/git/Git thing ? • Git Concepts • Demos • Working with Git – GitHub – Git + TFS – Git Tools for on Visual Studio • Why Git ? • Questions “Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency”
  • 3. What’s a version control system ? “An application that allows you to record changes to your codebase in a structured and controlled fashion” • Makes it way easier to undo errors / roll back to earlier versions of code • Makes it way easier to share a codebase between developers without creating conflicts • Makes it way easier to deploy changes from development to staging or production environments
  • 4. What is that GIT/git/Git thing? • Distributed Version Control System (DVCS) • Open source, free (GNU GPL V2) • Originally developed by Linus Torvalds for the development of the Linux Kernel in 2005 • Used by a lot of public/private projects • Focus on speed and efficiency • Quite a unique design and therefore sometimes a bit scary and difficult to understand
  • 5. Git Concepts Distributed vs. Centralized Centralized version control systems are based on the idea that there is a single central copy of your project somewhere (probably on a server), and programmers will “commit” their changes to this central copy. Distributed Version Control systems do not necessarily rely on a central server to store all the versions of a project’s files. Instead, every developer “clones” a copy of a repository and has the full history of the project on their own hard drive. This copy (or “clone”) has all of the metadata of the original.
  • 6. Git Concepts Data Storage Most VCSs tend to store data as changes to a base version of each file. But Git stores data as snapshots of the project over time. Git thinks of its data more like a set of snapshots of a mini filesystem
  • 7. Git Concepts Nearly Every Operation Is Local (Browse History, Commit, Branching, …). No need to be online. Very efficient and fast Git Has Integrity Everything is check-summed (SHA-1), it’s impossible to change the contents of any file or directory without Git knowing about it Git Generally Only Adds Data. Objects (blob, tree, commit, tag, ..) are immutable but references (branche, remote, …) always changes. Your files can reside in 3 states Modified means that you have changed the file but have not committed it to your database yet. Staged means that you have marked a modified file in its current version to go into your next commit snapshot Committed means that the data is safely stored in your local database.
  • 8. Basic Git Actions Clone A clone is a copy of a repository that lives on your computer instead of on a website's server somewhere. With your clone you can edit the files in your preferred editor and use Git to keep track of your changes without having to be online. It is connected to the remote version so that changes can be synced between the two. Commit When committing in Git, you save your code to your local repository, which then is versioned. Push When you push your code in Git, it means that you send your changes to the repository on the server ; after a push, your changes will also be available for other consumers of the central repository. Fetch When a fetch in Git is performed, you get an overview of changes on the central repository, you can see a list of changes made to the code and decide if you want to get the latest version. Pull When a pull is performed, you get the latest version of the server’s repository, with all other changes of other team members, a merge is automatically performed, although as far as Git can handle the differences.
  • 9. Git Demo try it at https://try.github.io/ // init a Git repository $ git init // start tracking changes made to all txt files => add them to the staging area $ git add '*.js' // Store our staged changes (current version) $ git commit -m 'Add all the js files' // add a remote remote repository (named origin) $ git remote add origin https://github.com/toto/mysuperproject.git // push local changes (commits) to the remote repo(branch master) $ git push -u origin master // pull down any new changes made by other people $ git pull origin master
  • 10. Git Concepts Branching, Killer-feature • Branching is very cheap • Branching operations (creation, deletion, merge) are always local • You can have multiple local branches that can be entirely independent of each other • Git encourages a workflow that branches and merges often, even multiple times in a day be sure to be on master branch … // Switched to a new branch "fixes“ $ git checkout –b hotfix // fix code // commit staged changes (the fix) $ git commit -m ‘Fixed hard coded password' // return to master $ git checkout master // merge local hoxfix branch to master $ git merge hotfix // delete local hoxfix branch $ git branch -d hotfix // push merged fixed …
  • 11. Git Concepts Branching workflow 1 2 3 4 Standard workflow (Local branches)
  • 12. Git Concepts Advanced Branching workflow
  • 13. Git Concepts Git Hooks • Hooks are executables scripts that executed before or after important events – commit, push, merge, checkout, receive…. (client/server) • Built-in feature - no need to download anything, run locally. • Only limited by developer's imagination. Some example : – Deploy a web site – Check commit message – We want to run test suite to run automatically every time we change something – We want to make sure that our test coverage is high enough • … (GitHub doesn’t support fully support hooks, but provide WebHooks and Services)
  • 14. Working with Git Git and/or TFS ? * Source Repos : Team Foundation Version Control or Git
  • 15. Git for TFS users Git Actions TFS Command Clone Create Workspace and Get Latest Checkout Switch workspace / branch Commit CheckIn / Shelve Status Pending Changes Push CheckIn Pull Get Latest Version Sync CheckIn and Get Latest Version
  • 16. Working with Git GitHub, Social Coding • Basically a Git repository hosting service… but it Provides a web-based graphical interface, desktop app for Mac, Linux, Windows • Adds many of its own features : issues, milestones, labels, wiki, API, team planning, graphs, … • Unlimited number of public repositories & collaborators • For private projects, you have to pay • You can clone any public repository, follow projects and developers, post comments, … 10 Million Repositories (end of 2013) Most Starred, May 2014 1 – twbs/bootstrap 2 – jquery/jquery 3 – joyent/node 4 – mbostock/d3.js 5 - angular/angular.js
  • 17. Working with Git Git Shell/Bash Explorer extensions allow you to work direclty in any folder.. Command line is the standard way to use git. Even if there are GUI tools, you will have to use it at least once !
  • 18. Working with Git GitHub for Windows Easiest way to use GitHub on Windows. https://windows.github.com/
  • 19. Working with Git Git and Visual Studio • Visual Studio 2013 includes Git tools by default – Previously it requires an extension Work with Visual Studio on OSS projects !
  • 20. How to contribute to an OSS Project ? Fork & Pull workflow Pull requests let you tell others about changes you've pushed to a GitHub repository. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary Pull requests = Commit + Comments + (issue ?) Remember to Follow project guidelines !
  • 21. Why Git ? • Decentralized Allow developers to work offline, look in history, commit some changes and create branchs • It’s extremely fast as nearly everything is local • Local Branching and merging is cheap • Perfectly suited for Open Source projects and use by many leaders • Tool extremely flexible, can support a wide, wide variety of developer workflows • Huge community • Because of GitHub
  • 23. References • https://try.github.io/ • http://nvie.com/posts/a-successful-git-branching-model/ • http://git-scm.com/ • http://johanleino.wordpress.com/2013/09/18/tfs-vs-git-or-is-it-tfs-with-git/ • http://www.slideshare.net/danielpcox/six3-getting-git • http://spring.io/blog/2010/12/21/social-coding-in-spring-projects • http://hashrocket.com/blog/posts/x-men-days-of-future-past-explained-in-git • http://gitready.com/ • http://stackoverflow.com/tags/git/info