SlideShare a Scribd company logo
Introducing to
Sajjad Rad
Technical supervisor at New Idea Studio
sajjad.273@gmail.com
atbox.io/sajjadrad
Sep 2015
S01E01
Why version controller?
Wake up Neo
S01E01
• Working together
• Archive versions
• Make backup
• Restore to a previous version
• …
We have some problems while
developing projects!
S01E01
• Do nothing
• Make an archive file in each version
• You say
• Use a Version Controller System
What we can do ?
S01E01
A system that records changes to a file
or set of files over time so that you can
recall specific versions later
What is Version Controller ?
S01E01
• Collaboration
• Storing Versions (Properly)
• Restoring Previous Versions
• Understanding What Happened
• Backup
Why Use a Version Control System?
S01E02
Types of Version Control Systems
Red or Blue?
S01E02
Centralized Version Control
Example : Subversion
S01E02
• It is easy to understand.
• You have more control over users and access
(since it is served from one place).
• More GUI & IDE clients (Subversion has been
around longer).
• Simple to get started.
Centralized V.C. benefits
S01E02
• Dependent on access to the server.
• Hard to manage a server and backups (well, not
with Beanstalk of course!)
• It can be slower because every command
connects to the server.
• Branching and merging tools are difficult to use.
Centralized V.C. drawbacks
S01E02
Distributed Version Control
Example : Git
S01E02
• More powerful and detailed change tracking,
which means less conflicts.
• No server necessary – all actions except
sharing repositories are local (commit offline).
• Branching and merging is more reliable, and
therefore used more often.
• It’s fast.
Distributed V.C. benefits
S01E02
• The distributed model is harder to understand.
• It’s new, so not as many GUI clients.
• The revisions are not incremental numbers,
which make them harder to reference.
• It can be easier to make mistakes until you are
familiar with the model.
Distributed V.C. drawbacks
S02E01
Know Git more
This is the world that you know.
S02E01
Short Story
Linux kernel is an open source software project:
• 1991–2002, changes to the software were
passed around as patches and archived files.
• 2002, the Linux kernel project began using a
proprietary DVCS called BitKeeper.
• In 2005, the relationship between the
community that developed the Linux kernel
and the commercial company that
developed BitKeeper broke down
S02E01
Short Story
• Linus Torvalds prompted to develop their
own tool based on some of the lessons they
learned while using BitKeeper.the goals of
the new system was :
• Speed
• Simple design
• Strong support for non-linear development (thousands of
parallel branches)
• Fully distributed
• Able to handle large projects like the Linux kernel efficiently
(speed and data
S02E01
Short Story
• 2005,Git borned!
S02E01
Snapshots, Not Differences
• Most other systems store information as a
list of file-based changes.
• Git basically takes a picture of what all your
files look like at that moment and stores a
reference to that snapshot.
S02E01
Snapshots, Not Differences
S02E01
Snapshots, Not Differences
S02E02
More and more
Free your mind
S02E02
The Three States
Git has three main states that your files can
reside in:
• Committed
• Modified
• Staged
S02E02
Commited
Committed means that the data is safely stored
in your local database.
S02E02
Modified
Modified means that you have changed the file
but have not committed it to your database yet.
S02E02
Staged
Staged means that you have marked a modified
file in its current version to go into your next
commit snapshot.
In simple terms this means that git knows about the change, but it is
not permanent in the repository.
S02E02
Three main sections of a Git project
• The Git directory
• The working directory
• The staging area
S02E02
The Git directory
The Git directory is where Git stores the
metadata and object database for your project.
S02E02
The Working directory
The working directory is a single checkout of one
version of the project.
S02E02
The Staging area
Generally contained in your Git directory, that
stores information about what will go into your
next commit.
A magical place where selected files will be turned into stone with your wizardry and
can be magically transported to the repository at your whim.
S02E02
• You modify files in your working directory.
• You stage the files, adding snapshots of them to
your staging area.
• You do a commit (in Git directory)
Git workflow in simple terms
S03E01
Working with Git
There is a difference between knowing the
path & walking the path.
S03E01
Installing
You can download Git release from
http://git-scm.com/download
Git is opensource.You can find repository on Github in http://github/git/git
S03E01
Command Line or GUI?
There are a lot of different ways to use git:
Original command line tools
Graphical user interfaces
S03E01
Command Line
S03E01
GUI : SourceTree
You can download this application from
https://www.sourcetreeapp.com
S03E01
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
First-Time Git Setup
First set your user name and email address:
S03E01
Getting a Git Repository
You can done this in two method:
• Initializing a Repository in an Existing Directory
$ git init
• Cloning an Existing Repository
$ git clone https://github.com/libgit2/libgit2
S03E01
Recording Changes to the Repository
Each file in your working directory can be in one
of two states:
• Tracked
• Tracked files are files that were in the last snapshot; they can be
unmodified, modified, or staged.
• Untracked
• Untracked files are everything else – any files in your working
directory that were not in your last snapshot and are not in your
staging area
S03E01
Recording Changes to the Repository
S03E01
Staging Modified Files
You can stage a file with this command:
$ git add
git add is a multipurpose command – you use it to begin tracking new files, to
stage files, and to do other things like marking merge-conflicted files as resolved.
S03E01
Committing Your Changes
After staging your files,Now time to commit
$ git commit
Basically git commit "records changes to the repository"
S03E01
Remote name
Remote name is basically a bookmark that help
you to manage your remote repositories.
With remote name you can add remote repository url to
local repository and assign a name to it.
Example*:
git git@github.com:git/git.git
http https://github.com/git/git.git
*Git is remote name and git@github.com:git/git.git is remote repository address.
Default remote name is origin
S03E01
Git branch
A branch represents an independent line of
development.
$ git checkout <existing-branch>
$ git checkout -b <new-branch>
S03E01
Fetching and Pulling from Your Remotes
To get data from your remote projects:
Git fetch
Pulls the data to your local repository – it doesn’t automatically merge it with any of your work
or modify what you’re currently working on.
$ git fetch [remote-name]
Git pull
Automatically fetch and then merge a remote branch into your current branch
$ git pull [remote-name]
S03E01
Pushing to Your Remotes
For share your project,you have to push it:
$ git push [remote-name] [branch-name]
Pushing is how you transfer commits from your local repository to a remote repo.
S04E01
Some more references
Why do you persist?
S04E01
Some references
• Git official document
https://git-scm.com/doc
• Git simple guide
http://rogerdudler.github.io/git-guide/
• Some useful tutorials
https://www.atlassian.com/git/tutorials/
• Pro Git book
http://book.git-scm.com/
Know better and more
The End
“Any fool can know. The point is to understand.”
― Albert Einstein
Thank you

More Related Content

Viewers also liked (9)

Welcome anjali
Welcome anjaliWelcome anjali
Welcome anjali
 
Jiji thomas (lesson plan)
Jiji thomas (lesson plan)Jiji thomas (lesson plan)
Jiji thomas (lesson plan)
 
AT Cloud Practical Installation Examples r01
AT Cloud Practical Installation Examples r01AT Cloud Practical Installation Examples r01
AT Cloud Practical Installation Examples r01
 
System usability by jaspin
System usability by jaspinSystem usability by jaspin
System usability by jaspin
 
System usability by jaspin
System usability by jaspinSystem usability by jaspin
System usability by jaspin
 
nodejs vs vertx
nodejs vs vertxnodejs vs vertx
nodejs vs vertx
 
Chap 5 pompes
Chap 5 pompesChap 5 pompes
Chap 5 pompes
 
8cara jadikan anak genius
8cara jadikan anak genius8cara jadikan anak genius
8cara jadikan anak genius
 
Comparatif analytics
Comparatif analyticsComparatif analytics
Comparatif analytics
 

Similar to Introducing to git

Similar to Introducing to git (20)

Git
GitGit
Git
 
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
 
Git 101
Git 101Git 101
Git 101
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
August OpenNTF Webinar - Git and GitHub Explained
August OpenNTF Webinar - Git and GitHub ExplainedAugust OpenNTF Webinar - Git and GitHub Explained
August OpenNTF Webinar - Git and GitHub Explained
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with Git[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with Git
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Git for developers
Git for developersGit for developers
Git for developers
 
Webinar : SVN to GIT Migration
Webinar : SVN to GIT Migration Webinar : SVN to GIT Migration
Webinar : SVN to GIT Migration
 
CSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GITCSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GIT
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
GIT INTRODUCTION
GIT INTRODUCTIONGIT INTRODUCTION
GIT INTRODUCTION
 
git.ppt.pdf
git.ppt.pdfgit.ppt.pdf
git.ppt.pdf
 
Git
GitGit
Git
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Version controll.pptx
Version controll.pptxVersion controll.pptx
Version controll.pptx
 

Recently uploaded

Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 

Recently uploaded (20)

Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by Skilrock
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 

Introducing to git

  • 1. Introducing to Sajjad Rad Technical supervisor at New Idea Studio sajjad.273@gmail.com atbox.io/sajjadrad Sep 2015
  • 3. S01E01 • Working together • Archive versions • Make backup • Restore to a previous version • … We have some problems while developing projects!
  • 4. S01E01 • Do nothing • Make an archive file in each version • You say • Use a Version Controller System What we can do ?
  • 5. S01E01 A system that records changes to a file or set of files over time so that you can recall specific versions later What is Version Controller ?
  • 6. S01E01 • Collaboration • Storing Versions (Properly) • Restoring Previous Versions • Understanding What Happened • Backup Why Use a Version Control System?
  • 7. S01E02 Types of Version Control Systems Red or Blue?
  • 9. S01E02 • It is easy to understand. • You have more control over users and access (since it is served from one place). • More GUI & IDE clients (Subversion has been around longer). • Simple to get started. Centralized V.C. benefits
  • 10. S01E02 • Dependent on access to the server. • Hard to manage a server and backups (well, not with Beanstalk of course!) • It can be slower because every command connects to the server. • Branching and merging tools are difficult to use. Centralized V.C. drawbacks
  • 12. S01E02 • More powerful and detailed change tracking, which means less conflicts. • No server necessary – all actions except sharing repositories are local (commit offline). • Branching and merging is more reliable, and therefore used more often. • It’s fast. Distributed V.C. benefits
  • 13. S01E02 • The distributed model is harder to understand. • It’s new, so not as many GUI clients. • The revisions are not incremental numbers, which make them harder to reference. • It can be easier to make mistakes until you are familiar with the model. Distributed V.C. drawbacks
  • 14. S02E01 Know Git more This is the world that you know.
  • 15. S02E01 Short Story Linux kernel is an open source software project: • 1991–2002, changes to the software were passed around as patches and archived files. • 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper. • In 2005, the relationship between the community that developed the Linux kernel and the commercial company that developed BitKeeper broke down
  • 16. S02E01 Short Story • Linus Torvalds prompted to develop their own tool based on some of the lessons they learned while using BitKeeper.the goals of the new system was : • Speed • Simple design • Strong support for non-linear development (thousands of parallel branches) • Fully distributed • Able to handle large projects like the Linux kernel efficiently (speed and data
  • 18. S02E01 Snapshots, Not Differences • Most other systems store information as a list of file-based changes. • Git basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot.
  • 22. S02E02 The Three States Git has three main states that your files can reside in: • Committed • Modified • Staged
  • 23. S02E02 Commited Committed means that the data is safely stored in your local database.
  • 24. S02E02 Modified Modified means that you have changed the file but have not committed it to your database yet.
  • 25. S02E02 Staged Staged means that you have marked a modified file in its current version to go into your next commit snapshot. In simple terms this means that git knows about the change, but it is not permanent in the repository.
  • 26. S02E02 Three main sections of a Git project • The Git directory • The working directory • The staging area
  • 27. S02E02 The Git directory The Git directory is where Git stores the metadata and object database for your project.
  • 28. S02E02 The Working directory The working directory is a single checkout of one version of the project.
  • 29. S02E02 The Staging area Generally contained in your Git directory, that stores information about what will go into your next commit. A magical place where selected files will be turned into stone with your wizardry and can be magically transported to the repository at your whim.
  • 30. S02E02 • You modify files in your working directory. • You stage the files, adding snapshots of them to your staging area. • You do a commit (in Git directory) Git workflow in simple terms
  • 31. S03E01 Working with Git There is a difference between knowing the path & walking the path.
  • 32. S03E01 Installing You can download Git release from http://git-scm.com/download Git is opensource.You can find repository on Github in http://github/git/git
  • 33. S03E01 Command Line or GUI? There are a lot of different ways to use git: Original command line tools Graphical user interfaces
  • 35. S03E01 GUI : SourceTree You can download this application from https://www.sourcetreeapp.com
  • 36. S03E01 $ git config --global user.name "John Doe" $ git config --global user.email johndoe@example.com First-Time Git Setup First set your user name and email address:
  • 37. S03E01 Getting a Git Repository You can done this in two method: • Initializing a Repository in an Existing Directory $ git init • Cloning an Existing Repository $ git clone https://github.com/libgit2/libgit2
  • 38. S03E01 Recording Changes to the Repository Each file in your working directory can be in one of two states: • Tracked • Tracked files are files that were in the last snapshot; they can be unmodified, modified, or staged. • Untracked • Untracked files are everything else – any files in your working directory that were not in your last snapshot and are not in your staging area
  • 39. S03E01 Recording Changes to the Repository
  • 40. S03E01 Staging Modified Files You can stage a file with this command: $ git add git add is a multipurpose command – you use it to begin tracking new files, to stage files, and to do other things like marking merge-conflicted files as resolved.
  • 41. S03E01 Committing Your Changes After staging your files,Now time to commit $ git commit Basically git commit "records changes to the repository"
  • 42. S03E01 Remote name Remote name is basically a bookmark that help you to manage your remote repositories. With remote name you can add remote repository url to local repository and assign a name to it. Example*: git git@github.com:git/git.git http https://github.com/git/git.git *Git is remote name and git@github.com:git/git.git is remote repository address. Default remote name is origin
  • 43. S03E01 Git branch A branch represents an independent line of development. $ git checkout <existing-branch> $ git checkout -b <new-branch>
  • 44. S03E01 Fetching and Pulling from Your Remotes To get data from your remote projects: Git fetch Pulls the data to your local repository – it doesn’t automatically merge it with any of your work or modify what you’re currently working on. $ git fetch [remote-name] Git pull Automatically fetch and then merge a remote branch into your current branch $ git pull [remote-name]
  • 45. S03E01 Pushing to Your Remotes For share your project,you have to push it: $ git push [remote-name] [branch-name] Pushing is how you transfer commits from your local repository to a remote repo.
  • 47. S04E01 Some references • Git official document https://git-scm.com/doc • Git simple guide http://rogerdudler.github.io/git-guide/ • Some useful tutorials https://www.atlassian.com/git/tutorials/ • Pro Git book http://book.git-scm.com/ Know better and more
  • 48. The End “Any fool can know. The point is to understand.” ― Albert Einstein Thank you