SlideShare a Scribd company logo
GIT

      By
Serhiy Yakovyn
Agenda
• Describe how GIT commands corresponds to
  SubVersioN ones.
• Provide some commonly used workflows.
• Explain how to use GIT when your team works
  with SVN.
• Give a quick overview of GIT internals
GIT to SVN mapping
Create the new repo:
svnadmin create repo
svn import file://repo

git init
git add .
git commit
GIT to SVN mapping
To revert:
svn revert path
Git checkout path
GIT to SVN mapping
To commit:
svn commit

git commit -a
GIT to SVN mapping
Branching:
svn copy http://example.com/svn/trunk
http://example.com/svn/branches/branch

svn switch http://example.com/svn/branches/branch

git branch branch
git checkout branch
GIT to SVN mapping
List:
svn list http://example.com/svn/branches/
git branch
GIT to SVN mapping
Moving between revisions:
svn update -r rev
svn update

git checkout rev
git checkout prevbranch
GIT to SVN mapping
(assuming the branch was created in revision 20
and you are inside a working copy of trunk)
svn merge -r 20:HEAD
http://example.com/svn/branches/branch

git merge branch
GIT to SVN mapping
Pick commit from another branch:
svn merge -c rev url
git cherry-pick rev
GIT to SVN mapping
Cloning remote repo:
svn checkout url

git clone url
GIT to SVN mapping
Remote branch:
svn switch url
git checkout --track -b branch origin/branch
GIT to SVN mapping
Remote update:
svn update
git pull
GIT to SVN mapping
Remote commit:
svn commit
git push
Some commonly used workflows
1. Write new features in feature branches.
2. Integrate on the master branch.
3. Deploy from the release branch.
Some commonly used workflows
1. Write new features in feature branches.
# create a new feature branch in the remote repo named feature_branch
git push origin master:refs/heads/feature_branch

# make sure we've got everything updated from the remote repo
git fetch origin

# create a local branch named feature_branch that tracks
# the remote feature_branch
git branch --track feature_branch origin/feature_branch

# check out the new branch
git checkout feature_branch
Some commonly used workflows
2. Integrate on master branch.
git merge master

git checkout master
git merge feature_branch

# this has to be in competition for one of the least intuitive
# commands ever, but it removes the remote branch
git push origin :refs/heads/feature_branch

# remove the local branch
git branch -d feature_branch
Some commonly used workflows
3. Deploy from the release branch.
# checkout the deploy branch
git checkout deploy

# pull the deploy branch, just to be sure everything's up to date
git pull origin deploy

# merge the master branch into the deploy branch
git merge master

# tag the release that we're about to make
git tag -a -m "My comments about this release" [tag_name]

# push it all up to the remote repository
git push --tags origin deploy

# switch back to the master branch,
# since we never do any work on the deploy branch
git checkout master
Some commonly used workflows
1. Pull to update your local master
2. Check out a feature branch
3. Do work in your feature branch, committing early
and often
4. Rebase frequently to incorporate upstream
changes
5. Interactive rebase (squash) your commits
6. Merge your changes with master
7. Push your changes to the upstream
Some commonly used workflows
1. Pull to update your local master
git checkout master
git pull origin master
Some commonly used workflows
2. Check out a branch
git checkout -b <branch>
Some commonly used workflows
3. Do work in your feature branch, committing
early and often
Hacking…
git commit
Hacking…
git commit
Hacking…
git commit
Some commonly used workflows
4. Rebase frequently to incorporate upstream
changes
git fetch origin master
git rebase origin/master
Or (longer way):
git checkout master
git pull
git checkout <branch>
git rebase master
Some commonly used workflows
5. Interactive rebase (squash) your commits
git rebase -i origin/master
Some commonly used workflows
6. Merge your changes with master
git checkout master
git pull
git merge <branch>
Some commonly used workflows
7. Push your changes to the upstream
git push origin master
GIT SVN

How to use GIT when your team works with
SVN?
1. Creating working copy? – no! working repo.
git svn init …
Some magic 
git svn fetch
Or (if you are lucky! – I’ve never been):
git svn clone …
GIT SVN

2. Hacking. Just usual GIT
git checkout –b <branch>
hacking…
git commit
hacking…
GIT SVN

3. Updating from SVN
git svn rebase
or
git svn fetch
git svn rebase –l
GIT SVN

4. Preparing your work
git rebase –i remote/<branch>
GIT SVN

5. Committing back to SVN
git svn dcommit
GIT SVN

6. Branching:
git svn branch
GIT internals

.git content
HEAD – the checked out branch
config – configuration options
description – description (used by GitWeb)
hooks/
index - staging
info/
objects/ - content
refs/ - pointers to commit objects in branches
GIT internals

Git is a content-addressable filesystem.
This means that at the core of Git is a simple
key-value data store.
You can insert any kind of content into it, and it
will give you back a key that you can use to
retrieve the content again at any time.
git hash-object – stores the file in GIT
GIT internals

git cat-file - provides content or type and size
information for repository objects

BLOB – basic object type. Every file is stored in it
GIT internals

Tree object
GIT internals

Tree object
git update-index
git write-tree
git read-tree
GIT internals

Commit Objects
git commit-tree
GIT internals

Git References
git update-ref
Questions?
Useful links
http://progit.org/book/
Git Workflow – GitHub
Git SVN Workflow
http://maymay.net/blog/2009/02/24/how-to-
use-git-svn-as-the-only-subversion-client-youll-
need/
and many-many-many others…

More Related Content

What's hot (20)

PPTX
Git commands
Viyaan Jhiingade
 
PDF
Git and GitHub workflows
Arthur Shvetsov
 
PDF
Git Tutorial I
Jim Yeh
 
PDF
Git basics
GHARSALLAH Mohamed
 
PDF
Git introduction workshop for scientists
Steven Hamblin
 
PPTX
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 
PPTX
Git in 10 minutes
Safique Ahmed Faruque
 
PPT
Git basic
Emran Ul Hadi
 
PDF
Git tutorial
mobaires
 
PPTX
Git extension-training
Eric Guo
 
PDF
Version Control & Git
Jason Byrne
 
PDF
Git Version Control System
KMS Technology
 
PPTX
01 - Git vs SVN
Edward Goikhman
 
PDF
Introduction to Git
Colin Su
 
PDF
Git Series. Episode 3. Git Flow and Github-Flow
Mikhail Melnik
 
KEY
The everyday developer's guide to version control with Git
E Carter
 
PPTX
Git undo
Avilay Parekh
 
KEY
Introduction to Git
Lukas Fittl
 
PDF
An Introduction to Git
Hiroyuki Vincent Yamazaki
 
Git commands
Viyaan Jhiingade
 
Git and GitHub workflows
Arthur Shvetsov
 
Git Tutorial I
Jim Yeh
 
Git basics
GHARSALLAH Mohamed
 
Git introduction workshop for scientists
Steven Hamblin
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 
Git in 10 minutes
Safique Ahmed Faruque
 
Git basic
Emran Ul Hadi
 
Git tutorial
mobaires
 
Git extension-training
Eric Guo
 
Version Control & Git
Jason Byrne
 
Git Version Control System
KMS Technology
 
01 - Git vs SVN
Edward Goikhman
 
Introduction to Git
Colin Su
 
Git Series. Episode 3. Git Flow and Github-Flow
Mikhail Melnik
 
The everyday developer's guide to version control with Git
E Carter
 
Git undo
Avilay Parekh
 
Introduction to Git
Lukas Fittl
 
An Introduction to Git
Hiroyuki Vincent Yamazaki
 

Similar to Git (20)

PPTX
Git more done
Kwen Peterson
 
PPT
Git presentation
James Cuzella
 
PDF
Git and git hub
Sebastiaan Deckers
 
KEY
Git Tech Talk
Chris Johnson
 
PDF
Git collaboration
Ivelin Yanev
 
KEY
Introduction to Git
Omar Ali
 
PDF
Git vs Subversion: ¿Cuando elegir uno u otro?
Paradigma Digital
 
PDF
Git for developers
Hacen Dadda
 
PPT
Introduction to git
Nguyen Van Hung
 
PDF
Smalltalk on Git
mattmatt
 
PPTX
Git tips and tricks
Chris Ballance
 
ODP
Git tech talk
razasayed
 
ODP
Git presentation
Julien Renaux
 
PDF
GIT_training_SoftServeBulgaria2016
Peter Denev
 
PPTX
Introduction to Git and Github
Max Claus Nunes
 
PPT
Git-GitHub.ppt Diploma in computer. engineering
Roshankumar558219
 
PPT
Report about the dangers of git and github on the environment
lameche1islam
 
PPT
Distributed Version control using Git and Github
RikinBasu1
 
PDF
Git: a brief introduction
Randal Schwartz
 
PPTX
Git 101
jayrparro
 
Git more done
Kwen Peterson
 
Git presentation
James Cuzella
 
Git and git hub
Sebastiaan Deckers
 
Git Tech Talk
Chris Johnson
 
Git collaboration
Ivelin Yanev
 
Introduction to Git
Omar Ali
 
Git vs Subversion: ¿Cuando elegir uno u otro?
Paradigma Digital
 
Git for developers
Hacen Dadda
 
Introduction to git
Nguyen Van Hung
 
Smalltalk on Git
mattmatt
 
Git tips and tricks
Chris Ballance
 
Git tech talk
razasayed
 
Git presentation
Julien Renaux
 
GIT_training_SoftServeBulgaria2016
Peter Denev
 
Introduction to Git and Github
Max Claus Nunes
 
Git-GitHub.ppt Diploma in computer. engineering
Roshankumar558219
 
Report about the dangers of git and github on the environment
lameche1islam
 
Distributed Version control using Git and Github
RikinBasu1
 
Git: a brief introduction
Randal Schwartz
 
Git 101
jayrparro
 
Ad

More from IT Booze (9)

PPTX
Erlang - concurrency-oriented programming by Serhiy Yvtyshenko
IT Booze
 
PPTX
Cloud Providers: Amazon, Rackspace, Azure by Andriy Tsok
IT Booze
 
PPTX
Let's teach your child programming with Greenfoot by Oleg Pashkevych
IT Booze
 
PDF
Overview of Google spreadsheet API for Java by Nazar Kostiv
IT Booze
 
PPTX
Microsoft Dynamics CRM Overview by Anatoly Kvasnikov
IT Booze
 
PPT
Windows Phone and mobile application development
IT Booze
 
PPTX
Windows 8 and Metro design applications
IT Booze
 
PPTX
Savana
IT Booze
 
PDF
Introduction to mercurial
IT Booze
 
Erlang - concurrency-oriented programming by Serhiy Yvtyshenko
IT Booze
 
Cloud Providers: Amazon, Rackspace, Azure by Andriy Tsok
IT Booze
 
Let's teach your child programming with Greenfoot by Oleg Pashkevych
IT Booze
 
Overview of Google spreadsheet API for Java by Nazar Kostiv
IT Booze
 
Microsoft Dynamics CRM Overview by Anatoly Kvasnikov
IT Booze
 
Windows Phone and mobile application development
IT Booze
 
Windows 8 and Metro design applications
IT Booze
 
Savana
IT Booze
 
Introduction to mercurial
IT Booze
 
Ad

Recently uploaded (20)

PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 

Git

  • 1. GIT By Serhiy Yakovyn
  • 2. Agenda • Describe how GIT commands corresponds to SubVersioN ones. • Provide some commonly used workflows. • Explain how to use GIT when your team works with SVN. • Give a quick overview of GIT internals
  • 3. GIT to SVN mapping Create the new repo: svnadmin create repo svn import file://repo git init git add . git commit
  • 4. GIT to SVN mapping To revert: svn revert path Git checkout path
  • 5. GIT to SVN mapping To commit: svn commit git commit -a
  • 6. GIT to SVN mapping Branching: svn copy http://example.com/svn/trunk http://example.com/svn/branches/branch svn switch http://example.com/svn/branches/branch git branch branch git checkout branch
  • 7. GIT to SVN mapping List: svn list http://example.com/svn/branches/ git branch
  • 8. GIT to SVN mapping Moving between revisions: svn update -r rev svn update git checkout rev git checkout prevbranch
  • 9. GIT to SVN mapping (assuming the branch was created in revision 20 and you are inside a working copy of trunk) svn merge -r 20:HEAD http://example.com/svn/branches/branch git merge branch
  • 10. GIT to SVN mapping Pick commit from another branch: svn merge -c rev url git cherry-pick rev
  • 11. GIT to SVN mapping Cloning remote repo: svn checkout url git clone url
  • 12. GIT to SVN mapping Remote branch: svn switch url git checkout --track -b branch origin/branch
  • 13. GIT to SVN mapping Remote update: svn update git pull
  • 14. GIT to SVN mapping Remote commit: svn commit git push
  • 15. Some commonly used workflows 1. Write new features in feature branches. 2. Integrate on the master branch. 3. Deploy from the release branch.
  • 16. Some commonly used workflows 1. Write new features in feature branches. # create a new feature branch in the remote repo named feature_branch git push origin master:refs/heads/feature_branch # make sure we've got everything updated from the remote repo git fetch origin # create a local branch named feature_branch that tracks # the remote feature_branch git branch --track feature_branch origin/feature_branch # check out the new branch git checkout feature_branch
  • 17. Some commonly used workflows 2. Integrate on master branch. git merge master git checkout master git merge feature_branch # this has to be in competition for one of the least intuitive # commands ever, but it removes the remote branch git push origin :refs/heads/feature_branch # remove the local branch git branch -d feature_branch
  • 18. Some commonly used workflows 3. Deploy from the release branch. # checkout the deploy branch git checkout deploy # pull the deploy branch, just to be sure everything's up to date git pull origin deploy # merge the master branch into the deploy branch git merge master # tag the release that we're about to make git tag -a -m "My comments about this release" [tag_name] # push it all up to the remote repository git push --tags origin deploy # switch back to the master branch, # since we never do any work on the deploy branch git checkout master
  • 19. Some commonly used workflows 1. Pull to update your local master 2. Check out a feature branch 3. Do work in your feature branch, committing early and often 4. Rebase frequently to incorporate upstream changes 5. Interactive rebase (squash) your commits 6. Merge your changes with master 7. Push your changes to the upstream
  • 20. Some commonly used workflows 1. Pull to update your local master git checkout master git pull origin master
  • 21. Some commonly used workflows 2. Check out a branch git checkout -b <branch>
  • 22. Some commonly used workflows 3. Do work in your feature branch, committing early and often Hacking… git commit Hacking… git commit Hacking… git commit
  • 23. Some commonly used workflows 4. Rebase frequently to incorporate upstream changes git fetch origin master git rebase origin/master Or (longer way): git checkout master git pull git checkout <branch> git rebase master
  • 24. Some commonly used workflows 5. Interactive rebase (squash) your commits git rebase -i origin/master
  • 25. Some commonly used workflows 6. Merge your changes with master git checkout master git pull git merge <branch>
  • 26. Some commonly used workflows 7. Push your changes to the upstream git push origin master
  • 27. GIT SVN How to use GIT when your team works with SVN? 1. Creating working copy? – no! working repo. git svn init … Some magic  git svn fetch Or (if you are lucky! – I’ve never been): git svn clone …
  • 28. GIT SVN 2. Hacking. Just usual GIT git checkout –b <branch> hacking… git commit hacking…
  • 29. GIT SVN 3. Updating from SVN git svn rebase or git svn fetch git svn rebase –l
  • 30. GIT SVN 4. Preparing your work git rebase –i remote/<branch>
  • 31. GIT SVN 5. Committing back to SVN git svn dcommit
  • 33. GIT internals .git content HEAD – the checked out branch config – configuration options description – description (used by GitWeb) hooks/ index - staging info/ objects/ - content refs/ - pointers to commit objects in branches
  • 34. GIT internals Git is a content-addressable filesystem. This means that at the core of Git is a simple key-value data store. You can insert any kind of content into it, and it will give you back a key that you can use to retrieve the content again at any time. git hash-object – stores the file in GIT
  • 35. GIT internals git cat-file - provides content or type and size information for repository objects BLOB – basic object type. Every file is stored in it
  • 37. GIT internals Tree object git update-index git write-tree git read-tree
  • 41. Useful links http://progit.org/book/ Git Workflow – GitHub Git SVN Workflow http://maymay.net/blog/2009/02/24/how-to- use-git-svn-as-the-only-subversion-client-youll- need/ and many-many-many others…