SlideShare a Scribd company logo
1 of 82
An Introduction to GIT
Version Control with Git
Avoid to be the repository manager
Dr. Fabio Fumarola
Agenda
• What is Version Control? (and why use it?)
• What is Git? (And why Git?)
• How git works
• Create a repository
• Branches
• Add remote
• How data is stored
2
History
• Created by Linus Torvalds for work on the Linux
kernel ~2005
• Some of the companies that use git:
3
What is Git?
Git is a
DistributedVersion Control System
OR
Git is a
Content Management System
Git is a
history storage system
Git is a
content tracker
How ever you think about it…
How ever you think about it…
What is a Version Control
• Version Control - A system for managing changes made to
documents and other computer files
• What kinds of files can we use it with?
– Source code
– Documentation
– Short stories
– Binary files (music and pictures)
• What should we use it for?
– Text files
– Projects that have lots of revisions (changes)
– Collaborating
12
VCS Systems and their Operations
• Lots of different choices available:
– CVS
– SVN
– Perforce
– Git
– Mercurial (Hg), Bazaar
– And more!
• Most follow a repository model (though differ in how
the repositories work)
13
So why do we need a VCS?
• Our goals
– Share code (or something else) easily
– Keep track of any changes we make (and undo them with
ease)
– Maintain multiple versions of the same project/code base
– Clearly communicate what changes have been made
• There are two type of VCS
– Centralized and
– Distributed
14
Distributed vs Centralized
Centralized VCS
•One central repository
•Must be capable of
connecting to repo
•Need to solve issues with
group members making
different changes on the same
files
Distributed VCS
•Everyone has a working repo
•Faster
•Connectionless
•Still need to resolve issues,
but it's not an argument
against DVCS
15
Centralized vs Distributed
16
Central Server
Remote Server
Git file lifecycle
17
Creating our first repository
• Install git
• Establish our first repository:
– mkdir git-test
– cd git-test
– git init
• What do we have here?
– git status
18
Using our first repository
• Add a file
– touch file.txt
– git add file.txt
– git commit –m “add the first file”
19
Branching
• With Git we should embrace
the idea of branching
• Branching is the best method
to work with other in a
project
20
Branches Illustrated
master
A
> git commit –m ‘my first commit’> git commit –m ‘my first commit’
Branches Illustrated
master
> git commit (x2)> git commit (x2)
A B C
Branches Illustrated
bug123
master
> git checkout –b bug123> git checkout –b bug123
A B C
Branches Illustrated
master
> git commit (x2)> git commit (x2)
A B C
D E
bug123
Branches Illustrated
master
> git checkout master> git checkout master
A B C
D E
bug123
Branches Illustrated
bug123
master
> git merge bug123> git merge bug123
A B C D E
Branches Illustrated
master
> git branch -d bug123> git branch -d bug123
A B C D E
Branches Illustrated
master
A B C D E
F G
bug456
Branches Illustrated
master
A B C D E
F G
bug456
> git checkout master> git checkout master
Branches Illustrated
master
A B C D E
F G
> git merge bug456> git merge bug456
H
bug456
Branches Illustrated
master
A B C D E
F G
> git branch -d bug456> git branch -d bug456
H
Branches Illustrated
master
A B C D E
F G
bug456
Branches Illustrated
master
A B C D E
> git rebase master> git rebase master
F’ G’
bug456
Branches Illustrated
master
A B C D E
> git checkout master
> git merge bug456
> git checkout master
> git merge bug456
F’ G’
bug456
Branches Review
• Branches should be used to create “Features” in our
project
• Local branches are very powerful
• Rebase is not scary
35
Adding a remote
But, how we share our code with the other collaborators?
36
My Local
Repo
Tom’s Repo
Tracey’s
Repo
Matt’s
Repo
A B C
A B C A B C
A B C
Sharing commits
37
My Local
Repo
Tom’s Repo
Tracey’s
Repo
Matt’s
Repo
A B C
A B C A B C
A B C
Remote Repo
AA BB CC
D
D
D
D
DD
Setting up a Remote
• We can clone an existing repository
– git clone git@github.com:fabiofumarola/akka-tutorial.git
• We can push our changes
– git push
• We can pull friends change
– git pull
• We can also add a remote to an existing repository
– git remote add origin git@github.com:fabiofumarola/akka-
tutorial.git
38
Branches with remote
A
master
B C D E
bug123
Branches with remote
A
master
origin/master
B C D E
bug123
Branches with remote
A
BB CC DD EE
master
bug123
origin/master
Branches with remote
A
BB CC DD EE
master
bug123
FF GG
origin/master
origin/masterorigin/master
Branches with remote
A
BB CC DD EE
master
bug123
> git checkout master> git checkout master
origin/master
Branches with remote
A
BB CC DD EE
master
bug123
F G
> git pull origin> git pull origin
origin/master
Pull = Fecth + Merge
Fetch - updates your local copy of the remote
branch
Pull essentially does a fetch and then runs
the merge in one step.
Branches Illustrated
A
BB CC DD EE
master
bug123
F G
origin/master
Branches Illustrated
A
BB CC DD EE
master
bug123
F G
> git checkout bug123> git checkout bug123
origin/master
Branches Illustrated
A
B’B’ C’C’ D’D’ E’E’
master
bug123
F G
> git rebase master> git rebase master
origin/master
Branches Illustrated
A
B’B’ C’C’ D’D’ E’E’
master
bug123
F G
> git checkout master> git checkout master
origin/master
Branches Illustrated
A
master
bug123
F G
> git merge bug123> git merge bug123
B’B’ C’C’ D’D’ E’E’
origin/master
Branches Illustrated
A
master
F G
> git push origin> git push origin
B’ C’ D’ E’
bug123
origin/master
Push
Pushes your changes upstream
Git will reject pushes if newer changes exist
on remote.
Good practice: Pull then Push
Branches Illustrated
A
master
F G B’ C’ D’ E’
bug123
origin/master
Branches Illustrated
A
master
F G
> git branch -d bug123> git branch -d bug123
B’ C’ D’ E’
origin/master
Short vs. Long-Lived Branches
• We can use branch to:
– Solve bugs (hotfixes)
– Create features
– Make a release
• In order to simplify the management we can use:
– Git Flow: http://danielkummer.github.io/git-flow-
cheatsheet/index.it_IT.html
Branches Illustrated
E
master
origin/master
Branches Illustrated
E
master
origin/master
develop
> git branch develop> git branch develop
Branches Illustrated
E
master
origin/master
develop
> git push origin develop> git push origin develop
origin/develop
Branches Illustrated
E
master
origin/master
develop
> git checkout develop> git checkout develop
origin/develop
Branches Illustrated
E
master
origin/master
FF GG
develop
origin/develop
Branches Illustrated
E
master
origin/master
F G
develop
origin/develop
> git pull origin develop> git pull origin develop
Branches Illustrated
E
master
origin/master
F G
develop
origin/develop
> git checkout –b idea> git checkout –b idea
idea
Branches Illustrated
E
master
origin/master
F G
develop
origin/develop
> git commit> git commit
idea
H
Branches Illustrated
E
origin/master
F G
origin/develop idea
H
II
master
develop
Branches Illustrated
E
origin/master
F G
origin/develop idea
H
master
develop
> git pull (at least daily)> git pull (at least daily)
I
Branches Illustrated
E
origin/master
F G
origin/develop idea
H
master
> git checkout develop> git checkout develop
I
develop
Branches Illustrated
E
origin/master
F G
origin/develop idea
H
master
> git merge idea (fast forward merge)> git merge idea (fast forward merge)
I
develop
Branches Illustrated
E
origin/master
F G
origin/develop
H
master
> git branch –d idea> git branch –d idea
I
develop
Branches Illustrated
E
origin/master
F G
origin/develop
H
master
> git push origin develop> git push origin develop
I
develop
Merge Flow vs. Rebase Flow
E
origin/master
F G
origin/develop
H
master
> git push origin develop> git push origin develop
I
develop
Branches Illustrated – Merge Flow
E
origin/master
F G
origin/develop
H
master
> git checkout master> git checkout master
I
develop
Branches Illustrated – Merge Flow
E
origin/master
F G
origin/develop
H
master
> git merge develop> git merge develop
I
develop
J
Branches Illustrated – Merge Flow
E
origin/master
F G
origin/develop
H
master
> git push origin> git push origin
I
develop
J
Branches Illustrated – Rebase Flow
E
origin/master
F G
origin/develop
H
master
> git checkout master> git checkout master
I
develop
Branches Illustrated – Rebase Flow
E
origin/master
F G
origin/develop
H
master
> git rebase develop> git rebase develop
I’
develop
II
Branches Illustrated – Rebase Flow
E
origin/master
F G
origin/develop
H
master
> git push origin> git push origin
I’
develop
Rebase Flow
E
origin/master
F G
origin/develop
H
master
I’
develop
E
origin/master
F G
origin/develop
H
master
I
develop
J
Merge Flow
How Git stores data
• Git stores the content of each file in the tracking history
• Each time we do a commit it is made a copy of the file.
• However the content of each file is subject to revision for
conflicts (merge).
78
Git best practices for code collaboration
• When to commit?
– Source of major arguments (big changes vs small change)
– Never put broken code on the master branch (test first!)
– Try not to break things (don't do two weeks worth of work in one
commit)
– Always use a clear, concise commit message
– Put more details in lines below, but always make the first line short
– Describe the why; the what is clear in the change log
• When making giant changes, consider branches (we'll talk
about these in a few slides)
• Oh, and make sure your name and email are right
79
Supplemental
SSH
• Used to be most common transport for git
• Pros
– Allows reads and writes
– Authenticated network protocol
– Secure: data transfer is encrypted and authenticated
– Efficient: makes data as compact as possible
• Cons
– No anonymous read-only access
Sidebar: What is SSH?
• SSH is a protocol used for secure network
communication Getting files from github
• Generate public/private keys (ssh-keygen)
• Distribute public keys (add key to github)
• Someone (github) sends secure “message” (files) –
they encode with public key
• You receive the message/files – decode with
private key (only you know)
Putting files on github
• Process is reversed to send files to github
• You have the github public key (see
github_rsa.pub, in Documents and
Settings/Cyndi/.ssh on my machine)
• Use it to encode when sending
• github uses their private key to decode

More Related Content

What's hot

Pluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and DockerPluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and DockerBob Killen
 
Kubernetes presentation
Kubernetes presentationKubernetes presentation
Kubernetes presentationGauranG Bajpai
 
Shifter: Containers in HPC Environments
Shifter: Containers in HPC EnvironmentsShifter: Containers in HPC Environments
Shifter: Containers in HPC Environmentsinside-BigData.com
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetesDongwon Kim
 
Kubernetes deep dive - - Huawei 2015-10
Kubernetes deep dive - - Huawei 2015-10Kubernetes deep dive - - Huawei 2015-10
Kubernetes deep dive - - Huawei 2015-10Vishnu Kannan
 
Integrate Openshift with Cloudforms
Integrate Openshift with CloudformsIntegrate Openshift with Cloudforms
Integrate Openshift with CloudformsMichael Lessard
 
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and moreAll Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and moreAll Things Open
 
99cloud Docker Training module 2
99cloud Docker Training module 299cloud Docker Training module 2
99cloud Docker Training module 2Liang Bo
 
virtualization-vs-containerization-paas
virtualization-vs-containerization-paasvirtualization-vs-containerization-paas
virtualization-vs-containerization-paasrajdeep
 
HP Advanced Technology Group: Docker and Ansible
HP Advanced Technology Group: Docker and AnsibleHP Advanced Technology Group: Docker and Ansible
HP Advanced Technology Group: Docker and AnsiblePatrick Galbraith
 
Red Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift MessengerRed Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift MessengerJustin Bui
 
Docker Architecture (v1.3)
Docker Architecture (v1.3)Docker Architecture (v1.3)
Docker Architecture (v1.3)rajdeep
 
Docker module 1
Docker module 1Docker module 1
Docker module 1Liang Bo
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerGuido Schmutz
 
Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Chris Tankersley
 
Docker HK Meetup - 201707
Docker HK Meetup - 201707Docker HK Meetup - 201707
Docker HK Meetup - 201707Clarence Ho
 

What's hot (20)

Kubernetes Node Deep Dive
Kubernetes Node Deep DiveKubernetes Node Deep Dive
Kubernetes Node Deep Dive
 
Pluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and DockerPluggable Infrastructure with CI/CD and Docker
Pluggable Infrastructure with CI/CD and Docker
 
Kubernetes presentation
Kubernetes presentationKubernetes presentation
Kubernetes presentation
 
Shifter: Containers in HPC Environments
Shifter: Containers in HPC EnvironmentsShifter: Containers in HPC Environments
Shifter: Containers in HPC Environments
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetes
 
Kubernetes deep dive - - Huawei 2015-10
Kubernetes deep dive - - Huawei 2015-10Kubernetes deep dive - - Huawei 2015-10
Kubernetes deep dive - - Huawei 2015-10
 
Integrate Openshift with Cloudforms
Integrate Openshift with CloudformsIntegrate Openshift with Cloudforms
Integrate Openshift with Cloudforms
 
Ansible docker
Ansible dockerAnsible docker
Ansible docker
 
Docker Intro
Docker IntroDocker Intro
Docker Intro
 
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and moreAll Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
 
99cloud Docker Training module 2
99cloud Docker Training module 299cloud Docker Training module 2
99cloud Docker Training module 2
 
virtualization-vs-containerization-paas
virtualization-vs-containerization-paasvirtualization-vs-containerization-paas
virtualization-vs-containerization-paas
 
HP Advanced Technology Group: Docker and Ansible
HP Advanced Technology Group: Docker and AnsibleHP Advanced Technology Group: Docker and Ansible
HP Advanced Technology Group: Docker and Ansible
 
Red Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift MessengerRed Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift Messenger
 
Docker Architecture (v1.3)
Docker Architecture (v1.3)Docker Architecture (v1.3)
Docker Architecture (v1.3)
 
Container orchestration
Container orchestrationContainer orchestration
Container orchestration
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017
 
Docker HK Meetup - 201707
Docker HK Meetup - 201707Docker HK Meetup - 201707
Docker HK Meetup - 201707
 

Viewers also liked

10b. Graph Databases Lab
10b. Graph Databases Lab10b. Graph Databases Lab
10b. Graph Databases LabFabio Fumarola
 
8. column oriented databases
8. column oriented databases8. column oriented databases
8. column oriented databasesFabio Fumarola
 
8b. Column Oriented Databases Lab
8b. Column Oriented Databases Lab8b. Column Oriented Databases Lab
8b. Column Oriented Databases LabFabio Fumarola
 
9b. Document-Oriented Databases lab
9b. Document-Oriented Databases lab9b. Document-Oriented Databases lab
9b. Document-Oriented Databases labFabio Fumarola
 
A painless git workflow
A painless git workflowA painless git workflow
A painless git workflowrogthefrog
 
8a. How To Setup HBase with Docker
8a. How To Setup HBase with Docker8a. How To Setup HBase with Docker
8a. How To Setup HBase with DockerFabio Fumarola
 
8. key value databases laboratory
8. key value databases laboratory 8. key value databases laboratory
8. key value databases laboratory Fabio Fumarola
 
11. From Hadoop to Spark 1:2
11. From Hadoop to Spark 1:211. From Hadoop to Spark 1:2
11. From Hadoop to Spark 1:2Fabio Fumarola
 
11. From Hadoop to Spark 2/2
11. From Hadoop to Spark 2/211. From Hadoop to Spark 2/2
11. From Hadoop to Spark 2/2Fabio Fumarola
 
Pathology of git€2
Pathology of git€2Pathology of git€2
Pathology of git€2Gopi sankar
 
Introduction to Git for Force.com Developers
Introduction to Git for Force.com DevelopersIntroduction to Git for Force.com Developers
Introduction to Git for Force.com DevelopersSalesforce Developers
 
7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth7. Key-Value Databases: In Depth
7. Key-Value Databases: In DepthFabio Fumarola
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQLTony Tam
 
clinical pharmacology,clinical,injections,pharmacological,what is pharmacolog...
clinical pharmacology,clinical,injections,pharmacological,what is pharmacolog...clinical pharmacology,clinical,injections,pharmacological,what is pharmacolog...
clinical pharmacology,clinical,injections,pharmacological,what is pharmacolog...Jennings Agingu jenningsadd@gmail.com
 
Gastrointestinal Pathology
Gastrointestinal  PathologyGastrointestinal  Pathology
Gastrointestinal PathologyKETAN VAGHOLKAR
 

Viewers also liked (20)

Hbase an introduction
Hbase an introductionHbase an introduction
Hbase an introduction
 
10b. Graph Databases Lab
10b. Graph Databases Lab10b. Graph Databases Lab
10b. Graph Databases Lab
 
8. column oriented databases
8. column oriented databases8. column oriented databases
8. column oriented databases
 
Hybrid Clouds: EC2/Heroku Calculator
Hybrid Clouds: EC2/Heroku CalculatorHybrid Clouds: EC2/Heroku Calculator
Hybrid Clouds: EC2/Heroku Calculator
 
8b. Column Oriented Databases Lab
8b. Column Oriented Databases Lab8b. Column Oriented Databases Lab
8b. Column Oriented Databases Lab
 
9b. Document-Oriented Databases lab
9b. Document-Oriented Databases lab9b. Document-Oriented Databases lab
9b. Document-Oriented Databases lab
 
A painless git workflow
A painless git workflowA painless git workflow
A painless git workflow
 
8a. How To Setup HBase with Docker
8a. How To Setup HBase with Docker8a. How To Setup HBase with Docker
8a. How To Setup HBase with Docker
 
10. Graph Databases
10. Graph Databases10. Graph Databases
10. Graph Databases
 
8. key value databases laboratory
8. key value databases laboratory 8. key value databases laboratory
8. key value databases laboratory
 
11. From Hadoop to Spark 1:2
11. From Hadoop to Spark 1:211. From Hadoop to Spark 1:2
11. From Hadoop to Spark 1:2
 
11. From Hadoop to Spark 2/2
11. From Hadoop to Spark 2/211. From Hadoop to Spark 2/2
11. From Hadoop to Spark 2/2
 
Git in Eclipse
Git in EclipseGit in Eclipse
Git in Eclipse
 
Pathology of git€2
Pathology of git€2Pathology of git€2
Pathology of git€2
 
Scala and spark
Scala and sparkScala and spark
Scala and spark
 
Introduction to Git for Force.com Developers
Introduction to Git for Force.com DevelopersIntroduction to Git for Force.com Developers
Introduction to Git for Force.com Developers
 
7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQL
 
clinical pharmacology,clinical,injections,pharmacological,what is pharmacolog...
clinical pharmacology,clinical,injections,pharmacological,what is pharmacolog...clinical pharmacology,clinical,injections,pharmacological,what is pharmacolog...
clinical pharmacology,clinical,injections,pharmacological,what is pharmacolog...
 
Gastrointestinal Pathology
Gastrointestinal  PathologyGastrointestinal  Pathology
Gastrointestinal Pathology
 

Similar to 3 Git

Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitRobert Lee-Cann
 
Git from the trenches
Git from the trenchesGit from the trenches
Git from the trenchesNuno Caneco
 
Bedjango talk about Git & GitHub
Bedjango talk about Git & GitHubBedjango talk about Git & GitHub
Bedjango talk about Git & GitHubBeDjango
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubBigBlueHat
 
Introduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control systemIntroduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control systemAlbanLevy
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubKim Moir
 

Similar to 3 Git (20)

Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
 
Git from the trenches
Git from the trenchesGit from the trenches
Git from the trenches
 
Bedjango talk about Git & GitHub
Bedjango talk about Git & GitHubBedjango talk about Git & GitHub
Bedjango talk about Git & GitHub
 
Git hub
Git hubGit hub
Git hub
 
GitHub Event.pptx
GitHub Event.pptxGitHub Event.pptx
GitHub Event.pptx
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
 
Git basics
Git basicsGit basics
Git basics
 
Git
GitGit
Git
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
Talk to git
Talk to gitTalk to git
Talk to git
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Introduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control systemIntroduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control system
 
Git Basics
Git BasicsGit Basics
Git Basics
 
git.ppt.pdf
git.ppt.pdfgit.ppt.pdf
git.ppt.pdf
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
Git workshop
Git workshopGit workshop
Git workshop
 

More from Fabio Fumarola

9. Document Oriented Databases
9. Document Oriented Databases9. Document Oriented Databases
9. Document Oriented DatabasesFabio Fumarola
 
6 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/26 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/2Fabio Fumarola
 
5 Data Modeling for NoSQL 1/2
5 Data Modeling for NoSQL 1/25 Data Modeling for NoSQL 1/2
5 Data Modeling for NoSQL 1/2Fabio Fumarola
 
1. Introduction to the Course "Designing Data Bases with Advanced Data Models...
1. Introduction to the Course "Designing Data Bases with Advanced Data Models...1. Introduction to the Course "Designing Data Bases with Advanced Data Models...
1. Introduction to the Course "Designing Data Bases with Advanced Data Models...Fabio Fumarola
 
Develop with linux containers and docker
Develop with linux containers and dockerDevelop with linux containers and docker
Develop with linux containers and dockerFabio Fumarola
 
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce Fabio Fumarola
 
NoSQL databases pros and cons
NoSQL databases pros and consNoSQL databases pros and cons
NoSQL databases pros and consFabio Fumarola
 

More from Fabio Fumarola (8)

9. Document Oriented Databases
9. Document Oriented Databases9. Document Oriented Databases
9. Document Oriented Databases
 
6 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/26 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/2
 
5 Data Modeling for NoSQL 1/2
5 Data Modeling for NoSQL 1/25 Data Modeling for NoSQL 1/2
5 Data Modeling for NoSQL 1/2
 
1. Introduction to the Course "Designing Data Bases with Advanced Data Models...
1. Introduction to the Course "Designing Data Bases with Advanced Data Models...1. Introduction to the Course "Designing Data Bases with Advanced Data Models...
1. Introduction to the Course "Designing Data Bases with Advanced Data Models...
 
Develop with linux containers and docker
Develop with linux containers and dockerDevelop with linux containers and docker
Develop with linux containers and docker
 
08 datasets
08 datasets08 datasets
08 datasets
 
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce
A Parallel Algorithm for Approximate Frequent Itemset Mining using MapReduce
 
NoSQL databases pros and cons
NoSQL databases pros and consNoSQL databases pros and cons
NoSQL databases pros and cons
 

Recently uploaded

Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...ssuserf63bd7
 
Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Seán Kennedy
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceSapana Sha
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectBoston Institute of Analytics
 
Semantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptxSemantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptxMike Bennett
 
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...Amil Baba Dawood bangali
 
Learn How Data Science Changes Our World
Learn How Data Science Changes Our WorldLearn How Data Science Changes Our World
Learn How Data Science Changes Our WorldEduminds Learning
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPTBoston Institute of Analytics
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)jennyeacort
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.natarajan8993
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort servicejennyeacort
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsVICTOR MAESTRE RAMIREZ
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样vhwb25kk
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFAAndrei Kaleshka
 
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档208367051
 

Recently uploaded (20)

Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
 
Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts Service
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis Project
 
Semantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptxSemantic Shed - Squashing and Squeezing.pptx
Semantic Shed - Squashing and Squeezing.pptx
 
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
 
Learn How Data Science Changes Our World
Learn How Data Science Changes Our WorldLearn How Data Science Changes Our World
Learn How Data Science Changes Our World
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business Professionals
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFA
 
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
 

3 Git

Editor's Notes

  1. Git is a distributed version control system.
  2. Or you can think of it as
  3. A directory content management system
  4. A tree based history storage system
  5. Or How git is described on the Git Man page a Stupid content tracker.
  6. Git is super cool.
  7. Now lets see what this visually looks like. On my first commit I have A. The default branch that gets created with git is a branch names Master. This is just a default name. As I mentioned before, most everything in git is done by convention. Master does not mean anything special to git.
  8. We make a set of commits, moving master and our current pointer (*) along
  9. Suppose we want to work on a bug. We start by creating a local “story branch” for this work. Notice that the new branch is really just a pointer to the same commit (C) but our current pointer (*) is moved.
  10. Now we make commits and they move along, with the branch and current pointer following along.
  11. We can “checkout” to go back to the master branch. This is where I was freaked out the first time I did this. My IDE removed the changes I just made. It can be pretty startling, but don’t worry you didn’t lose anything.
  12. And then merge from the story branch, bringing those change histories together.
  13. And since we’re done with the story branch, we can delete it. This all happened locally, without affecting anyone upstream.
  14. Let’s consider another scenario. Here we created our bug story branch back off of (C). But some changes have happened in master (bug 123 which we just merged) since then. And we made a couple of commits in bug 456.
  15. Again, to merge, we checkout back to master which moves our (*) pointer.
  16. And now we merge, connecting the new (H) to both (E) and (G). Note that this merge, especially if there are conflicts, can be unpleasant to perform.
  17. Now we delete the branch pointer. But notice the structure we have now. This is very non-linear. That will make it challenging to see the changes independently. And it can get very messy over time.
  18. Rebase flow - Let’s go back in time and look at another approach that git enables. So here we are ready to merge.
  19. Instead of merging, we “rebase”. What this means is something like this: 1. Take the changes we had made against (C) and undo them, but remember what they were 2. Re-apply them on (E) instead
  20. Now when we merge them, we get a nice linear flow. Also, the actual changeset ordering in the repository mirrors what actually happened. (F’) and (G’) come after E rather than in parallel to it. Also, there is one fewer snapshots in the repository.
  21. Suppose we are here. We cloned master on (A) and have been fixing bug 123 in our story branch.
  22. I’ll use the orange box to indicate where the master pointer is on the remote server. Here we are as before with our local master branch and the remote master branch both pointing at (A)
  23. The changes on the Bug123 branch are only known to my local machine the remote server does not have these changes. Or the bug123 branch for that matter.
  24. But in fact there are two versions of the orange master pointer. One is what we last know about the upstream master and the other is what is actually up there (which we don’t know about).
  25. So if this is what we know, we can update our master to catch up. First we checkout master which moves our current (*) to there. Note that we are actually on our master, not the upstream one. That is always true. But the tracking branch is also pointing to (A) at this point.
  26. Now we can do a pull on the origin (our source remote) and move both along to their new place.
  27. I have not talked about Pull before. The pull command is combination of a fetch from the remote server and a merge of the changes. You can do these steps separately, but if you are not working on the branch you are pulling down, pull is just a nice way to get up to date.
  28. Now we can do a pull on the origin (our source remote) and move both along to their new place.
  29. Returning to our bug fix now by checkout on that, we have a similar problem to what we saw before. B-C-D-E all come before F and G. Merging would create issues, right?
  30. So we use rebase to rewind and replay B-C-D-E after G.
  31. Then we checkout back to master
  32. And merge. Note that the orange (upstream) pointer is still “back there”.
  33. And finally, because we want to publish these changes, we push to the origin, moving the orange pointer along.
  34. Push will update the remote server. If you are out of date, Git will reject that push. Git will require you to merge locally, then push the results.
  35. And finally, because we want to publish these changes, we push to the origin, moving the orange pointer along.
  36. Delete the story branch and we’re good to go
  37. Say we want to start working on the next version of our Cool Project
  38. Say we want to start working on the next version of our Cool Project. We will want to create a develop branch
  39. To share this with the team we need to push it up to the remote
  40. To share this with the team we need to push it up to the remote
  41. Lets say there are some changes on develop from other team members. Until we do a pull we won’t see these changes locally
  42. Pull some changes from other team members… you should be doing this at least once a day.
  43. Now we have an idea. We create a working branch off of development
  44. Now we have an idea. We create a working branch off of development
  45. One of your teammates did a hotfix in production
  46. Since we are keeping up to date. Just doing a pull or fetch now and then is a good idea.
  47. Merge Idea into Develop. First we want to checkout develop
  48. Since there was not any additional changes on develop we could easily merge idea into develop. – This is call a fast forward merge since git is really just moving the pointer to H
  49. We can delete idea now
  50. We now need to share develop with the rest of the team.
  51. When we are ready to move the develop branch to production (master) we have two choices. We can go through the merge flow, or a rebase flow.
  52. Move onto master
  53. Move onto master
  54. Move onto master
  55. Rebase flow - Move onto master
  56. Rebase flow - Move onto master
  57. Rebase flow – Get Origin up to date
  58. As with most things with Git, there are multiple ways to do something. Using a Merge flow verse a Rebase flow is a matter of taste, but as you can see the rebase flow looks cleaner and as you get into large projects the number of branches can get pretty messy. This is a simple example of rewriting history in git.