SlideShare una empresa de Scribd logo
1 de 82
Descargar para leer sin conexión
/mhajiloo
Majid	Hajiloo
WHAT IS VERSION CONTROL?
WHAT IS VERSION CONTROL?
Version control systems are a category of software tools that help a
software team manage changes to source code over time. Version
control software keeps track of every modification to the code in a
special kind of database.
▸ Benefits of version control
A complete long-term change history of every file
Branching and merging
Traceability
3
WHAT IS VERSION CONTROL?
LOCAL VERSION CONTROL SYSTEMS
4
WHAT IS VERSION CONTROL?
CENTRALIZED VERSION CONTROL SYSTEMS
5
WHAT IS VERSION CONTROL?
DISTRIBUTED VERSION CONTROL SYSTEMS
6
WHAT IS GIT?
WHAT IS GIT?
▸ Git was initially designed and
developed in 2005 by Linux kernel
developers (including Linus
Torvalds) for Linux kernel
development.
▸ Having a distributed architecture.
Rather than have only one single
place for the full version history of
the software as is common in once-
popular version control systems
like CVS or Subversion.
8
WHAT IS GIT?
GIT	-	the	stupid	content	tracker	
"git"	can	mean	anything,	depending	on	your	mood.	
	-	random	three-letter	combination	that	is	pronounceable,	and	not	
			actually	used	by	any	common	UNIX	command.		The	fact	that	it	is	a	
			mispronounciation	of	"get"	may	or	may	not	be	relevant.	
	-	stupid.	contemptible	and	despicable.	simple.	Take	your	pick	from	the	
			dictionary	of	slang.	
	-	"global	information	tracker":	you're	in	a	good	mood,	and	it	actually	
			works	for	you.	Angels	sing,	and	a	light	suddenly	fills	the	room.		
	-	"goddamn	idiotic	truckload	of	sh*t":	when	it	breaks	
This	is	a	stupid	(but	extremely	fast)	directory	content	manager.		It	
doesn't	do	a	whole	lot,	but	what	it	_does_	do	is	track	directory	
contents	efficiently.	
9
GIT VS SUBVERSION PERFORMANCESeconds
0
350
700
1050
1400
PUSH/COMMIT PULL/CHECKOUT
GIT SUBVERSION GIT SUBVERSION
39.1
1,334.8
28.5104.5
Commit and checkout times of a repository of 2757 files and 428 directories, summing up to 26MB.
By: http://j.mp/1VY9KIl / CC BY-SA
10
GIT SECURITY
▸ Git has been designed with the integrity of managed
source code as a top priority. The content of the files as
well as the true relationships between files and directories,
versions, tags and commits, all of these objects in the Git
repository are secured with a cryptographically secure
hashing algorithm called SHA1.
▸ Some other version control systems have no protections
against secret alteration at a later date. This can be a
serious information security vulnerability for any
organization that relies on software development.
11
GIT IS A DE FACTO STANDARD
▸ The predominance of Git also means that many third party
software tools and services are already integrated with Git
including IDEs and tools like DVCS desktop clients:
▸ SourceTree (Windows/Mac)
▸ SmartGit (Windows/Linux/Mac)
▸ issue and project tracking software:
▸ JIRA
▸ and code hosting services
▸ GitHub
▸ Bitbucket
12
GIT VS SUBVERSION. GOOGLE TRENDS
Interest over Time (Git vs Subversion)
http://j.mp/23K41sb / Google Trends
13
SETTING UP A REPOSITORY
SETTING UP A REPOSITORY
INSTALLING GIT
▸ Linux: apt-get/yum/dnf/zypper install git
▸ Windows and Mac OS X
https://git-scm.com/downloads
15
SETTING UP A REPOSITORY
git	config
The git	config command lets you configure your Git installation
from the command line. This command can define everything from
user info to preferences to the behavior of a repository.
‣ git	config	--global	user.name	<name>	
‣ git	config	--global	user.email	<email>	
‣ git	config	--global	alias.<alias-name>	<git-command>	
‣ git	config	--system	core.editor	<editor>	
‣ git	config	--list
16
SETTING UP A REPOSITORY
git	init	<directory>
‣ The git init command creates a new Git repository. It can be used
to convert an existing, unversioned project to a Git repository or
initialize a new empty repository. Most of the other Git
commands are not available outside of an initialized repository,
so this is usually the first command you’ll run in a new project.
‣ Executing git init creates a .git subdirectory in the project root,
which contains all of the necessary metadata for the repo. Aside
from the .git directory, an existing project remains unaltered
(unlike SVN, Git doesn't require a .git folder in every
subdirectory).
17
SETTING UP A REPOSITORY
git	clone	<repo>
‣ The git	clone command copies an existing Git repository. This
is sort of like svn	checkout, except the “working copy” is a full-
fledged Git repository—it has its own history, manages its own
files, and is a completely isolated environment from the original
repository.
‣ The original repository can be located on the local filesystem or
on a remote machine accessible via HTTP or SSH.
18
SAVING CHANGES
19
SAVING CHANGES - SNAPSHOTS, NOT DIFFERENCES 20
SAVING CHANGES - SNAPSHOTS, NOT DIFFERENCES
Storing data as changes to a base version of each file
Storing data as snapshots of the project over time
20
SAVING CHANGES - THE THREE STATES
▸ Committed
Committed means that the data is safely stored in your
local database.
▸ Modified
Modified means that you have changed the file but have
not committed it to your database yet.
▸ Staged
Staged means that you have marked a modified file in
its current version to go into your next commit snapshot.
21
SAVING CHANGES - THE THREE STATES
Working directory, staging area, and Git directory
22
SAVING CHANGES
git	add	<file/directory/.>
‣ The git	add command adds a change in the working directory
to the staging area. It tells Git that you want to include updates
to a particular file in the next commit. However, git add doesn't
really affect the repository in any significant way—changes are
not actually recorded until you run git	commit.
‣ In conjunction with these commands, you'll also need git	
status to view the state of the working directory and the staging
area.
23
SAVING CHANGES - CHECKING THE STATUS OF YOUR FILES
$	git	status	
On	branch	master	
Your	branch	is	up-to-date	with	'origin/master'.	
nothing	to	commit,	working	directory	clean
24
SAVING CHANGES - CHECKING THE STATUS OF YOUR FILES
$	echo	'My	Project'	>	README	
$	git	status	
On	branch	master	
Your	branch	is	up-to-date	with	'origin/master'.	
Untracked	files:	
		(use	"git	add	<file>..."	to	include	in	what	will	
be	committed)	
				README	
nothing	added	to	commit	but	untracked	files	present	
(use	"git	add"	to	track)
25
SAVING CHANGES - CHECKING THE STATUS OF YOUR FILES
$	git	add	README	
$	git	status	
On	branch	master	
Your	branch	is	up-to-date	with	'origin/master'.	
Changes	to	be	committed:	
		(use	"git	reset	HEAD	<file>..."	to	unstage)	
				new	file:			README
26
SAVING CHANGES
IGNORING FILES
▸ From time to time, there are files you don't want Git to
check in.
▸ If you create a file in your repository named .gitignore, Git
uses it to determine which files and directories to ignore,
before you make a commit.
$	cat	.gitignore	
*.[oa]	
log/*.log
27
SAVING CHANGES
git	commit
The git	 commit	 command commits the staged snapshot to the
local repository. Git will never change them unless you explicity
ask it to. Along with git add, this is one of the most important Git
commands. This command is nothing like svn commit.
$	git	commit	-m	"Story	182:	Fix	benchmarks	for	speed"	
[master	463dc4f]	Story	182:	Fix	benchmarks	for	speed	
	2	files	changed,	2	insertions(+)	
	create	mode	100644	README
28
SAVING CHANGES
A commit and its tree
29
SAVING CHANGES
git	checkout
The git	 checkout command serves three distinct functions:
checking out files, checking out commits, and checking out
branches
$	git	checkout	<branch>	
$	git	checkout	<commit>	<file>	
$	git	checkout	<commit>
30
SAVING CHANGES
git	revert	<commit>
The git	 revert command undoes a committed snapshot. But,
instead of removing the commit from the project history, it figures
out how to undo the changes introduced by the commit and
appends a new commit with the resulting content.
31
SAVING CHANGES
git	revert	<commit>
The git	 revert command undoes a committed snapshot. But,
instead of removing the commit from the project history, it figures
out how to undo the changes introduced by the commit and
appends a new commit with the resulting content.
ResettingReverting
31
SYNCING
git	fetch	<remote>	<branch>
‣ The git fetch command imports commits from a remote
repository into your local repo. The resulting commits are stored
as remote branches instead of the normal local branches that
we’ve been working with.
‣ Fetching is what you do when you want to see what everybody
else has been working on. Since fetched content is represented
as a remote branch, it has absolutely no effect on your local
development work.
32
SYNCING
git	pull	<remote>
‣ Merging upstream changes into your local repository is a
common task in Git-based collaboration workflows.
‣ You can think of git	pull as Git's version of svn	update. It’s an
easy way to synchronize your local repository with upstream
changes.
33
SYNCING - PULL 34
SYNCING - PULL 34
SYNCING - PULL 34
SYNCING
git	push	<remote>	<branch>
‣ Pushing is how you transfer commits from your local repository
to a remote repo. It's the counterpart to git	fetch, but whereas
fetching imports commits to local branches, pushing exports
commits to remote branches.
‣ After you’ve accumulated several local commits and are ready to
share them with the rest of the team
35
SYNCING
git	tag	-a	<tag>
‣ Like most VCSs, Git has the ability to tag specific points in history
as being important. Typically people use this functionality to
mark release points (v1.0, and so on).
‣ Git uses two main types of tags: lightweight and annotated.
36
SYNCING 37
USING BRANCHES
USING BRANCHES
git	branch
‣ In Git, branches are a part of your everyday development
process. When you want to add a new feature or fix a bug—no
matter how big or how small—you spawn a new branch to
encapsulate your changes. This makes sure that unstable code is
never committed to the main code base
‣ A branch represents an independent line of development.
Branches serve as an abstraction for the edit/stage/commit.
‣ The git branch command lets you create, list, rename, and delete
branches
39
USING BRANCHES 40
$	git	branch	crazy-experiment
USING BRANCHES 40
$	git	branch	crazy-experiment
USING BRANCHES
git	merge	<branch>
‣ Merging is Git's way of putting a forked history back together
again.
‣ The git	merge command lets you take the independent lines of
development created by git	branch and integrate them into a
single branch.
41
USING BRANCHES
git	merge	<branch>
42
COMPARING WORKFLOWS
COMPARING WORKFLOWS
CENTRALIZED WORKFLOW
44
Like Subversion, the Centralized
Workflow uses a central
repository to serve as the single
point-of-entry for all changes to
the project. Instead of trunk, the
default development branch is
called master and all changes
are committed into this branch.
This workflow doesn’t require
any other branches besides
master
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
SOMEONE INITIALIZES THE CENTRAL REPOSITORY
45
$	ssh	user@host	git	init	--bare	/path/to/repo.git
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
EVERYBODY CLONES THE CENTRAL REPOSITORY
46
$	git	clone	ssh://user@host/path/to/repo.git
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
JOHN AND MARY WORK ON THEIR FEATURES
47
$	git	status	#	View	the	state	of	the	repo	
$	git	add	<some-file>	#	Stage	a	file	
$	git	commit	#	Commit	a	file</some-file>
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
JOHN AND MARY WORK ON THEIR FEATURES
47
$	git	push	origin	master
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
MARY TRIES TO PUBLISH HER FEATURE
48
$	git	push	origin	master
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
MARY TRIES TO PUBLISH HER FEATURE
48
$	git	push	origin	master
error:	failed	to	push	some	refs	to	'/path/to/repo.git'	
hint:	Updates	were	rejected	because	the	tip	of	your	
current	branch	is	behind	
hint:	its	remote	counterpart.	Merge	the	remote	changes	
(e.g.	'git	pull')	
hint:	before	pushing	again.	
hint:	See	the	'Note	about	fast-forwards'	in	'git	push	
--help'	for	details.
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
MARY REBASES ON TOP OF JOHN’S COMMIT(S)
49
$	git	pull	--rebase	origin	master
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
MARY REBASES ON TOP OF JOHN’S COMMIT(S)
49
$	git	pull	--rebase	origin	master
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
MARY RESOLVES A MERGE CONFLICT
50
CONFLICT	(content):	Merge	conflict	in	<some-file>
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
MARY RESOLVES A MERGE CONFLICT
51
$	git	status
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
MARY RESOLVES A MERGE CONFLICT
51
$	git	status
#	Unmerged	paths:	
#	(use	"git	reset	HEAD	<some-file>..."	to	unstage)	
#	(use	"git	add/rm	<some-file>..."	as	appropriate	to	
mark	resolution)	
#	
#	both	modified:	<some-file>
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
MARY RESOLVES A MERGE CONFLICT
52
#!	/usr/bin/env	ruby	
def	hello	
<<<<<<<	HEAD	
		puts	'hola	world'	
=======	
		puts	'hello	mundo'	
>>>>>>>	master	
end	
hello()
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
MARY RESOLVES A MERGE CONFLICT
52
#!	/usr/bin/env	ruby	
def	hello	
		puts	'hola	world'	
end	
hello()
$	git	add	<some-file>	
$	git	rebase	--continue
$	git	rebase	--abort
COMPARING WORKFLOWS - CENTRALIZED WORKFLOW
MARY SUCCESSFULLY PUBLISHES HER FEATURE
53
$	git	push	origin	master
COMPARING WORKFLOWS
FEATURE BRANCH WORKFLOW
54
The core idea behind the Feature
Branch Workflow is that all feature
development should take place in a
dedicated branch instead of the
master branch. This encapsulation
makes it easy for multiple developers
to work on a particular feature
without disturbing the main
codebase. It also means the master
branch will never contain broken
code, which is a huge advantage for
c o n t i n u o u s i n t e g r a t i o n
environments.
COMPARING WORKFLOWS - FEATURE BRANCH WORKFLOW
MARY BEGINS A NEW FEATURE
55
$	git	checkout	-b	marys-feature	master	
$	git	status	
$	git	add	<some-file>	
$	git	commit
COMPARING WORKFLOWS - FEATURE BRANCH WORKFLOW
MARY MAKES THE CHANGES
56
$	git	push	-u	origin	marys-feature
COMPARING WORKFLOWS - FEATURE BRANCH WORKFLOW
MARY PUBLISHES HER FEATURE
57
$	git	checkout	master	
$	git	pull	
$	git	pull	origin	marys-feature	
$	git	push
COMPARING WORKFLOWS
GITFLOW WORKFLOW
58
The Gitflow Workflow defines a strict
branching model designed around
the project release. While somewhat
more complicated than the Feature
Branch Workflow, this provides a
robust framework for managing
larger projects. This workflow doesn’t
add any new concepts or commands
beyond what’s required for the
Feature Branch Workflow. Instead, it
assigns very specific roles to different
branches and defines how and when
they should interact.
by Vincent Driessen | http://j.mp/1YLriqr
COMPARING WORKFLOWS - GITFLOW WORKFLOW
HISTORICAL BRANCHES
59
The master branch stores the official release history, and the
develop branch serves as an integration branch for features.
COMPARING WORKFLOWS - GITFLOW WORKFLOW
FEATURE BRANCHES
60
Each new feature instead of branching off of master, feature
branches use develop as their parent branch
COMPARING WORKFLOWS - GITFLOW WORKFLOW
FEATURE BRANCHES
61
May branch off from:
‣ develop
Must merge back into:
‣ develop
Branch naming convention:
‣ anything except master, develop, release-*, or hotfix-*
COMPARING WORKFLOWS - GITFLOW WORKFLOW
RELEASE BRANCHES
62
Once develop has acquired enough features for a release, you
fork a release branch off of develop.
COMPARING WORKFLOWS - GITFLOW WORKFLOW
RELEASE BRANCHES
63
May branch off from:
‣ develop
Must merge back into:
‣ develop and master
Branch naming convention:
‣ release-*
COMPARING WORKFLOWS - GITFLOW WORKFLOW
MAINTENANCE BRANCHES
64
Maintenance or “hotfix” branches are used to quickly patch production
releases. This is the only branch that should fork directly off of master.
COMPARING WORKFLOWS - GITFLOW WORKFLOW
MAINTENANCE BRANCHES
65
May branch off from:
‣ master
Must merge back into:
‣ develop and master
Branch naming convention:
‣ hotfix-*
SVN TO GIT
SVN TO GIT 67
http://john.albin.net/git/convert-subversion-to-git
1. Retrieve a list of all Subversion committers.
2. Clone the Subversion repository using git-svn.
3. Convert svn:ignore properties to .gitignore.
4. Push repository to a bare git repository.
5. Rename “trunk” branch to “master”
6. Clean up branches and tags.
7. Drink.
GUI CLIENTS
GUI CLIENTS
SOURCETREE
69
Platforms: Mac, Windows | Price: Free
GUI CLIENTS
SMARTGIT
70
Platforms: Windows, Mac, Linux | Price: $79/user / Free for non-commercial use
GUI CLIENTS 71
https://git-scm.com/downloads/guis
The END

Más contenido relacionado

La actualidad más candente

Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial IJim Yeh
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git TutorialSage Sharp
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow Sebin Benjamin
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015mwrather
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & GitJason Byrne
 
GitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.comGitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.comB1 Systems GmbH
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumAbhijitNarayan2
 
Git Terminologies
Git TerminologiesGit Terminologies
Git TerminologiesYash
 
Git Introduction
Git IntroductionGit Introduction
Git IntroductionGareth Hall
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperJohn Stevenson
 

La actualidad más candente (20)

Git and Github
Git and GithubGit and Github
Git and Github
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
GitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.comGitLab as an Alternative Development Platform for Github.com
GitLab as an Alternative Development Platform for Github.com
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Did you git yet?
Did you git yet?Did you git yet?
Did you git yet?
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
 
Git training
Git trainingGit training
Git training
 
Git Terminologies
Git TerminologiesGit Terminologies
Git Terminologies
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
 
Git presentation
Git presentationGit presentation
Git presentation
 
Version controll.pptx
Version controll.pptxVersion controll.pptx
Version controll.pptx
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
 

Destacado

Devoxx France 2015 - Se préparer à l'arrivée d'Angular 2
Devoxx France 2015 - Se préparer à l'arrivée d'Angular 2Devoxx France 2015 - Se préparer à l'arrivée d'Angular 2
Devoxx France 2015 - Se préparer à l'arrivée d'Angular 2Romain Linsolas
 
Git Flow: un processus de développement Agile
Git Flow: un processus de développement AgileGit Flow: un processus de développement Agile
Git Flow: un processus de développement AgileXavier Hausherr
 
Git Ready! Workflows
Git Ready! WorkflowsGit Ready! Workflows
Git Ready! WorkflowsAtlassian
 

Destacado (9)

Git Basic
Git BasicGit Basic
Git Basic
 
Using Git
Using GitUsing Git
Using Git
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
 
Devoxx France 2015 - Se préparer à l'arrivée d'Angular 2
Devoxx France 2015 - Se préparer à l'arrivée d'Angular 2Devoxx France 2015 - Se préparer à l'arrivée d'Angular 2
Devoxx France 2015 - Se préparer à l'arrivée d'Angular 2
 
Tutoriel GIT
Tutoriel GITTutoriel GIT
Tutoriel GIT
 
Git Flow: un processus de développement Agile
Git Flow: un processus de développement AgileGit Flow: un processus de développement Agile
Git Flow: un processus de développement Agile
 
Git flow in action
Git flow in actionGit flow in action
Git flow in action
 
Git Ready! Workflows
Git Ready! WorkflowsGit Ready! Workflows
Git Ready! Workflows
 
Versioning avec Git
Versioning avec GitVersioning avec Git
Versioning avec Git
 

Similar a Git

Presentation on Repository Control System
Presentation on Repository Control SystemPresentation on Repository Control System
Presentation on Repository Control SystemMd. Mujahid Islam
 
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
 
Introduction to GIT Endava 2023
Introduction to GIT Endava 2023Introduction to GIT Endava 2023
Introduction to GIT Endava 2023Alexandru Loghin
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxAbelPhilipJoseph
 
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 ArticlePRIYATHAMDARISI
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubDSC GVP
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 
Git for developers
Git for developersGit for developers
Git for developersHacen Dadda
 
Rc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocidoRc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocidoLuis Bertel
 
introduction in version control system
introduction in version control systemintroduction in version control system
introduction in version control systemBiga Gaber
 

Similar a Git (20)

Git and Github
Git and GithubGit and Github
Git and Github
 
Presentation on Repository Control System
Presentation on Repository Control SystemPresentation on Repository Control System
Presentation on Repository Control System
 
Git and github
Git and githubGit and github
Git and github
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Introduction to GIT Endava 2023
Introduction to GIT Endava 2023Introduction to GIT Endava 2023
Introduction to GIT Endava 2023
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
 
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
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
setting up a repository using GIT
setting up a repository using GITsetting up a repository using GIT
setting up a repository using GIT
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git Training
Git TrainingGit Training
Git Training
 
Git overview
Git overviewGit overview
Git overview
 
1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx
 
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
 
Rc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocidoRc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocido
 
introduction in version control system
introduction in version control systemintroduction in version control system
introduction in version control system
 

Último

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Git

  • 2. WHAT IS VERSION CONTROL?
  • 3. WHAT IS VERSION CONTROL? Version control systems are a category of software tools that help a software team manage changes to source code over time. Version control software keeps track of every modification to the code in a special kind of database. ▸ Benefits of version control A complete long-term change history of every file Branching and merging Traceability 3
  • 4. WHAT IS VERSION CONTROL? LOCAL VERSION CONTROL SYSTEMS 4
  • 5. WHAT IS VERSION CONTROL? CENTRALIZED VERSION CONTROL SYSTEMS 5
  • 6. WHAT IS VERSION CONTROL? DISTRIBUTED VERSION CONTROL SYSTEMS 6
  • 8. WHAT IS GIT? ▸ Git was initially designed and developed in 2005 by Linux kernel developers (including Linus Torvalds) for Linux kernel development. ▸ Having a distributed architecture. Rather than have only one single place for the full version history of the software as is common in once- popular version control systems like CVS or Subversion. 8
  • 10. GIT VS SUBVERSION PERFORMANCESeconds 0 350 700 1050 1400 PUSH/COMMIT PULL/CHECKOUT GIT SUBVERSION GIT SUBVERSION 39.1 1,334.8 28.5104.5 Commit and checkout times of a repository of 2757 files and 428 directories, summing up to 26MB. By: http://j.mp/1VY9KIl / CC BY-SA 10
  • 11. GIT SECURITY ▸ Git has been designed with the integrity of managed source code as a top priority. The content of the files as well as the true relationships between files and directories, versions, tags and commits, all of these objects in the Git repository are secured with a cryptographically secure hashing algorithm called SHA1. ▸ Some other version control systems have no protections against secret alteration at a later date. This can be a serious information security vulnerability for any organization that relies on software development. 11
  • 12. GIT IS A DE FACTO STANDARD ▸ The predominance of Git also means that many third party software tools and services are already integrated with Git including IDEs and tools like DVCS desktop clients: ▸ SourceTree (Windows/Mac) ▸ SmartGit (Windows/Linux/Mac) ▸ issue and project tracking software: ▸ JIRA ▸ and code hosting services ▸ GitHub ▸ Bitbucket 12
  • 13. GIT VS SUBVERSION. GOOGLE TRENDS Interest over Time (Git vs Subversion) http://j.mp/23K41sb / Google Trends 13
  • 15. SETTING UP A REPOSITORY INSTALLING GIT ▸ Linux: apt-get/yum/dnf/zypper install git ▸ Windows and Mac OS X https://git-scm.com/downloads 15
  • 16. SETTING UP A REPOSITORY git config The git config command lets you configure your Git installation from the command line. This command can define everything from user info to preferences to the behavior of a repository. ‣ git config --global user.name <name> ‣ git config --global user.email <email> ‣ git config --global alias.<alias-name> <git-command> ‣ git config --system core.editor <editor> ‣ git config --list 16
  • 17. SETTING UP A REPOSITORY git init <directory> ‣ The git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new empty repository. Most of the other Git commands are not available outside of an initialized repository, so this is usually the first command you’ll run in a new project. ‣ Executing git init creates a .git subdirectory in the project root, which contains all of the necessary metadata for the repo. Aside from the .git directory, an existing project remains unaltered (unlike SVN, Git doesn't require a .git folder in every subdirectory). 17
  • 18. SETTING UP A REPOSITORY git clone <repo> ‣ The git clone command copies an existing Git repository. This is sort of like svn checkout, except the “working copy” is a full- fledged Git repository—it has its own history, manages its own files, and is a completely isolated environment from the original repository. ‣ The original repository can be located on the local filesystem or on a remote machine accessible via HTTP or SSH. 18
  • 20. SAVING CHANGES - SNAPSHOTS, NOT DIFFERENCES 20
  • 21. SAVING CHANGES - SNAPSHOTS, NOT DIFFERENCES Storing data as changes to a base version of each file Storing data as snapshots of the project over time 20
  • 22. SAVING CHANGES - THE THREE STATES ▸ Committed Committed means that the data is safely stored in your local database. ▸ Modified Modified means that you have changed the file but have not committed it to your database yet. ▸ Staged Staged means that you have marked a modified file in its current version to go into your next commit snapshot. 21
  • 23. SAVING CHANGES - THE THREE STATES Working directory, staging area, and Git directory 22
  • 24. SAVING CHANGES git add <file/directory/.> ‣ The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit. However, git add doesn't really affect the repository in any significant way—changes are not actually recorded until you run git commit. ‣ In conjunction with these commands, you'll also need git status to view the state of the working directory and the staging area. 23
  • 25. SAVING CHANGES - CHECKING THE STATUS OF YOUR FILES $ git status On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean 24
  • 26. SAVING CHANGES - CHECKING THE STATUS OF YOUR FILES $ echo 'My Project' > README $ git status On branch master Your branch is up-to-date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) README nothing added to commit but untracked files present (use "git add" to track) 25
  • 27. SAVING CHANGES - CHECKING THE STATUS OF YOUR FILES $ git add README $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: README 26
  • 28. SAVING CHANGES IGNORING FILES ▸ From time to time, there are files you don't want Git to check in. ▸ If you create a file in your repository named .gitignore, Git uses it to determine which files and directories to ignore, before you make a commit. $ cat .gitignore *.[oa] log/*.log 27
  • 29. SAVING CHANGES git commit The git commit command commits the staged snapshot to the local repository. Git will never change them unless you explicity ask it to. Along with git add, this is one of the most important Git commands. This command is nothing like svn commit. $ git commit -m "Story 182: Fix benchmarks for speed" [master 463dc4f] Story 182: Fix benchmarks for speed 2 files changed, 2 insertions(+) create mode 100644 README 28
  • 30. SAVING CHANGES A commit and its tree 29
  • 31. SAVING CHANGES git checkout The git checkout command serves three distinct functions: checking out files, checking out commits, and checking out branches $ git checkout <branch> $ git checkout <commit> <file> $ git checkout <commit> 30
  • 32. SAVING CHANGES git revert <commit> The git revert command undoes a committed snapshot. But, instead of removing the commit from the project history, it figures out how to undo the changes introduced by the commit and appends a new commit with the resulting content. 31
  • 33. SAVING CHANGES git revert <commit> The git revert command undoes a committed snapshot. But, instead of removing the commit from the project history, it figures out how to undo the changes introduced by the commit and appends a new commit with the resulting content. ResettingReverting 31
  • 34. SYNCING git fetch <remote> <branch> ‣ The git fetch command imports commits from a remote repository into your local repo. The resulting commits are stored as remote branches instead of the normal local branches that we’ve been working with. ‣ Fetching is what you do when you want to see what everybody else has been working on. Since fetched content is represented as a remote branch, it has absolutely no effect on your local development work. 32
  • 35. SYNCING git pull <remote> ‣ Merging upstream changes into your local repository is a common task in Git-based collaboration workflows. ‣ You can think of git pull as Git's version of svn update. It’s an easy way to synchronize your local repository with upstream changes. 33
  • 39. SYNCING git push <remote> <branch> ‣ Pushing is how you transfer commits from your local repository to a remote repo. It's the counterpart to git fetch, but whereas fetching imports commits to local branches, pushing exports commits to remote branches. ‣ After you’ve accumulated several local commits and are ready to share them with the rest of the team 35
  • 40. SYNCING git tag -a <tag> ‣ Like most VCSs, Git has the ability to tag specific points in history as being important. Typically people use this functionality to mark release points (v1.0, and so on). ‣ Git uses two main types of tags: lightweight and annotated. 36
  • 43. USING BRANCHES git branch ‣ In Git, branches are a part of your everyday development process. When you want to add a new feature or fix a bug—no matter how big or how small—you spawn a new branch to encapsulate your changes. This makes sure that unstable code is never committed to the main code base ‣ A branch represents an independent line of development. Branches serve as an abstraction for the edit/stage/commit. ‣ The git branch command lets you create, list, rename, and delete branches 39
  • 46. USING BRANCHES git merge <branch> ‣ Merging is Git's way of putting a forked history back together again. ‣ The git merge command lets you take the independent lines of development created by git branch and integrate them into a single branch. 41
  • 49. COMPARING WORKFLOWS CENTRALIZED WORKFLOW 44 Like Subversion, the Centralized Workflow uses a central repository to serve as the single point-of-entry for all changes to the project. Instead of trunk, the default development branch is called master and all changes are committed into this branch. This workflow doesn’t require any other branches besides master
  • 50. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW SOMEONE INITIALIZES THE CENTRAL REPOSITORY 45 $ ssh user@host git init --bare /path/to/repo.git
  • 51. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW EVERYBODY CLONES THE CENTRAL REPOSITORY 46 $ git clone ssh://user@host/path/to/repo.git
  • 52. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW JOHN AND MARY WORK ON THEIR FEATURES 47 $ git status # View the state of the repo $ git add <some-file> # Stage a file $ git commit # Commit a file</some-file>
  • 53. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW JOHN AND MARY WORK ON THEIR FEATURES 47 $ git push origin master
  • 54. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW MARY TRIES TO PUBLISH HER FEATURE 48 $ git push origin master
  • 55. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW MARY TRIES TO PUBLISH HER FEATURE 48 $ git push origin master error: failed to push some refs to '/path/to/repo.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') hint: before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  • 56. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW MARY REBASES ON TOP OF JOHN’S COMMIT(S) 49 $ git pull --rebase origin master
  • 57. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW MARY REBASES ON TOP OF JOHN’S COMMIT(S) 49 $ git pull --rebase origin master
  • 58. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW MARY RESOLVES A MERGE CONFLICT 50 CONFLICT (content): Merge conflict in <some-file>
  • 59. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW MARY RESOLVES A MERGE CONFLICT 51 $ git status
  • 60. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW MARY RESOLVES A MERGE CONFLICT 51 $ git status # Unmerged paths: # (use "git reset HEAD <some-file>..." to unstage) # (use "git add/rm <some-file>..." as appropriate to mark resolution) # # both modified: <some-file>
  • 61. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW MARY RESOLVES A MERGE CONFLICT 52 #! /usr/bin/env ruby def hello <<<<<<< HEAD puts 'hola world' ======= puts 'hello mundo' >>>>>>> master end hello()
  • 62. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW MARY RESOLVES A MERGE CONFLICT 52 #! /usr/bin/env ruby def hello puts 'hola world' end hello() $ git add <some-file> $ git rebase --continue $ git rebase --abort
  • 63. COMPARING WORKFLOWS - CENTRALIZED WORKFLOW MARY SUCCESSFULLY PUBLISHES HER FEATURE 53 $ git push origin master
  • 64. COMPARING WORKFLOWS FEATURE BRANCH WORKFLOW 54 The core idea behind the Feature Branch Workflow is that all feature development should take place in a dedicated branch instead of the master branch. This encapsulation makes it easy for multiple developers to work on a particular feature without disturbing the main codebase. It also means the master branch will never contain broken code, which is a huge advantage for c o n t i n u o u s i n t e g r a t i o n environments.
  • 65. COMPARING WORKFLOWS - FEATURE BRANCH WORKFLOW MARY BEGINS A NEW FEATURE 55 $ git checkout -b marys-feature master $ git status $ git add <some-file> $ git commit
  • 66. COMPARING WORKFLOWS - FEATURE BRANCH WORKFLOW MARY MAKES THE CHANGES 56 $ git push -u origin marys-feature
  • 67. COMPARING WORKFLOWS - FEATURE BRANCH WORKFLOW MARY PUBLISHES HER FEATURE 57 $ git checkout master $ git pull $ git pull origin marys-feature $ git push
  • 68. COMPARING WORKFLOWS GITFLOW WORKFLOW 58 The Gitflow Workflow defines a strict branching model designed around the project release. While somewhat more complicated than the Feature Branch Workflow, this provides a robust framework for managing larger projects. This workflow doesn’t add any new concepts or commands beyond what’s required for the Feature Branch Workflow. Instead, it assigns very specific roles to different branches and defines how and when they should interact. by Vincent Driessen | http://j.mp/1YLriqr
  • 69. COMPARING WORKFLOWS - GITFLOW WORKFLOW HISTORICAL BRANCHES 59 The master branch stores the official release history, and the develop branch serves as an integration branch for features.
  • 70. COMPARING WORKFLOWS - GITFLOW WORKFLOW FEATURE BRANCHES 60 Each new feature instead of branching off of master, feature branches use develop as their parent branch
  • 71. COMPARING WORKFLOWS - GITFLOW WORKFLOW FEATURE BRANCHES 61 May branch off from: ‣ develop Must merge back into: ‣ develop Branch naming convention: ‣ anything except master, develop, release-*, or hotfix-*
  • 72. COMPARING WORKFLOWS - GITFLOW WORKFLOW RELEASE BRANCHES 62 Once develop has acquired enough features for a release, you fork a release branch off of develop.
  • 73. COMPARING WORKFLOWS - GITFLOW WORKFLOW RELEASE BRANCHES 63 May branch off from: ‣ develop Must merge back into: ‣ develop and master Branch naming convention: ‣ release-*
  • 74. COMPARING WORKFLOWS - GITFLOW WORKFLOW MAINTENANCE BRANCHES 64 Maintenance or “hotfix” branches are used to quickly patch production releases. This is the only branch that should fork directly off of master.
  • 75. COMPARING WORKFLOWS - GITFLOW WORKFLOW MAINTENANCE BRANCHES 65 May branch off from: ‣ master Must merge back into: ‣ develop and master Branch naming convention: ‣ hotfix-*
  • 77. SVN TO GIT 67 http://john.albin.net/git/convert-subversion-to-git 1. Retrieve a list of all Subversion committers. 2. Clone the Subversion repository using git-svn. 3. Convert svn:ignore properties to .gitignore. 4. Push repository to a bare git repository. 5. Rename “trunk” branch to “master” 6. Clean up branches and tags. 7. Drink.
  • 80. GUI CLIENTS SMARTGIT 70 Platforms: Windows, Mac, Linux | Price: $79/user / Free for non-commercial use