SlideShare a Scribd company logo
GIT SCM

@stefanprutianu
SCM?
Source Code Management
aka!
!

Version Control System!
aka!
!

Revision Control System
Why?
! collaboration
! because we need to keep track of changes:
when? !
why? !
what was the content? !
who? (very important, right? :))

! centralized SCMs: Subversion, CVS
! distributed SCMs: GIT, Mercurial
Centralized & Distributed
checkout!
commit!
revert!
merge!
tag!
branch!
lock!
conflict resolution.!
...
Centralized vs. Distributed
centralized

distributed

master copy in one
place!

everyone has a full
copy - distributed!

single point of failure!

works offline or
disconnected from a
server!

considers data as a list
of file -based changes
(initial version + deltas) !
a commit operates over
the central repository

saves snapshots of data
it manages !
a commit operates over
the local repository
SVN model
Repository

Client 2

Client 1

Version 1

Version 2

File A

Delta 1

Version 4
Delta 2

Delta 1

File B
File C

Version 3

Client n

Delta 1
Time

Delta 2
GIT model
Central!
Repository
Client 1 !
(mirror)

Client 2!
(mirror)

Client n!
(mirror)

Version 1

Version 2

Version 3

Version 4

File A

File A1

File A1

File A2

File B

File B

File B1

File B2

File C

File C1

File C1

File C1

Time
GIT --history
British slang for "pig headed, think they are always
correct, argumentative"
2005, Linux kernel maintenance (35000 files)!
Linus Torvalds!
written in C
"So I'm sorry, but for something like git, where efficiency was a primary !
objective, the "advantages" of C++ is just a huge mistake. The fact that !
we also piss off people who cannot see that is just a big additional !
advantage." (L.T.)

modern, robust, fast, distributed, great branching
system, complex merges, open source!
available on Mac, Windows, Linux
GIT --philosophy
a git repository is a....graph, Directed Acyclic Graph!
node = commit!
edge = pointers from child nodes to parent node(s)!
nodes are identified by SHA-1 hashes from: content change +
parent(s) commit identifier => speed!
a lot of the work done by git involves moving references
(labels) around => speed
GIT --philosophy
git references = labels assigned to commits !
several types: branch (local/remote), tag, stash!
references are stored in .git/refs/heads ( the SHA-1
identifier of the commit it points to, 41 bytes)!
there are references to references -> HEAD, for example,
which points to the current branch!
references make commits reachable
GIT --philosophy

fast forward merge
GIT --philosophy
GIT --concepts
git manages its content via 3 states: modified, staged,
committed
Workspace

Staging !

Repository

area
stage

commit

unstage

checkout

Local repository
GIT --concepts
Workspace (working directory)
one version of the content, extracted from git database to be
used or modified
GIT --concepts
Staging area (index)
allows you to elect files/content that is going to participate in
the next commit!
you can see how the next snapshot would look like before
actually creating it - avoid mistakes!
allows you to break changes in workspace into more than 1
single commit
GIT --concepts
Repository
where object database and metadata is stored!
the .git folder inside your repository root folder
GIT --concepts
git manages its content via 3 4 states: modified,
staged, committed, stashed!
!

Stash
here you can save changes you want to keep but
not ready to commit yet!
stashes are in fact labeled nodes on the
repository graph
GIT --concepts
Stash
Stash

Workspace

Staging !

Repository

area
create

stage

apply

commit

unstage

checkout

Local repository
GIT --concepts
Remote repository
git repository located on another machine, usually!
the local repository may be a mirror of the remote one!
write into it via push, read from it via pull & fetch
GIT --concepts
Remote repository
Stash

Workspace

Staging !
area

Repository

Remote repository

push

pull/fetch
Stash

Workspace

Staging !
area

Repository

Local repository
GIT --concepts
GIT objects
blobs - contents of a file!
tree - directories of blobs or other trees!
commits - SHA-1 of a tree, parent commit(s), message!
tags (annotated)
GIT --@work
Create a repository
git init
initializes a new, empty repository, inside the current directory

git clone https://stefanprutianu@bitbucket.org/
stefanprutianu/git-scm-remote.git
clones the remote repository on the local machine, inside a
newly created git-scm-remote folder
GIT --@work
Prepare a commit (stage)
git add <file> | <pattern>
marks the file(s) as belonging to the next commit, i.e. changes
are staged

git reset <file>
removes the file from the staging area
GIT --@work
Commit
git commit -m "Commit message"
records the commit in the repository history

git commit --amend
modifies the last commit by adding the staged changes
GIT --@work
Revert
git checkout -- <file>
the <file> contents in working directory is replaced with the
last committed one

git reset --hard <branch/commit/tag>
discards commits until the one pointed to by the reference

git revert <commit>
reverses the specified commit by creating a new one
GIT --@work
Stash
git stash
saves the working directory state and pushes it on the stashes
stack

git stash apply
gets the most recent stash and applies it to the working
directory
GIT --@work
Share changes
publishing changes
git push <server> <branch>
pushes your changes on the specified branch of the remote
repository

git format-patch HEAD --stdout > mypatch.patch
retrieving changes
git fetch <server>
pulls down all the data from the remote repo that you don't
have yet on tracked branches

git pull
does a git pull and merges those on your current branch
GIT --@work
Branch
git branch <branch name>
creates a new branch starting from your last commit

git checkout -b <branch name>
creates a new branch starting from your last commit and
switches to it

git branch -d <branch name>
deletes the specified branch
GIT --@work
Merge
git merge <branch name>
merges the specified branch into the current one

git rebase <branch name>
rebases the specified branch onto the current one
GIT --@work : merge
master

A

E

B
C

D
develop

using merge
master

A

E

B

F
D

C

develop

using rebase
master

A

B

develop

E
C

C'

D

D'
GIT --a branching model
master

develop

hotfix/*

feature/*

tag 1.0.0

tag 1.1.0

tag 1.1.1

tag 1.5.0

http:/
/nvie.com/posts/a-successful-git-branching-model/
GIT --@work
Status
git log
prints out the commit tree from the current HEAD

git status
shows info like: current branch, working directory status,
staged changes

git stash show
shows the most recent stash

git describe
shows where you are in repository history relatively to the latest
tag, i.e a revision number. Eg: v1.0.0-50-g1f8115b
GIT --@work
Status
git diff <commit>
shows the diff between working directory and specified commit

git branch [-r]
lists either local or remote (-r) branches
GIT --@work
Status
GIT --@work
Release management
git tag v1.0.0 -m "My first release"
creates a "lightweight" tag, i.e. an immovable reference on the
current head

git tag v1.0.0 -a -m "My first release"
creates an "annotated" tag, i.e. an immovable reference on the
current head + info like: tagger, email, date which are stored in
the git database
GIT --@work
Misc
git cherry-pick <commit>
integrates changes in specified commit into the current branch

git bisect
given a start and an end commit reference it will checkout
commits within that range allowing to find a regression

git blame
annotates each line in a file with that last commit to change it
GIT --repository
.gitignore file to express ignore patterns, can be put in
multiple places!
!

git repos smaller than SVN ones, 30x in case of Mozilla!
!

steep learning curve (debatable)!
!

can't checkout part of a repository!
!

oriented towards content rather than files !
!

for transport it supports: HTTP, SSH, GIT protocols!
!

objects are generally added not deleted, reason for git gc
GIT --how to
latest release http:/
/git-scm.com/downloads!
works from CLI!
good GUI clients:
Github for Mac/Win, free ("optimized" for github.com remotes,
but works with others too)!
SourceTree (Mac & Win), free!
Tower (Mac)
(Em)Powered by GIT
https:/
/github.com/

https:/
/bitbucket.org/

https:/
/www.assembla.com/
GIT SCM
easy branching

local, flexible, fast

reliable history

integrity

non-linear, facilitates collaboration
Thank you!
Questions?

@stefanprutianu
Ad

More Related Content

What's hot (20)

Git and git flow
Git and git flowGit and git flow
Git and git flow
Fran García
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
 
SCM (Source Control Management) - Git Basic
SCM (Source Control Management) - Git Basic SCM (Source Control Management) - Git Basic
SCM (Source Control Management) - Git Basic
Aman Patial
 
Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
Rupesh Kumar
 
Git basics
Git basicsGit basics
Git basics
GHARSALLAH Mohamed
 
Version control system and Git
Version control system and GitVersion control system and Git
Version control system and Git
ramubonkuri
 
Version Control History and Git Basics
Version Control History and Git BasicsVersion Control History and Git Basics
Version Control History and Git Basics
Sreedath N S
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
Carl Brown
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
Nilay Binjola
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
Arulmurugan Rajaraman
 
Ansible 入門 #01 (初心者向け)
Ansible 入門 #01 (初心者向け)Ansible 入門 #01 (初心者向け)
Ansible 入門 #01 (初心者向け)
Taro Hirose
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
viniciusban
 
Git & SourceTree
Git & SourceTreeGit & SourceTree
Git & SourceTree
Tu Tran
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
Arnaud Seilles
 
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
SheilaJimenezMorejon
 
寫給大家的 Git 教學
寫給大家的 Git 教學寫給大家的 Git 教學
寫給大家的 Git 教學
littlebtc
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
"FENG "GEORGE"" YU
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Somkiat Puisungnoen
 
git and github
git and githubgit and github
git and github
Darren Oakley
 
SCM (Source Control Management) - Git Basic
SCM (Source Control Management) - Git Basic SCM (Source Control Management) - Git Basic
SCM (Source Control Management) - Git Basic
Aman Patial
 
Version control system and Git
Version control system and GitVersion control system and Git
Version control system and Git
ramubonkuri
 
Version Control History and Git Basics
Version Control History and Git BasicsVersion Control History and Git Basics
Version Control History and Git Basics
Sreedath N S
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
Carl Brown
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
Nilay Binjola
 
Ansible 入門 #01 (初心者向け)
Ansible 入門 #01 (初心者向け)Ansible 入門 #01 (初心者向け)
Ansible 入門 #01 (初心者向け)
Taro Hirose
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
viniciusban
 
Git & SourceTree
Git & SourceTreeGit & SourceTree
Git & SourceTree
Tu Tran
 
寫給大家的 Git 教學
寫給大家的 Git 教學寫給大家的 Git 教學
寫給大家的 Git 教學
littlebtc
 

Viewers also liked (10)

Git 簡介(古時候的簡報備份)
Git 簡介(古時候的簡報備份)Git 簡介(古時候的簡報備份)
Git 簡介(古時候的簡報備份)
Hsin-lin Cheng
 
Maven Overview
Maven OverviewMaven Overview
Maven Overview
FastConnect
 
Git scm-final
Git scm-finalGit scm-final
Git scm-final
satya sudheer
 
Lightning Talk: Git VCS
Lightning Talk: Git VCSLightning Talk: Git VCS
Lightning Talk: Git VCS
Jeff Bayes
 
Git scm
Git scmGit scm
Git scm
Infinity Levels Studio
 
ビッグデータ関連Oss動向調査とニーズ分析
ビッグデータ関連Oss動向調査とニーズ分析ビッグデータ関連Oss動向調査とニーズ分析
ビッグデータ関連Oss動向調査とニーズ分析
Yukio Yoshida
 
初心者 Git 上手攻略
初心者 Git 上手攻略初心者 Git 上手攻略
初心者 Git 上手攻略
Lucien Lee
 
Git workflows
Git workflowsGit workflows
Git workflows
Sergiu Savva
 
Quick Introduction to git
Quick Introduction to gitQuick Introduction to git
Quick Introduction to git
Joel Krebs
 
SCM Dashboard
SCM DashboardSCM Dashboard
SCM Dashboard
Perforce
 
Git 簡介(古時候的簡報備份)
Git 簡介(古時候的簡報備份)Git 簡介(古時候的簡報備份)
Git 簡介(古時候的簡報備份)
Hsin-lin Cheng
 
Lightning Talk: Git VCS
Lightning Talk: Git VCSLightning Talk: Git VCS
Lightning Talk: Git VCS
Jeff Bayes
 
ビッグデータ関連Oss動向調査とニーズ分析
ビッグデータ関連Oss動向調査とニーズ分析ビッグデータ関連Oss動向調査とニーズ分析
ビッグデータ関連Oss動向調査とニーズ分析
Yukio Yoshida
 
初心者 Git 上手攻略
初心者 Git 上手攻略初心者 Git 上手攻略
初心者 Git 上手攻略
Lucien Lee
 
Quick Introduction to git
Quick Introduction to gitQuick Introduction to git
Quick Introduction to git
Joel Krebs
 
SCM Dashboard
SCM DashboardSCM Dashboard
SCM Dashboard
Perforce
 
Ad

Similar to Git SCM (20)

Git basic
Git basicGit basic
Git basic
Akbar Uddin
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
Jason Byrne
 
Version control with GIT
Version control with GITVersion control with GIT
Version control with GIT
Zeeshan Khan
 
Git introduction
Git introductionGit introduction
Git introduction
satyendrajaladi
 
git.ppt.pdf
git.ppt.pdfgit.ppt.pdf
git.ppt.pdf
Roniel Lopez Alvarez
 
Git 101
Git 101Git 101
Git 101
jayrparro
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control System
Tommaso Visconti
 
Git workshop
Git workshopGit workshop
Git workshop
Mateusz Galazyn
 
Git
GitGit
Git
Hanokh Aloni
 
github ppt git ppt on git hub to know ab
github ppt git ppt on git hub to know abgithub ppt git ppt on git hub to know ab
github ppt git ppt on git hub to know ab
infoinnext
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Git training
Git trainingGit training
Git training
eric7master
 
Git slides
Git slidesGit slides
Git slides
Nanyak S
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
Soumen Debgupta
 
Git basic introduction & tutorial for begginer
Git basic introduction & tutorial for begginerGit basic introduction & tutorial for begginer
Git basic introduction & tutorial for begginer
AnDiLestiAnto2
 
SVN 2 Git
SVN 2 GitSVN 2 Git
SVN 2 Git
Marco De Stefano
 
Advanced git
Advanced gitAdvanced git
Advanced git
satya sudheer
 
Git like a pro EDD18 - Full edition
Git like a pro EDD18 - Full editionGit like a pro EDD18 - Full edition
Git like a pro EDD18 - Full edition
Jesús Miguel Benito Calzada
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
9 series
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
Nguyen Van Hung
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
Jason Byrne
 
Version control with GIT
Version control with GITVersion control with GIT
Version control with GIT
Zeeshan Khan
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control System
Tommaso Visconti
 
github ppt git ppt on git hub to know ab
github ppt git ppt on git hub to know abgithub ppt git ppt on git hub to know ab
github ppt git ppt on git hub to know ab
infoinnext
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Git slides
Git slidesGit slides
Git slides
Nanyak S
 
Git basic introduction & tutorial for begginer
Git basic introduction & tutorial for begginerGit basic introduction & tutorial for begginer
Git basic introduction & tutorial for begginer
AnDiLestiAnto2
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
9 series
 
Ad

Recently uploaded (20)

Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 

Git SCM

  • 2. SCM? Source Code Management aka! ! Version Control System! aka! ! Revision Control System
  • 3. Why? ! collaboration ! because we need to keep track of changes: when? ! why? ! what was the content? ! who? (very important, right? :)) ! centralized SCMs: Subversion, CVS ! distributed SCMs: GIT, Mercurial
  • 5. Centralized vs. Distributed centralized distributed master copy in one place! everyone has a full copy - distributed! single point of failure! works offline or disconnected from a server! considers data as a list of file -based changes (initial version + deltas) ! a commit operates over the central repository saves snapshots of data it manages ! a commit operates over the local repository
  • 6. SVN model Repository Client 2 Client 1 Version 1 Version 2 File A Delta 1 Version 4 Delta 2 Delta 1 File B File C Version 3 Client n Delta 1 Time Delta 2
  • 7. GIT model Central! Repository Client 1 ! (mirror) Client 2! (mirror) Client n! (mirror) Version 1 Version 2 Version 3 Version 4 File A File A1 File A1 File A2 File B File B File B1 File B2 File C File C1 File C1 File C1 Time
  • 8. GIT --history British slang for "pig headed, think they are always correct, argumentative" 2005, Linux kernel maintenance (35000 files)! Linus Torvalds! written in C "So I'm sorry, but for something like git, where efficiency was a primary ! objective, the "advantages" of C++ is just a huge mistake. The fact that ! we also piss off people who cannot see that is just a big additional ! advantage." (L.T.) modern, robust, fast, distributed, great branching system, complex merges, open source! available on Mac, Windows, Linux
  • 9. GIT --philosophy a git repository is a....graph, Directed Acyclic Graph! node = commit! edge = pointers from child nodes to parent node(s)! nodes are identified by SHA-1 hashes from: content change + parent(s) commit identifier => speed! a lot of the work done by git involves moving references (labels) around => speed
  • 10. GIT --philosophy git references = labels assigned to commits ! several types: branch (local/remote), tag, stash! references are stored in .git/refs/heads ( the SHA-1 identifier of the commit it points to, 41 bytes)! there are references to references -> HEAD, for example, which points to the current branch! references make commits reachable
  • 13. GIT --concepts git manages its content via 3 states: modified, staged, committed Workspace Staging ! Repository area stage commit unstage checkout Local repository
  • 14. GIT --concepts Workspace (working directory) one version of the content, extracted from git database to be used or modified
  • 15. GIT --concepts Staging area (index) allows you to elect files/content that is going to participate in the next commit! you can see how the next snapshot would look like before actually creating it - avoid mistakes! allows you to break changes in workspace into more than 1 single commit
  • 16. GIT --concepts Repository where object database and metadata is stored! the .git folder inside your repository root folder
  • 17. GIT --concepts git manages its content via 3 4 states: modified, staged, committed, stashed! ! Stash here you can save changes you want to keep but not ready to commit yet! stashes are in fact labeled nodes on the repository graph
  • 19. GIT --concepts Remote repository git repository located on another machine, usually! the local repository may be a mirror of the remote one! write into it via push, read from it via pull & fetch
  • 20. GIT --concepts Remote repository Stash Workspace Staging ! area Repository Remote repository push pull/fetch Stash Workspace Staging ! area Repository Local repository
  • 21. GIT --concepts GIT objects blobs - contents of a file! tree - directories of blobs or other trees! commits - SHA-1 of a tree, parent commit(s), message! tags (annotated)
  • 22. GIT --@work Create a repository git init initializes a new, empty repository, inside the current directory git clone https://[email protected]/ stefanprutianu/git-scm-remote.git clones the remote repository on the local machine, inside a newly created git-scm-remote folder
  • 23. GIT --@work Prepare a commit (stage) git add <file> | <pattern> marks the file(s) as belonging to the next commit, i.e. changes are staged git reset <file> removes the file from the staging area
  • 24. GIT --@work Commit git commit -m "Commit message" records the commit in the repository history git commit --amend modifies the last commit by adding the staged changes
  • 25. GIT --@work Revert git checkout -- <file> the <file> contents in working directory is replaced with the last committed one git reset --hard <branch/commit/tag> discards commits until the one pointed to by the reference git revert <commit> reverses the specified commit by creating a new one
  • 26. GIT --@work Stash git stash saves the working directory state and pushes it on the stashes stack git stash apply gets the most recent stash and applies it to the working directory
  • 27. GIT --@work Share changes publishing changes git push <server> <branch> pushes your changes on the specified branch of the remote repository git format-patch HEAD --stdout > mypatch.patch retrieving changes git fetch <server> pulls down all the data from the remote repo that you don't have yet on tracked branches git pull does a git pull and merges those on your current branch
  • 28. GIT --@work Branch git branch <branch name> creates a new branch starting from your last commit git checkout -b <branch name> creates a new branch starting from your last commit and switches to it git branch -d <branch name> deletes the specified branch
  • 29. GIT --@work Merge git merge <branch name> merges the specified branch into the current one git rebase <branch name> rebases the specified branch onto the current one
  • 30. GIT --@work : merge master A E B C D develop using merge master A E B F D C develop using rebase master A B develop E C C' D D'
  • 31. GIT --a branching model master develop hotfix/* feature/* tag 1.0.0 tag 1.1.0 tag 1.1.1 tag 1.5.0 http:/ /nvie.com/posts/a-successful-git-branching-model/
  • 32. GIT --@work Status git log prints out the commit tree from the current HEAD git status shows info like: current branch, working directory status, staged changes git stash show shows the most recent stash git describe shows where you are in repository history relatively to the latest tag, i.e a revision number. Eg: v1.0.0-50-g1f8115b
  • 33. GIT --@work Status git diff <commit> shows the diff between working directory and specified commit git branch [-r] lists either local or remote (-r) branches
  • 35. GIT --@work Release management git tag v1.0.0 -m "My first release" creates a "lightweight" tag, i.e. an immovable reference on the current head git tag v1.0.0 -a -m "My first release" creates an "annotated" tag, i.e. an immovable reference on the current head + info like: tagger, email, date which are stored in the git database
  • 36. GIT --@work Misc git cherry-pick <commit> integrates changes in specified commit into the current branch git bisect given a start and an end commit reference it will checkout commits within that range allowing to find a regression git blame annotates each line in a file with that last commit to change it
  • 37. GIT --repository .gitignore file to express ignore patterns, can be put in multiple places! ! git repos smaller than SVN ones, 30x in case of Mozilla! ! steep learning curve (debatable)! ! can't checkout part of a repository! ! oriented towards content rather than files ! ! for transport it supports: HTTP, SSH, GIT protocols! ! objects are generally added not deleted, reason for git gc
  • 38. GIT --how to latest release http:/ /git-scm.com/downloads! works from CLI! good GUI clients: Github for Mac/Win, free ("optimized" for github.com remotes, but works with others too)! SourceTree (Mac & Win), free! Tower (Mac)
  • 40. GIT SCM easy branching local, flexible, fast reliable history integrity non-linear, facilitates collaboration