SlideShare ist ein Scribd-Unternehmen logo
1 von 41
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…

Weitere ähnliche Inhalte

Was ist angesagt?

Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflowsArthur Shvetsov
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial IJim Yeh
 
Git introduction workshop for scientists
Git introduction workshop for scientists Git introduction workshop for scientists
Git introduction workshop for scientists Steven Hamblin
 
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
 
Git tutorial
Git tutorialGit tutorial
Git tutorialmobaires
 
Git extension-training
Git extension-trainingGit extension-training
Git extension-trainingEric Guo
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & GitJason Byrne
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control SystemKMS Technology
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitColin Su
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowMikhail Melnik
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitE Carter
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitLukas Fittl
 

Was ist angesagt? (20)

Git commands
Git commandsGit commands
Git commands
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Git basics
Git basicsGit basics
Git basics
 
Git introduction workshop for scientists
Git introduction workshop for scientists Git introduction workshop for scientists
Git introduction workshop for scientists
 
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 ...
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Git
GitGit
Git
 
Git basic
Git basicGit basic
Git basic
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git extension-training
Git extension-trainingGit extension-training
Git extension-training
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Git undo
Git undoGit undo
Git undo
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
An Introduction to Git
An Introduction to GitAn Introduction to Git
An Introduction to Git
 

Ähnlich wie Git

Ähnlich wie Git (20)

Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Git and git hub
Git and git hubGit and git hub
Git and git hub
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with git
 
GDSC GIT AND GITHUB
GDSC GIT AND GITHUB GDSC GIT AND GITHUB
GDSC GIT AND GITHUB
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 
Git
GitGit
Git
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
git Technologies
git Technologiesgit Technologies
git Technologies
 
Using Subversion and Git Together
Using Subversion and Git TogetherUsing Subversion and Git Together
Using Subversion and Git Together
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
 
Git
GitGit
Git
 
Git
GitGit
Git
 

Mehr von IT Booze

Erlang - concurrency-oriented programming by Serhiy Yvtyshenko
Erlang - concurrency-oriented programming by Serhiy YvtyshenkoErlang - concurrency-oriented programming by Serhiy Yvtyshenko
Erlang - concurrency-oriented programming by Serhiy YvtyshenkoIT Booze
 
Cloud Providers: Amazon, Rackspace, Azure by Andriy Tsok
Cloud Providers: Amazon, Rackspace, Azure by Andriy TsokCloud Providers: Amazon, Rackspace, Azure by Andriy Tsok
Cloud Providers: Amazon, Rackspace, Azure by Andriy TsokIT Booze
 
Let's teach your child programming with Greenfoot by Oleg Pashkevych
Let's teach your child programming with Greenfoot by Oleg Pashkevych Let's teach your child programming with Greenfoot by Oleg Pashkevych
Let's teach your child programming with Greenfoot by Oleg Pashkevych IT Booze
 
Overview of Google spreadsheet API for Java by Nazar Kostiv
Overview of Google spreadsheet API for Java by Nazar Kostiv Overview of Google spreadsheet API for Java by Nazar Kostiv
Overview of Google spreadsheet API for Java by Nazar Kostiv IT Booze
 
Microsoft Dynamics CRM Overview by Anatoly Kvasnikov
Microsoft Dynamics CRM Overview by Anatoly KvasnikovMicrosoft Dynamics CRM Overview by Anatoly Kvasnikov
Microsoft Dynamics CRM Overview by Anatoly KvasnikovIT Booze
 
Windows Phone and mobile application development
Windows Phone and mobile application developmentWindows Phone and mobile application development
Windows Phone and mobile application developmentIT Booze
 
Windows 8 and Metro design applications
Windows 8 and Metro design applicationsWindows 8 and Metro design applications
Windows 8 and Metro design applicationsIT Booze
 
Introduction to mercurial
Introduction to mercurialIntroduction to mercurial
Introduction to mercurialIT Booze
 

Mehr von IT Booze (9)

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

Kürzlich hochgeladen

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Kürzlich hochgeladen (20)

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

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…