SlideShare a Scribd company logo
Dmitry Sheiko
@sheiko
A Quick Start –
Version Control with
Git
What is Git?
Why do people love Git?
How is Git distributed?
What does Git give us?
rep
o
rep
o
rep
o
rep
o
rep
o
rep
o
rep
o
rep
o
Git branching model
Master branch
Hotfixes
Dev. branch
Release
1.0
Feature
branches
TIM
E
Tag
0.1
Tag
0.2
Tag
1.0
How to begin using
Git?
Installation
Setup
$git config --global user.name "Your Name"
$git config --global user.email "your@email.com"
$git config --global color.diff auto
$git config --global color.status auto
$git config --global color.branch auto
Initialization
$cd /l/vhosts/os.htdocs/example
$ls
$git init
Go to the source code
Are we really there?
Create Git repository
Fork existing repository
$git clone git://github.com/dsheiko/HTML5-Form-
Shim.git
Commit
$git commit –am “comment”
Status
$git status
Reverting
$git log
$git checkout
64fd65b9194b108643e267795f9442ca9e61631f
Get revisions ids
Use one
Resetting
$git reset HEAD --hard
Branching
If we have a new feature request,
which implementation concerns much
of the source code, it would be safer
to work on the feature in a separate
branch.
$git branch Feature1022 –m “Comment”
$git checkout Feature1022
$git branch
Create a branch
Switch to the branch
Show available branches
Rebase
$git log
$git rebase -i HEAD~7
Take a look what revisions we have
Combine the last 7 revisions
Merging
As we finished the requested
feature development, we can
merge the feature branch with
the master branch
$git checkout master
$git merge Feature1022
$git branch -d Feature1022
Master branch
Feature1022
Switch to the master branch
Get rid of the feature branch
Tagging
We can tag specific points in
history as being important. E.g.
tag every stable version of the
product before deploying.
$git tag v1.1 –m “Comment”
$git checkout tags/v1.1
$git tag
$git tag –d v.1.1
$git push remote :refs/tags/v.1.1
Create a tag
Switch to the tag
Show available tags
Remote tag in local repo
Remote tag in remote repo
Log
We can see our commit
history
$git log --graph
.. and much fancier
$gitk --all
Working with a remote
repo
Let’s associate our local repo to
the new created remote repo
$cd /repos/example-remote
$git init --bare
$cd /l/vhosts/os.htdocs/example
$git remote add origin /repos/example-remote
Push changes to a remote
repo
We can push our changes
collected in the local repository
to the remote one to share
them with the team
$cd /l/vhosts/os.htdocs/example
$git push origin master
Associated remote repo
Branch
Pull changes from a remote
repo
Pull allows us to get the latest
changes from the remote
repository.
$cd /l/vhosts/os.htdocs/example
$git pull origin master
Creating patches
Patch is a text file that contains
changes to the source code. This file
can be sent to someone else and this
person can use this file to apply the
changes to his/her local
$git checkout mybranch
$git commit -am "First commit in the branch“
$git format-patch origin/master
$git checkout master
$git apply 0001-First-commit-in-the-branch.patch
Creates 0001-First-commit-in-the-
branch.patch
Git command aliases
Put into .gitconfig anywhere in
parent directory with following
content:
[alias]
cd = checkout
dir = branch
ci = commit -a -m
lg = log -p
undo = reset –hard
up = !git push origin master && git push
origin --tags
Git command aliases
Now you can use shortcuts:
$git cd SomeBranch
$git dir
$git ci “my comment“
$git up # this one pushes local commits and tags
to the remote repo
Who’s the dude?
http://dsheiko.com
@sheiko
https://github.com/dsheik

More Related Content

What's hot

Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
Dilum Navanjana
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
Aderemi Dadepo
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 
FTP Commando to Git Hero - WordCamp Denver 2013
FTP Commando to Git Hero - WordCamp Denver 2013FTP Commando to Git Hero - WordCamp Denver 2013
FTP Commando to Git Hero - WordCamp Denver 2013
Jeremy Green
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
KMS Technology
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
Matthew McCullough
 
Git Atlrug
Git AtlrugGit Atlrug
Git Atlrug
Jason Noble
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
Arulmurugan Rajaraman
 
Git introduction workshop for scientists
Git introduction workshop for scientists Git introduction workshop for scientists
Git introduction workshop for scientists
Steven Hamblin
 
Git basics
Git basicsGit basics
Git basics
GHARSALLAH Mohamed
 
GitHub Presentation
GitHub PresentationGitHub Presentation
GitHub Presentation
BrianSchilder
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
 
Git Workshop
Git WorkshopGit Workshop
Git Workshop
alexyork
 
From svn to git
From svn to gitFrom svn to git
From svn to git
Nehal Shah
 
Github - Le Wagon Melbourne
Github - Le Wagon MelbourneGithub - Le Wagon Melbourne
Github - Le Wagon Melbourne
Paal Ringstad
 
Gitting out of trouble
Gitting out of troubleGitting out of trouble
Gitting out of trouble
Jon Senchyna
 
Git real slides
Git real slidesGit real slides
Git real slides
Lucas Couto
 
An Introduction to Git
An Introduction to GitAn Introduction to Git
An Introduction to Git
Hiroyuki Vincent Yamazaki
 
How to install and use git
How to install and  use gitHow to install and  use git
How to install and use git
Faysal Hossain Shezan
 
Git and github introduction
Git and github introductionGit and github introduction
Git and github introduction
John(Qiang) Zhang
 

What's hot (20)

Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
 
FTP Commando to Git Hero - WordCamp Denver 2013
FTP Commando to Git Hero - WordCamp Denver 2013FTP Commando to Git Hero - WordCamp Denver 2013
FTP Commando to Git Hero - WordCamp Denver 2013
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git Atlrug
Git AtlrugGit Atlrug
Git Atlrug
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Git introduction workshop for scientists
Git introduction workshop for scientists Git introduction workshop for scientists
Git introduction workshop for scientists
 
Git basics
Git basicsGit basics
Git basics
 
GitHub Presentation
GitHub PresentationGitHub Presentation
GitHub Presentation
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Git Workshop
Git WorkshopGit Workshop
Git Workshop
 
From svn to git
From svn to gitFrom svn to git
From svn to git
 
Github - Le Wagon Melbourne
Github - Le Wagon MelbourneGithub - Le Wagon Melbourne
Github - Le Wagon Melbourne
 
Gitting out of trouble
Gitting out of troubleGitting out of trouble
Gitting out of trouble
 
Git real slides
Git real slidesGit real slides
Git real slides
 
An Introduction to Git
An Introduction to GitAn Introduction to Git
An Introduction to Git
 
How to install and use git
How to install and  use gitHow to install and  use git
How to install and use git
 
Git and github introduction
Git and github introductionGit and github introduction
Git and github introduction
 

Similar to A Quick Start - Version Control with Git

Git
GitGit
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
Sothearin Ren
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
Rifauddin Tsalitsy
 
Git and github
Git and githubGit and github
Git and github
Teodora Ahkozidou
 
Git and Github
Git and GithubGit and Github
Git and Github
Teodora Ahkozidou
 
GTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSourceGTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSource
Forest Mars
 
Hello git
Hello git Hello git
Hello git
Josh Dvir
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
Victor Wong
 
Git101
Git101Git101
Git101
Jason Noble
 
Atlanta Pm Git 101
Atlanta Pm Git 101Atlanta Pm Git 101
Atlanta Pm Git 101
Jason Noble
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
themystic_ca
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GIT
Arpit Mohan
 
Git
GitGit
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
Becky Todd
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
Sébastien Saunier
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
Nguyen Van Hung
 
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
Lemi Orhan Ergin
 
Git basics
Git basicsGit basics
Git basics
Amit Sawhney
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Lemi Orhan Ergin
 
Git github
Git githubGit github
Git github
Anurag Deb
 

Similar to A Quick Start - Version Control with Git (20)

Git
GitGit
Git
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
Git and github
Git and githubGit and github
Git and github
 
Git and Github
Git and GithubGit and Github
Git and Github
 
GTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSourceGTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSource
 
Hello git
Hello git Hello git
Hello git
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Git101
Git101Git101
Git101
 
Atlanta Pm Git 101
Atlanta Pm Git 101Atlanta Pm Git 101
Atlanta Pm Git 101
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GIT
 
Git
GitGit
Git
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
 
Git basics
Git basicsGit basics
Git basics
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
 
Git github
Git githubGit github
Git github
 

More from Dmitry Sheiko

The Flavor of TypeScript
The Flavor of TypeScriptThe Flavor of TypeScript
The Flavor of TypeScript
Dmitry Sheiko
 
Writing Scalable and Maintainable CSS
Writing Scalable and Maintainable CSSWriting Scalable and Maintainable CSS
Writing Scalable and Maintainable CSS
Dmitry Sheiko
 
Tooling JavaScript to ensure consistency in coding style
Tooling JavaScript to ensure consistency in coding styleTooling JavaScript to ensure consistency in coding style
Tooling JavaScript to ensure consistency in coding style
Dmitry Sheiko
 
JavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right ChoiceJavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right Choice
Dmitry Sheiko
 
Modular JavaScript with CommonJS Compiler
Modular JavaScript with CommonJS CompilerModular JavaScript with CommonJS Compiler
Modular JavaScript with CommonJS Compiler
Dmitry Sheiko
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
Dmitry Sheiko
 
Bringing classical OOP into JavaScript
Bringing classical OOP into JavaScriptBringing classical OOP into JavaScript
Bringing classical OOP into JavaScript
Dmitry Sheiko
 

More from Dmitry Sheiko (7)

The Flavor of TypeScript
The Flavor of TypeScriptThe Flavor of TypeScript
The Flavor of TypeScript
 
Writing Scalable and Maintainable CSS
Writing Scalable and Maintainable CSSWriting Scalable and Maintainable CSS
Writing Scalable and Maintainable CSS
 
Tooling JavaScript to ensure consistency in coding style
Tooling JavaScript to ensure consistency in coding styleTooling JavaScript to ensure consistency in coding style
Tooling JavaScript to ensure consistency in coding style
 
JavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right ChoiceJavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right Choice
 
Modular JavaScript with CommonJS Compiler
Modular JavaScript with CommonJS CompilerModular JavaScript with CommonJS Compiler
Modular JavaScript with CommonJS Compiler
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Bringing classical OOP into JavaScript
Bringing classical OOP into JavaScriptBringing classical OOP into JavaScript
Bringing classical OOP into JavaScript
 

Recently uploaded

留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
uehowe
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
3a0sd7z3
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
Donato Onofri
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
davidjhones387
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
Toptal Tech
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
k4ncd0z
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
rtunex8r
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
uehowe
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
Tarandeep Singh
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
wolfsoftcompanyco
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 

Recently uploaded (16)

留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 

A Quick Start - Version Control with Git

  • 1. Dmitry Sheiko @sheiko A Quick Start – Version Control with Git
  • 3. Why do people love Git?
  • 4. How is Git distributed?
  • 5. What does Git give us? rep o rep o rep o rep o rep o rep o rep o rep o
  • 6. Git branching model Master branch Hotfixes Dev. branch Release 1.0 Feature branches TIM E Tag 0.1 Tag 0.2 Tag 1.0
  • 7. How to begin using Git?
  • 9. Setup $git config --global user.name "Your Name" $git config --global user.email "your@email.com" $git config --global color.diff auto $git config --global color.status auto $git config --global color.branch auto
  • 10. Initialization $cd /l/vhosts/os.htdocs/example $ls $git init Go to the source code Are we really there? Create Git repository
  • 11. Fork existing repository $git clone git://github.com/dsheiko/HTML5-Form- Shim.git
  • 12. Commit $git commit –am “comment”
  • 16. Branching If we have a new feature request, which implementation concerns much of the source code, it would be safer to work on the feature in a separate branch. $git branch Feature1022 –m “Comment” $git checkout Feature1022 $git branch Create a branch Switch to the branch Show available branches
  • 17. Rebase $git log $git rebase -i HEAD~7 Take a look what revisions we have Combine the last 7 revisions
  • 18. Merging As we finished the requested feature development, we can merge the feature branch with the master branch $git checkout master $git merge Feature1022 $git branch -d Feature1022 Master branch Feature1022 Switch to the master branch Get rid of the feature branch
  • 19. Tagging We can tag specific points in history as being important. E.g. tag every stable version of the product before deploying. $git tag v1.1 –m “Comment” $git checkout tags/v1.1 $git tag $git tag –d v.1.1 $git push remote :refs/tags/v.1.1 Create a tag Switch to the tag Show available tags Remote tag in local repo Remote tag in remote repo
  • 20. Log We can see our commit history $git log --graph .. and much fancier $gitk --all
  • 21. Working with a remote repo Let’s associate our local repo to the new created remote repo $cd /repos/example-remote $git init --bare $cd /l/vhosts/os.htdocs/example $git remote add origin /repos/example-remote
  • 22. Push changes to a remote repo We can push our changes collected in the local repository to the remote one to share them with the team $cd /l/vhosts/os.htdocs/example $git push origin master Associated remote repo Branch
  • 23. Pull changes from a remote repo Pull allows us to get the latest changes from the remote repository. $cd /l/vhosts/os.htdocs/example $git pull origin master
  • 24. Creating patches Patch is a text file that contains changes to the source code. This file can be sent to someone else and this person can use this file to apply the changes to his/her local $git checkout mybranch $git commit -am "First commit in the branch“ $git format-patch origin/master $git checkout master $git apply 0001-First-commit-in-the-branch.patch Creates 0001-First-commit-in-the- branch.patch
  • 25. Git command aliases Put into .gitconfig anywhere in parent directory with following content: [alias] cd = checkout dir = branch ci = commit -a -m lg = log -p undo = reset –hard up = !git push origin master && git push origin --tags
  • 26. Git command aliases Now you can use shortcuts: $git cd SomeBranch $git dir $git ci “my comment“ $git up # this one pushes local commits and tags to the remote repo