SlideShare a Scribd company logo
1 of 25
Download to read offline
git
MOST OF THE THINGS ABOUT A TRENDING DVCS
ISURU WIMALASUNDERA
VERSION CONTROL
▸ version control , revision control & source control are
referring to the same…
▸ version control systems are to manage the changes done
on software programs, documents and any collection of
information .
▸ Centralized version control systems (CVCS) and
Distributed version (DVCS)
▸ CVCS - CVS , Subversion (SVN) , Perforce
DVCS …
▸ Mercurial, Git and Bazaar
▸ Has a central repository But ….
▸ Do not rely on that central repo to
store all the versions of a project.
▸ every developer “clones” a copy of
the central repository.
▸ The “clone” copy has the full history
and all meta-data of the original.
▸ “pull” to get new change, “push” to
add new change.
ADVANTAGES & DISADVANTAGES OF DVCS
▸ pushing and pulling changes are fast , as it is not accessing
a remote server but your own hard drive.
▸ offline commit of changes.
▸ can commit a set of changes without affecting others.
▸ Others can refer ones local repository and check changes.
▸ If the main repo is very large and has long history it can
consume large amount of space and lot of time to
download.
"I'M AN EGOTISTICAL BASTARD, AND I NAME ALL MY
PROJECTS AFTER MYSELF. FIRST 'LINUX', NOW 'GIT'."
Linus Torvalds
GIT - HOW IT ALL BEGINS
▸ founded by Linus Torvalds and the
Linux Kernel team
▸ From 1991 to 2002 modifications to
linux kernel was kept in file system as
patches.
▸ Linux moved to BitKeeper a
proprietary DVCS in 2002.
▸ BitKeeper revoked the free usage for
linux team, and Linux Kernel team
started writing their own DVCS.
▸ so came the git , and the rest is
history….
GIT COMMANDS
▸
INSTALLING GIT …
▸ Installing git - enough references are there in Google
▸ Installation methods are platform specific.
UNDERSTANDING GIT CORE
▸ git is a content-addressable filesystem, bit like Unix.
▸ means that at the core of Git is a simple key-value data
store.
▸ The key is a 40-character checksum hash.
▸ value can be different types of git objects.
▸ git Object types
▸ Tree Objects, Blob Objects, Commit Objects & Tag
Objects
UNDERSTANDING GIT CORE (CONTD.)
▸ Tree Objects represent the
repository. (similar to a folder/
directory in a file system)
▸ Blob objects are the leafs , any file
in the repository. (similar to files in
a file system)
▸ Commit Objects the functional
object of repository current status.
▸ Tag Objects categorise a commit
object by naming it.
▸ A good reference
▸ https://git-scm.com/book/en/
v2/Git-Internals-Git-Objects
CREATE YOUR GIT REPOSITORY
▸ Configure your git
▸ git config --global user.name "Your Name"
▸ git config --global user.email you@example.com
▸ Go in to your project and initialise a git repository.
▸ git init
▸ Add all the project directories and files to repository.
▸ git add .
▸ Now Commit all the added directories and files to git.
▸ git commit -m “<commit-message>”
WHERE IS THE GIT REPOSITORY ?
▸ Its there along with the project files, look for a hidden file
“.git” , a single folder , in the project root.
▸ The git repository contains
▸ Head file
▸ Objects
▸ branches
▸ logs and many more
WHAT HAPPENS WHEN YOU ADD TO GIT ?
▸ Git Three Tree
USEFUL GIT COMMANDS AT THIS STAGE
▸ git log - shows a log of all commits starting from HEAD
back to the initial commit.
▸ git status - shows which files have changed between
the current project state and HEAD.
▸ git diff - shows the diff between HEAD and the current
project state.
▸ git mv and git rm - mark files to be moved (rename)
and removed, respectively, much like git add.
HOW DOES GIT COMMIT WORKS ?
▸ git commit is the current status of repository.
▸ Represented by the Commit Object, the commit object
contains follows.
▸ The set of files currently available (changed/unchanged).
▸ Reference to parent commit (the SHA1 key of parent
commit).
▸ The SHA1 name.
▸ git add will add files to the commit object, current versions
of changed files, previous version of unchanged / un-
added files.
HOW DOES GIT COMMIT WORKS ? (CONTD.)
▸ git commit will submit the commit object, a commit is a
snapshot of the repository.
▸ Now the “new commit object” is the current status of the
git repository.
GIT BRANCHING
▸ Manage drastic changes, new features.
▸ Manage a different copy of the “master” within same
repository. which means another commit object.
▸ create a branch.
▸ git branch <name>
▸ Point HEAD to the new branch.
▸ git checkout <branch_name>
▸ Better to manage “trunk” & “branch” practice.
GIT MERGING
▸ If we are merging the branch to master, set HEAD to
master. And then merge
▸ git checkout master
▸ git merge <branch_name>
▸ Then do a new git commit.
CONFLICT RESOLUTION
▸ At the point of merging , if master repository has
changed from the ancestor commit, then conflicts can
happen at the point of merging.
▸ Git will add conflict messages at exact points.
▸ Manually edit those locations and commit.
COLLABORATIVE DEVELOPMENT
▸ Get someones git repository ,
▸ git clone <repo_url>
▸ Create a remote repo reference named as “origin”.
▸ Then new heads will get created pointing to the header
of remote repo, known as “remote heads”
▸ origin/master - for the master head
▸ origin/<branch> - for the branches
COLLABORATIVE DEVELOPMENT (CONTD.)
▸ create your own branch to work on the remote repository
branch.
▸ git branch --track [new-local-branch] [remote-
branch]
▸ get updates from remote branch.
▸ git fetch origin
▸ Now update your local “master” and branches with the
updates.
▸ git pull origin <master/branch_name>
COLLABORATIVE DEVELOPMENT (CONTD.)
▸ To push your changes to remote repository “master” or
branches.
▸ git push origin <master/branch_name>
CUSTOMERS OF GIT
▸
GIT SERVICES
▸
ANY QUESTIONS ?

More Related Content

What's hot

Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
Wildan Maulana
 

What's hot (20)

Git vs Subversion: ¿Cuando elegir uno u otro?
Git vs Subversion: ¿Cuando elegir uno u otro?Git vs Subversion: ¿Cuando elegir uno u otro?
Git vs Subversion: ¿Cuando elegir uno u otro?
 
Scale out, with Kubernetes (k8s)
Scale out, with Kubernetes (k8s)Scale out, with Kubernetes (k8s)
Scale out, with Kubernetes (k8s)
 
From svn to git
From svn to gitFrom svn to git
From svn to git
 
Unleashing k8 s to reduce complexities of an entire middleware platform
Unleashing k8 s to reduce complexities of an entire middleware platformUnleashing k8 s to reduce complexities of an entire middleware platform
Unleashing k8 s to reduce complexities of an entire middleware platform
 
Git
GitGit
Git
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Git in 5 Minutes
Git in 5 MinutesGit in 5 Minutes
Git in 5 Minutes
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
 
Kubernetes-Meetup
Kubernetes-MeetupKubernetes-Meetup
Kubernetes-Meetup
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Git presentation, Viktor Pyskunov
Git presentation, Viktor PyskunovGit presentation, Viktor Pyskunov
Git presentation, Viktor Pyskunov
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Kubernetes Webinar - Using ConfigMaps & Secrets
Kubernetes Webinar - Using ConfigMaps & Secrets Kubernetes Webinar - Using ConfigMaps & Secrets
Kubernetes Webinar - Using ConfigMaps & Secrets
 
CraftCamp for Students - Introduction to git
CraftCamp for Students - Introduction to gitCraftCamp for Students - Introduction to git
CraftCamp for Students - Introduction to git
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
OpenStack@Mini-Deb Conf'16 Mumbai
OpenStack@Mini-Deb Conf'16 MumbaiOpenStack@Mini-Deb Conf'16 Mumbai
OpenStack@Mini-Deb Conf'16 Mumbai
 
Heketi Functionality into Glusterd2
Heketi Functionality into Glusterd2Heketi Functionality into Glusterd2
Heketi Functionality into Glusterd2
 
Kubernetes Basics & Monitoring
Kubernetes Basics & MonitoringKubernetes Basics & Monitoring
Kubernetes Basics & Monitoring
 
Using NuGet libraries in your application
Using NuGet libraries in your applicationUsing NuGet libraries in your application
Using NuGet libraries in your application
 
SVN 2 Git
SVN 2 GitSVN 2 Git
SVN 2 Git
 

Similar to git- Most Of The Things About a Trending DVCS

Similar to git- Most Of The Things About a Trending DVCS (20)

Git and github
Git and githubGit and github
Git and github
 
Git
GitGit
Git
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 
Version controll.pptx
Version controll.pptxVersion controll.pptx
Version controll.pptx
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
Version control with GIT
Version control with GITVersion control with GIT
Version control with GIT
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Learning git
Learning gitLearning git
Learning git
 
Git slides
Git slidesGit slides
Git slides
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Git.pptx
Git.pptxGit.pptx
Git.pptx
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
setting up a repository using GIT
setting up a repository using GITsetting up a repository using GIT
setting up a repository using GIT
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git training
Git trainingGit training
Git training
 
Git 101
Git 101Git 101
Git 101
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 

git- Most Of The Things About a Trending DVCS

  • 1. git MOST OF THE THINGS ABOUT A TRENDING DVCS ISURU WIMALASUNDERA
  • 2. VERSION CONTROL ▸ version control , revision control & source control are referring to the same… ▸ version control systems are to manage the changes done on software programs, documents and any collection of information . ▸ Centralized version control systems (CVCS) and Distributed version (DVCS) ▸ CVCS - CVS , Subversion (SVN) , Perforce
  • 3. DVCS … ▸ Mercurial, Git and Bazaar ▸ Has a central repository But …. ▸ Do not rely on that central repo to store all the versions of a project. ▸ every developer “clones” a copy of the central repository. ▸ The “clone” copy has the full history and all meta-data of the original. ▸ “pull” to get new change, “push” to add new change.
  • 4. ADVANTAGES & DISADVANTAGES OF DVCS ▸ pushing and pulling changes are fast , as it is not accessing a remote server but your own hard drive. ▸ offline commit of changes. ▸ can commit a set of changes without affecting others. ▸ Others can refer ones local repository and check changes. ▸ If the main repo is very large and has long history it can consume large amount of space and lot of time to download.
  • 5. "I'M AN EGOTISTICAL BASTARD, AND I NAME ALL MY PROJECTS AFTER MYSELF. FIRST 'LINUX', NOW 'GIT'." Linus Torvalds
  • 6. GIT - HOW IT ALL BEGINS ▸ founded by Linus Torvalds and the Linux Kernel team ▸ From 1991 to 2002 modifications to linux kernel was kept in file system as patches. ▸ Linux moved to BitKeeper a proprietary DVCS in 2002. ▸ BitKeeper revoked the free usage for linux team, and Linux Kernel team started writing their own DVCS. ▸ so came the git , and the rest is history….
  • 8. INSTALLING GIT … ▸ Installing git - enough references are there in Google ▸ Installation methods are platform specific.
  • 9. UNDERSTANDING GIT CORE ▸ git is a content-addressable filesystem, bit like Unix. ▸ means that at the core of Git is a simple key-value data store. ▸ The key is a 40-character checksum hash. ▸ value can be different types of git objects. ▸ git Object types ▸ Tree Objects, Blob Objects, Commit Objects & Tag Objects
  • 10. UNDERSTANDING GIT CORE (CONTD.) ▸ Tree Objects represent the repository. (similar to a folder/ directory in a file system) ▸ Blob objects are the leafs , any file in the repository. (similar to files in a file system) ▸ Commit Objects the functional object of repository current status. ▸ Tag Objects categorise a commit object by naming it. ▸ A good reference ▸ https://git-scm.com/book/en/ v2/Git-Internals-Git-Objects
  • 11. CREATE YOUR GIT REPOSITORY ▸ Configure your git ▸ git config --global user.name "Your Name" ▸ git config --global user.email you@example.com ▸ Go in to your project and initialise a git repository. ▸ git init ▸ Add all the project directories and files to repository. ▸ git add . ▸ Now Commit all the added directories and files to git. ▸ git commit -m “<commit-message>”
  • 12. WHERE IS THE GIT REPOSITORY ? ▸ Its there along with the project files, look for a hidden file “.git” , a single folder , in the project root. ▸ The git repository contains ▸ Head file ▸ Objects ▸ branches ▸ logs and many more
  • 13. WHAT HAPPENS WHEN YOU ADD TO GIT ? ▸ Git Three Tree
  • 14. USEFUL GIT COMMANDS AT THIS STAGE ▸ git log - shows a log of all commits starting from HEAD back to the initial commit. ▸ git status - shows which files have changed between the current project state and HEAD. ▸ git diff - shows the diff between HEAD and the current project state. ▸ git mv and git rm - mark files to be moved (rename) and removed, respectively, much like git add.
  • 15. HOW DOES GIT COMMIT WORKS ? ▸ git commit is the current status of repository. ▸ Represented by the Commit Object, the commit object contains follows. ▸ The set of files currently available (changed/unchanged). ▸ Reference to parent commit (the SHA1 key of parent commit). ▸ The SHA1 name. ▸ git add will add files to the commit object, current versions of changed files, previous version of unchanged / un- added files.
  • 16. HOW DOES GIT COMMIT WORKS ? (CONTD.) ▸ git commit will submit the commit object, a commit is a snapshot of the repository. ▸ Now the “new commit object” is the current status of the git repository.
  • 17. GIT BRANCHING ▸ Manage drastic changes, new features. ▸ Manage a different copy of the “master” within same repository. which means another commit object. ▸ create a branch. ▸ git branch <name> ▸ Point HEAD to the new branch. ▸ git checkout <branch_name> ▸ Better to manage “trunk” & “branch” practice.
  • 18. GIT MERGING ▸ If we are merging the branch to master, set HEAD to master. And then merge ▸ git checkout master ▸ git merge <branch_name> ▸ Then do a new git commit.
  • 19. CONFLICT RESOLUTION ▸ At the point of merging , if master repository has changed from the ancestor commit, then conflicts can happen at the point of merging. ▸ Git will add conflict messages at exact points. ▸ Manually edit those locations and commit.
  • 20. COLLABORATIVE DEVELOPMENT ▸ Get someones git repository , ▸ git clone <repo_url> ▸ Create a remote repo reference named as “origin”. ▸ Then new heads will get created pointing to the header of remote repo, known as “remote heads” ▸ origin/master - for the master head ▸ origin/<branch> - for the branches
  • 21. COLLABORATIVE DEVELOPMENT (CONTD.) ▸ create your own branch to work on the remote repository branch. ▸ git branch --track [new-local-branch] [remote- branch] ▸ get updates from remote branch. ▸ git fetch origin ▸ Now update your local “master” and branches with the updates. ▸ git pull origin <master/branch_name>
  • 22. COLLABORATIVE DEVELOPMENT (CONTD.) ▸ To push your changes to remote repository “master” or branches. ▸ git push origin <master/branch_name>