SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
GIT Version Control
 davidx <mykingheaven@gmail.com>
about branch

A branch in Git is simply a lightweight
movable pointer to one of these commits.

“master” is the default branch
commands
git branch

git checkout

git reset

git merge

git rebase
git branch
git branch - list all branches locally

git branch -r - list all branches on the
remote side

git branch -d <XXX> - delete branch XXX

git branch -m <XXX> <YYY> - rename XXX to
YYY
git checkout

git checkout <BRANCH NAME> - switch to
that branch

git checkout -b <BRANCH NAME> - create a
new branch and switch to that branch
git reset
git reset --hard HEAD - give up all
uncommited changes

git reset --hard HEAD^ - back to the last
commit

ATTENTION: these changes are permanent,
you can not restore. Be careful.
git merge


git merge <BRANCH NAME> - merge changes
to the current branch
git rebase



git rebase <BRANCH NAME> - get changes
since master is changed
before rebase

          A -> B -> C -- branch
      /
D -> E -> F -- master
after rebase

               A -> B -> C -- branch
           /
D -> E -> F -- master
how we work

master branch is the root branch, you should
not develop under this branch

all feature development should under their
own branches

only when a feature is finished can it be
merged into develop branch

bug fix should have its own branch
example
initiate a repository

create a new branch: develop

create a new feature branch:feature1

merge feature1 into develop

create a new feature branch:feature2

merge feature2 into develop

merge develop into master and create a tag for it
when you fix a bug

create a new branch from develop: 512

fix your bug

switch to develop

merge branch 512

delete branch 512 - this step is optional
work with svn
I don’t use any plugins for it

always update svn in master branch

always commit svn in master branch

develop or fix bug in new git branch

merge into master branch

rebase other branches if master get updates
git flow


it’s a very successful git branch model

it have 2 important branches: master, develop

develop is the hot branch, all tests can be
done under this branch
feature
                                                    release branches
                       branches           develop                                hot xes   master




                                                                                                    Tag




Time
                                                                                                    0.1



                           Major                                   Severe bug
                         feature for                                  xed for
        Feature                                                    production:
                        next release
       for future                                                   hot x 0.2
        release

                                                    Incorporate
                                                      bug x in
                                                      develop


                                                                                                    Tag
                                                                                                    0.2



                                                                          Start of
                                                                          release
                                                                         branch for

                    From this point on,
                                                                            1.0
                       “next release”
                    means the release
                         after 1.0


                                                                           Only
                                                                         bug xes!




                                                    Bug xes from
                                                                                                    Tag
                                                     rel. branch
                                                       may be                                       1.0
                                                    continuously
                                                    merged back
                                                    into develop
Q&A

Más contenido relacionado

Similar a GIT Version Control Basics

A Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyA Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyVivek Parihar
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model abodeltae
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow IntroductionDavid Paluy
 
GitFlow Workshop
GitFlow WorkshopGitFlow Workshop
GitFlow WorkshopSyed Imam
 
Source code management with Git
Source code management with GitSource code management with Git
Source code management with GitRadu Barbu
 
Gitflow - Una metología para manejo de Branches
Gitflow - Una metología para manejo de BranchesGitflow - Una metología para manejo de Branches
Gitflow - Una metología para manejo de BranchesJavier Alvarez
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitMaulik Shah
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitMaulik Shah
 
Clarive 7 Branching Model
Clarive 7 Branching ModelClarive 7 Branching Model
Clarive 7 Branching ModelClarive
 
Revisions
RevisionsRevisions
Revisionsswat_kh
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git MigrationTim Massey
 

Similar a GIT Version Control Basics (20)

Uber git workflow
Uber git workflowUber git workflow
Uber git workflow
 
Uber git workflow
Uber git workflowUber git workflow
Uber git workflow
 
Uber git workflow
Uber git workflowUber git workflow
Uber git workflow
 
Gitflow Workflow
Gitflow WorkflowGitflow Workflow
Gitflow Workflow
 
A Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyA Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching Strategy
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
 
Git workflows
Git workflowsGit workflows
Git workflows
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
GitFlow Workshop
GitFlow WorkshopGitFlow Workshop
GitFlow Workshop
 
Source code management with Git
Source code management with GitSource code management with Git
Source code management with Git
 
Git flow workflow example
Git flow workflow exampleGit flow workflow example
Git flow workflow example
 
Subversion
SubversionSubversion
Subversion
 
Gitflow - Una metología para manejo de Branches
Gitflow - Una metología para manejo de BranchesGitflow - Una metología para manejo de Branches
Gitflow - Una metología para manejo de Branches
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
 
Svn Basic Tutorial
Svn Basic TutorialSvn Basic Tutorial
Svn Basic Tutorial
 
Hdfs high availability
Hdfs high availabilityHdfs high availability
Hdfs high availability
 
Clarive 7 Branching Model
Clarive 7 Branching ModelClarive 7 Branching Model
Clarive 7 Branching Model
 
Revisions
RevisionsRevisions
Revisions
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 

Último

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 

GIT Version Control Basics

  • 1. GIT Version Control davidx <mykingheaven@gmail.com>
  • 2. about branch A branch in Git is simply a lightweight movable pointer to one of these commits. “master” is the default branch
  • 3. commands git branch git checkout git reset git merge git rebase
  • 4. git branch git branch - list all branches locally git branch -r - list all branches on the remote side git branch -d <XXX> - delete branch XXX git branch -m <XXX> <YYY> - rename XXX to YYY
  • 5. git checkout git checkout <BRANCH NAME> - switch to that branch git checkout -b <BRANCH NAME> - create a new branch and switch to that branch
  • 6. git reset git reset --hard HEAD - give up all uncommited changes git reset --hard HEAD^ - back to the last commit ATTENTION: these changes are permanent, you can not restore. Be careful.
  • 7. git merge git merge <BRANCH NAME> - merge changes to the current branch
  • 8. git rebase git rebase <BRANCH NAME> - get changes since master is changed
  • 9. before rebase A -> B -> C -- branch / D -> E -> F -- master
  • 10. after rebase A -> B -> C -- branch / D -> E -> F -- master
  • 11. how we work master branch is the root branch, you should not develop under this branch all feature development should under their own branches only when a feature is finished can it be merged into develop branch bug fix should have its own branch
  • 12. example initiate a repository create a new branch: develop create a new feature branch:feature1 merge feature1 into develop create a new feature branch:feature2 merge feature2 into develop merge develop into master and create a tag for it
  • 13. when you fix a bug create a new branch from develop: 512 fix your bug switch to develop merge branch 512 delete branch 512 - this step is optional
  • 14. work with svn I don’t use any plugins for it always update svn in master branch always commit svn in master branch develop or fix bug in new git branch merge into master branch rebase other branches if master get updates
  • 15. git flow it’s a very successful git branch model it have 2 important branches: master, develop develop is the hot branch, all tests can be done under this branch
  • 16. feature release branches branches develop hot xes master Tag Time 0.1 Major Severe bug feature for xed for Feature production: next release for future hot x 0.2 release Incorporate bug x in develop Tag 0.2 Start of release branch for From this point on, 1.0 “next release” means the release after 1.0 Only bug xes! Bug xes from Tag rel. branch may be 1.0 continuously merged back into develop
  • 17. Q&A