SlideShare a Scribd company logo
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

PPTX
Git Introductive
PPTX
Git vs svn
PPTX
Svn vs mercurial vs github
PPT
Introducción a Git
PDF
Git (Sistema Distribuido de Control de Versiones)
PDF
Git vs. Mercurial
PDF
Version Control Systems with git (and github) as an example
PDF
Effective Git
Git Introductive
Git vs svn
Svn vs mercurial vs github
Introducción a Git
Git (Sistema Distribuido de Control de Versiones)
Git vs. Mercurial
Version Control Systems with git (and github) as an example
Effective Git

What's hot (20)

PDF
Git vs Subversion: ¿Cuando elegir uno u otro?
PDF
Scale out, with Kubernetes (k8s)
PPTX
From svn to git
PDF
Unleashing k8 s to reduce complexities of an entire middleware platform
PDF
Introduction to Kubernetes
PDF
Git in 5 Minutes
ODP
Git Workshop : Getting Started
PDF
Kubernetes-Meetup
ODP
Git vs svn
PPTX
Git presentation, Viktor Pyskunov
PDF
Kubernetes Basics
PDF
Kubernetes Webinar - Using ConfigMaps & Secrets
PDF
CraftCamp for Students - Introduction to git
PPTX
Introduction to Kubernetes
PDF
OpenStack@Mini-Deb Conf'16 Mumbai
PDF
Heketi Functionality into Glusterd2
PDF
Kubernetes Basics & Monitoring
PPTX
Using NuGet libraries in your application
PDF
SVN 2 Git
Git vs Subversion: ¿Cuando elegir uno u otro?
Scale out, with Kubernetes (k8s)
From svn to git
Unleashing k8 s to reduce complexities of an entire middleware platform
Introduction to Kubernetes
Git in 5 Minutes
Git Workshop : Getting Started
Kubernetes-Meetup
Git vs svn
Git presentation, Viktor Pyskunov
Kubernetes Basics
Kubernetes Webinar - Using ConfigMaps & Secrets
CraftCamp for Students - Introduction to git
Introduction to Kubernetes
OpenStack@Mini-Deb Conf'16 Mumbai
Heketi Functionality into Glusterd2
Kubernetes Basics & Monitoring
Using NuGet libraries in your application
SVN 2 Git
Ad

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

PDF
Git slides
PPTX
GIT.pptx
PPT
Introduction to git
PPTX
Git and Github
PPTX
Git and github
PPTX
Version controll.pptx
KEY
Let's Git this Party Started: An Introduction to Git and GitHub
PPT
Introduction to Git
PPTX
Git hub_pptx
PPTX
PPTX
Git 101
PPTX
Introduction to git, a version control system
PDF
Git: a brief introduction
PPTX
git.ppt.pptx power point presentation got Google internet
PPTX
Git 101 for Beginners
PPTX
Git workshop 33degree 2011 krakow
PDF
Git for developers
PPTX
Git_new.pptx
PPTX
github ppt git ppt on git hub to know ab
Git slides
GIT.pptx
Introduction to git
Git and Github
Git and github
Version controll.pptx
Let's Git this Party Started: An Introduction to Git and GitHub
Introduction to Git
Git hub_pptx
Git 101
Introduction to git, a version control system
Git: a brief introduction
git.ppt.pptx power point presentation got Google internet
Git 101 for Beginners
Git workshop 33degree 2011 krakow
Git for developers
Git_new.pptx
github ppt git ppt on git hub to know ab
Ad

Recently uploaded (20)

PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
Tech Workshop Escape Room Tech Workshop
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PDF
Website Design Services for Small Businesses.pdf
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
Digital Systems & Binary Numbers (comprehensive )
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
iTop VPN Crack Latest Version Full Key 2025
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Cost to Outsource Software Development in 2025
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PPTX
Custom Software Development Services.pptx.pptx
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
"Secure File Sharing Solutions on AWS".pptx
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Salesforce Agentforce AI Implementation.pdf
Oracle Fusion HCM Cloud Demo for Beginners
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Tech Workshop Escape Room Tech Workshop
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Topaz Photo AI Crack New Download (Latest 2025)
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
Website Design Services for Small Businesses.pdf
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Digital Systems & Binary Numbers (comprehensive )
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
iTop VPN Crack Latest Version Full Key 2025
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Cost to Outsource Software Development in 2025
How to Use SharePoint as an ISO-Compliant Document Management System
Custom Software Development Services.pptx.pptx
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
"Secure File Sharing Solutions on AWS".pptx
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Salesforce Agentforce AI Implementation.pdf

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>