SlideShare a Scribd company logo
1 of 25
Download to read offline
WELCOMETOVERSIONED WORLD
CDNVideo.ru, Grechishkin Alexey
(D)VCS
CENTRALIZEDVERSION CONTROL
SYSTEM
• One endpoint (one server), all your changes goes to server,
immediately on commit	

• Difficult branching (you possibly need to duplicate project directory)	

• difficult conflict resolving
• Pull down any changes from another teammates	

• Make your changes	

• Commit your changes to the server and resolve conflicts
TYPICAL WORKFLOW
DECENTRALIZEDVCS
• One, two, three, …, N servers or Zero (What? 0_o)	

• duplication	

• faster works (one server in office, one in DC, pushing to office, then office
pushed to DC’s)	

• Easy branching	

• branch isn’t just a directory copy, it’s a real branch -> easy conflict resolving
GIT
STARTING WITH GIT
For creating a working copy you can
clone the repository or initialize git
structure in any directory you want
FIRST COMMITS WITH GIT
• Make some changes	

• Add new/changed files to git	

• Commit it
m
aster
Initial commit
FIRST COMMITS WITH GIT
• Make some changes again	

• See the status	

• Add changes to git	

• See status again
m
aster
Initial commit
staging
–English folk
“Don't jump the gun”
ALREADY COMMIT?
MAKING DIFFS
Make diff with	

git diff -u HEAD
m
aster
Initial commit
staging
DIFF !== PATCH
MAKING DIFFS
Make diff with	

git diff -u HEAD
m
aster
Initial commit
staging
DIFF !== PATCH
Why? Later… Be patience ;)
MAKING BRANCH
Making branches is so simple as	

git checkout -b “develop”	

, where develop is a new branch name.	

Commit your changes.
m
aster
Initial commit
Add main.c
develop
PATCH
MAKING PATCH
Why we need patch?	

Making patch to master branch from current:	

git format-patch mater —stdout > ../1.patch
m
aster
Initial commit
Add main.c
develop
What is difference between
diff and patch?
WORKING WITH PATCH
Before applying check patch for
errors.
m
aster
Initial commit
Add main.c
develop
APPLYING PATCH
Switching back to master by	

git checkout master	

And apply the patch with	

git am —signoff < ../1.patch
m
aster
Initial commit
Add main.c
develop
Add main.c
WORKING WITH REMOTES
ADDING REMOTES
If you need to add a remote for your
local git repo, just use 	

git remote add origin git@host:repo.git
m
aster
Initial commit
Add main.c
develop
Add main.c
Also you can add different remotes for
different branches or pulling from one and
push to second.
PUSH
The common use of push is to run it from current
local branch and set remote and remote branch
where to push:	

git push -u origin [master | —all]
m
aster
Initial commit
Add main.c
develop
Add main.c
CLONE
Let’s create a new repo from cloning our first and
make some changes in it and push them back.	

git clone /tmp/repo.git dolly
m
aster
Initial commit
Add main.c
develop
Add main.c
Readme change
PULL
Ok. Let’s go to our first working copy
and execute	

git pull
m
aster
Initial commit
Add main.c
develop
Add main.c
Readme change
ITHINK FORTHE FIRSTTIME IT’S ALL.
THANKS
NEXTTIME
• Changing the history	

• Working with git-flow	

• Submodules

More Related Content

What's hot

Vagrant. Halturin Artem
Vagrant. Halturin ArtemVagrant. Halturin Artem
Vagrant. Halturin ArtemADCI Solutions
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily useMediacurrent
 
Two-Step Deployment with Rails
Two-Step Deployment with RailsTwo-Step Deployment with Rails
Two-Step Deployment with Railsdugsmith
 
An introduction to Git and GitFlow
An introduction to Git and GitFlowAn introduction to Git and GitFlow
An introduction to Git and GitFlowMark Everard
 
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requestsBartosz Kosarzycki
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best PracticesMaidul Islam
 
Route service-pcf-techmeetup
Route service-pcf-techmeetupRoute service-pcf-techmeetup
Route service-pcf-techmeetupGwenn Etourneau
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagramsDilum Navanjana
 
Git introduction workshop for scientists
Git introduction workshop for scientists Git introduction workshop for scientists
Git introduction workshop for scientists Steven Hamblin
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubVenkat Malladi
 
Release Cycle Changes
Release Cycle ChangesRelease Cycle Changes
Release Cycle ChangesHPCC Systems
 
Git hub actions: Android CI Pipeline
Git hub actions: Android CI PipelineGit hub actions: Android CI Pipeline
Git hub actions: Android CI PipelineQuintin Balsdon
 
Subversion Overview
Subversion OverviewSubversion Overview
Subversion Overviewpolarion
 

What's hot (20)

Git
GitGit
Git
 
Git workflows
Git workflowsGit workflows
Git workflows
 
Vagrant. Halturin Artem
Vagrant. Halturin ArtemVagrant. Halturin Artem
Vagrant. Halturin Artem
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
 
Two-Step Deployment with Rails
Two-Step Deployment with RailsTwo-Step Deployment with Rails
Two-Step Deployment with Rails
 
There is no snapshot
There is no snapshotThere is no snapshot
There is no snapshot
 
Git 101
Git 101Git 101
Git 101
 
An introduction to Git and GitFlow
An introduction to Git and GitFlowAn introduction to Git and GitFlow
An introduction to Git and GitFlow
 
Getting started with k8
Getting started with k8Getting started with k8
Getting started with k8
 
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requests
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best Practices
 
Route service-pcf-techmeetup
Route service-pcf-techmeetupRoute service-pcf-techmeetup
Route service-pcf-techmeetup
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Git introduction workshop for scientists
Git introduction workshop for scientists Git introduction workshop for scientists
Git introduction workshop for scientists
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Release Cycle Changes
Release Cycle ChangesRelease Cycle Changes
Release Cycle Changes
 
Git flow
Git flowGit flow
Git flow
 
Git hub actions: Android CI Pipeline
Git hub actions: Android CI PipelineGit hub actions: Android CI Pipeline
Git hub actions: Android CI Pipeline
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Subversion Overview
Subversion OverviewSubversion Overview
Subversion Overview
 

Viewers also liked

Dufferin second-public-notice-june-27
Dufferin second-public-notice-june-27Dufferin second-public-notice-june-27
Dufferin second-public-notice-june-27loyalj
 
Rue La La Office Tour
Rue La La Office TourRue La La Office Tour
Rue La La Office TourRue La La
 
Peer lectures in the medical undergraduate curriculum: a valid tool for lear...
Peer lectures in the medical undergraduate curriculum: a valid tool for  lear...Peer lectures in the medical undergraduate curriculum: a valid tool for  lear...
Peer lectures in the medical undergraduate curriculum: a valid tool for lear...UCL Medical Society (Education) 2012-2013
 
Exposicion web 2 redes sociales
Exposicion web 2 redes socialesExposicion web 2 redes sociales
Exposicion web 2 redes socialesyolina2189
 
Edital pnld eja_2014_190712
Edital pnld eja_2014_190712Edital pnld eja_2014_190712
Edital pnld eja_2014_190712dayejef
 
Case Study Of GE LinkedIn
Case Study Of GE LinkedInCase Study Of GE LinkedIn
Case Study Of GE LinkedInNithin Kumar
 
Sketching Paris...
Sketching Paris...Sketching Paris...
Sketching Paris...lineandwash
 
1. sop pengelolaan pemb tematik terpadu ks
1. sop pengelolaan pemb tematik terpadu ks1. sop pengelolaan pemb tematik terpadu ks
1. sop pengelolaan pemb tematik terpadu ksSanda Zyrechsmart
 
English IV Thursday, 03.23.15 Lesson with Reflection
English IV Thursday, 03.23.15 Lesson with ReflectionEnglish IV Thursday, 03.23.15 Lesson with Reflection
English IV Thursday, 03.23.15 Lesson with ReflectionMary Beth Gries
 
Celebrity brand endorsement
Celebrity brand endorsementCelebrity brand endorsement
Celebrity brand endorsementRoneet Kumar
 
Javaのプログラムはどうやって動いているの? GC編
Javaのプログラムはどうやって動いているの? GC編Javaのプログラムはどうやって動いているの? GC編
Javaのプログラムはどうやって動いているの? GC編Yuichi Sakuraba
 
Seminario i lapso_iii_2012 reprogramado (2)
Seminario  i lapso_iii_2012 reprogramado (2)Seminario  i lapso_iii_2012 reprogramado (2)
Seminario i lapso_iii_2012 reprogramado (2)marisol piña
 

Viewers also liked (17)

Dufferin second-public-notice-june-27
Dufferin second-public-notice-june-27Dufferin second-public-notice-june-27
Dufferin second-public-notice-june-27
 
Verdadeiro amigo
Verdadeiro amigoVerdadeiro amigo
Verdadeiro amigo
 
Best Logos
Best LogosBest Logos
Best Logos
 
Rue La La Office Tour
Rue La La Office TourRue La La Office Tour
Rue La La Office Tour
 
Peer lectures in the medical undergraduate curriculum: a valid tool for lear...
Peer lectures in the medical undergraduate curriculum: a valid tool for  lear...Peer lectures in the medical undergraduate curriculum: a valid tool for  lear...
Peer lectures in the medical undergraduate curriculum: a valid tool for lear...
 
Exposicion web 2 redes sociales
Exposicion web 2 redes socialesExposicion web 2 redes sociales
Exposicion web 2 redes sociales
 
Mohan_resume
Mohan_resumeMohan_resume
Mohan_resume
 
Edital pnld eja_2014_190712
Edital pnld eja_2014_190712Edital pnld eja_2014_190712
Edital pnld eja_2014_190712
 
Case Study Of GE LinkedIn
Case Study Of GE LinkedInCase Study Of GE LinkedIn
Case Study Of GE LinkedIn
 
Sketching Paris...
Sketching Paris...Sketching Paris...
Sketching Paris...
 
1. sop pengelolaan pemb tematik terpadu ks
1. sop pengelolaan pemb tematik terpadu ks1. sop pengelolaan pemb tematik terpadu ks
1. sop pengelolaan pemb tematik terpadu ks
 
English IV Thursday, 03.23.15 Lesson with Reflection
English IV Thursday, 03.23.15 Lesson with ReflectionEnglish IV Thursday, 03.23.15 Lesson with Reflection
English IV Thursday, 03.23.15 Lesson with Reflection
 
La evolución del hombre
La evolución del hombreLa evolución del hombre
La evolución del hombre
 
Celebrity brand endorsement
Celebrity brand endorsementCelebrity brand endorsement
Celebrity brand endorsement
 
Steeple
SteepleSteeple
Steeple
 
Javaのプログラムはどうやって動いているの? GC編
Javaのプログラムはどうやって動いているの? GC編Javaのプログラムはどうやって動いているの? GC編
Javaのプログラムはどうやって動いているの? GC編
 
Seminario i lapso_iii_2012 reprogramado (2)
Seminario  i lapso_iii_2012 reprogramado (2)Seminario  i lapso_iii_2012 reprogramado (2)
Seminario i lapso_iii_2012 reprogramado (2)
 

Similar to GIT-Lesson-1

git fail --force (make it up with your pull requests)
git fail --force (make it up with your pull requests)git fail --force (make it up with your pull requests)
git fail --force (make it up with your pull requests)Carlos Duarte do Nascimento
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03Gourav Varma
 
Introduce to Git and Jenkins
Introduce to Git and JenkinsIntroduce to Git and Jenkins
Introduce to Git and JenkinsAn Nguyen
 
Git for developers
Git for developersGit for developers
Git for developersHacen Dadda
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Ahmed El-Arabawy
 
PgConf US 2015 - ALTER DATABASE ADD more SANITY
PgConf US 2015  - ALTER DATABASE ADD more SANITYPgConf US 2015  - ALTER DATABASE ADD more SANITY
PgConf US 2015 - ALTER DATABASE ADD more SANITYOleksii Kliukin
 
Lesson 0.5 Introduction to Git (1).pptx
Lesson 0.5 Introduction to Git (1).pptxLesson 0.5 Introduction to Git (1).pptx
Lesson 0.5 Introduction to Git (1).pptxGHUTUGADEKALYANIBALA
 
VCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT WorkshopVCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT WorkshopAnis Ahmad
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshellalignan
 
Embracing Distributed Version Control
Embracing Distributed Version ControlEmbracing Distributed Version Control
Embracing Distributed Version ControlNowell Strite
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitLukas Fittl
 

Similar to GIT-Lesson-1 (20)

Git
GitGit
Git
 
GIT In Detail
GIT In DetailGIT In Detail
GIT In Detail
 
git fail --force (make it up with your pull requests)
git fail --force (make it up with your pull requests)git fail --force (make it up with your pull requests)
git fail --force (make it up with your pull requests)
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 
Introduce to Git and Jenkins
Introduce to Git and JenkinsIntroduce to Git and Jenkins
Introduce to Git and Jenkins
 
Git
GitGit
Git
 
Git for developers
Git for developersGit for developers
Git for developers
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
 
PgConf US 2015 - ALTER DATABASE ADD more SANITY
PgConf US 2015  - ALTER DATABASE ADD more SANITYPgConf US 2015  - ALTER DATABASE ADD more SANITY
PgConf US 2015 - ALTER DATABASE ADD more SANITY
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Mastering GIT
Mastering GITMastering GIT
Mastering GIT
 
Lesson 0.5 Introduction to Git (1).pptx
Lesson 0.5 Introduction to Git (1).pptxLesson 0.5 Introduction to Git (1).pptx
Lesson 0.5 Introduction to Git (1).pptx
 
VCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT WorkshopVCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT Workshop
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
 
git Technologies
git Technologiesgit Technologies
git Technologies
 
git-flow R3Labs
git-flow R3Labsgit-flow R3Labs
git-flow R3Labs
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Embracing Distributed Version Control
Embracing Distributed Version ControlEmbracing Distributed Version Control
Embracing Distributed Version Control
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 

GIT-Lesson-1

  • 3. CENTRALIZEDVERSION CONTROL SYSTEM • One endpoint (one server), all your changes goes to server, immediately on commit • Difficult branching (you possibly need to duplicate project directory) • difficult conflict resolving
  • 4. • Pull down any changes from another teammates • Make your changes • Commit your changes to the server and resolve conflicts TYPICAL WORKFLOW
  • 5. DECENTRALIZEDVCS • One, two, three, …, N servers or Zero (What? 0_o) • duplication • faster works (one server in office, one in DC, pushing to office, then office pushed to DC’s) • Easy branching • branch isn’t just a directory copy, it’s a real branch -> easy conflict resolving
  • 6. GIT
  • 7. STARTING WITH GIT For creating a working copy you can clone the repository or initialize git structure in any directory you want
  • 8. FIRST COMMITS WITH GIT • Make some changes • Add new/changed files to git • Commit it m aster Initial commit
  • 9. FIRST COMMITS WITH GIT • Make some changes again • See the status • Add changes to git • See status again m aster Initial commit staging
  • 10. –English folk “Don't jump the gun” ALREADY COMMIT?
  • 11. MAKING DIFFS Make diff with git diff -u HEAD m aster Initial commit staging DIFF !== PATCH
  • 12. MAKING DIFFS Make diff with git diff -u HEAD m aster Initial commit staging DIFF !== PATCH Why? Later… Be patience ;)
  • 13. MAKING BRANCH Making branches is so simple as git checkout -b “develop” , where develop is a new branch name. Commit your changes. m aster Initial commit Add main.c develop
  • 14. PATCH
  • 15. MAKING PATCH Why we need patch? Making patch to master branch from current: git format-patch mater —stdout > ../1.patch m aster Initial commit Add main.c develop What is difference between diff and patch?
  • 16. WORKING WITH PATCH Before applying check patch for errors. m aster Initial commit Add main.c develop
  • 17. APPLYING PATCH Switching back to master by git checkout master And apply the patch with git am —signoff < ../1.patch m aster Initial commit Add main.c develop Add main.c
  • 19. ADDING REMOTES If you need to add a remote for your local git repo, just use git remote add origin git@host:repo.git m aster Initial commit Add main.c develop Add main.c Also you can add different remotes for different branches or pulling from one and push to second.
  • 20. PUSH The common use of push is to run it from current local branch and set remote and remote branch where to push: git push -u origin [master | —all] m aster Initial commit Add main.c develop Add main.c
  • 21. CLONE Let’s create a new repo from cloning our first and make some changes in it and push them back. git clone /tmp/repo.git dolly m aster Initial commit Add main.c develop Add main.c Readme change
  • 22. PULL Ok. Let’s go to our first working copy and execute git pull m aster Initial commit Add main.c develop Add main.c Readme change
  • 23. ITHINK FORTHE FIRSTTIME IT’S ALL.
  • 25. NEXTTIME • Changing the history • Working with git-flow • Submodules