SlideShare une entreprise Scribd logo
1  sur  38
Introduction to
Git
@parallelit
(part 1)
Agenda
• Git References
• SourceTree configuration
• Git history
• working directory, Git
directory, staging area
• File Status Lifecycle
• git init, clone, checkout, add,
commit, blame, log, status,
pull, fetch, push, archive
• gitignore
• Git in action
• HEAD or head?
• Fast-forward Merge
• Tracked branches
• Tagging
• git commit --amend
Git References
• https://www.atlassian.com/git/
• https://git-scm.com/documentation
• http://www.vogella.com/tutorials/Git/article.html
Git history
• Git repository is one giant graph
• Node := a Git commit is a node in a graph
SourceTree configuration (1)
• Fullname
• Email address
• Project folder
SourceTree configuration (2)
• Visual Diff Tool
• Merge Tool
What is a branch?
A branch represents an independent line of
development.
• git init := Create an empty Git repository or
reinitialize an existing one
• git clone := Clone a repository into a new
directory from remote Git server
• git checkout := Switch branches or restore
working tree files
• git add := Add file contents to the index (staging
area)
• git commit := Record changes to the repository
Directory
Git doesn’t track directories, it tracks files, so to
acheive this you need to track at least one file
• working directory := A folder that contains an
initialized GIT repository
• Git directory := It’s contained in working directory
and it’s called “.git”. In the Git directory there are
files and folders that compose our repository
• staging area := The staging area is a file, generally
contained in your Git directory, that stores
information about what will go into your next
commit. It’s sometimes referred to as the “index”,
but it’s also common to refer to it as the staging
area.
• git blame := Show what revision and author last
modified each line of a file
• git log := Show commit logs
• git status := Show the working tree status
• git pull := Fetch from and integrate with another
repository or a local branch (fetch + merge)
• git fetch := Download objects and refs from
another repository
• git push := Update remote refs along with
associated objects
• git archive := Create an archive of files from a
named tree
.gitignore (1)
• A gitignore file specifies intentionally untracked
files that Git should ignore.
• Files already tracked by Git are not affected.
• Each line in a gitignore file specifies a pattern.
• Three levels: $GIT_DIR, $HOME,
$WORKING_DIR
.gitignore (2)
composer.phar
*.log
wp-content/uploads/
config/autoload/*.local.php
/bin/*
.gitignore (3)
• http://git-scm.com/docs/gitignore
• https://github.com/github/gitignore
• https://www.gitignore.io/
Git in action
HEAD o head?
• A head is simply a reference to a commit object. Each
head has a name (branch name or tag name, etc). By
default, there is a head in every repository called
master. A repository can contain any number of heads.
At any given time, one head is selected as the “current
head”. This head is aliased to HEAD, always in
capitals.
• Note this difference: a “head” (lowercase) refers to any
one of the named heads in the repository;
“HEAD” (uppercase) refers exclusively to the currently
active head. This distinction is used frequently in Git
documentation.
Fast-forward Git merge (1)
Merging a branch is a pretty common operation
when using Git.
In some circumstances, Git by default will try to
merge a branch in a fast-forward mode.
Fast-forward Git merge (2)
Let us assume that I created
a feature branch named test
from the current master. After
working on this branch for a
while, I finally decided that I
am done and then I pushed it
to my own remote.
Meanwhile, nothing else
happened in the master
branch, it remained in the
same state right before I
branched off.
master
feature/test
3 commit
Fast-forward Git merge (3)
Once my branch is ready to be
integrated, we might use the
usual steps of git fetch followed
by git merge (git pull). Because
master has not been changed
since the commit (gray circle)
which serves as the base for
the said topic branch, Git will
perform the merge using fast-
forward. The whole series of the
commits will be linear. The
history will look like the
diagram on the right.
Fast-forward Git merge (4)
Another variant of the merge is
to use -no-ff option (no fast-
forward). In this case, the
history looks slightly different,
there is an additional commit
(dotted circle) emphasizing the
merge. This commit even has
the right message informing
us about the merged branch.
The default behaviour of Git is
to use fast-forwarding
whenever possible.
merge
Introducing Tracked branches
(Local and remote branches)
• A local branch is a branch that only you (the local user) can
see. It exists only on your local machine.
• If you're using Git collaboratively, you'll probably need to sync
your commits with other machines or locations. Each machine
or location is called a remote, in Git's terminology, and each
one may have one or more branches. Most often, you'll just
have one, named origin.
• A remote branch was once a local branch that was pushed to
origin. In other words now every user has access to it.
• A local tracking branch on the other hand is a branch that is a
local image of the remote branch (think of it as your copy of the
remote branch).
Tracked branches (1)
(Remote tracking branch)
• Each branch has the concept of what it is
tracking. As well as the branches that will be
affected by a fetch/pull/push, tracking says
which branch is upstream of which.
• Normally, branches checked out of a remote
repository are automatically set up as tracking
branches.
Tracked branches (2)
(Remote tracking branch)
• They’re used to link what you’re working on
locally compared to what’s on the remote.
• They will automatically know what remote
branch to get changes from when you use git
pull/fetch/push.
• Even better, git status will recognize him how
many commits you are in front of the remote
version of the branch.
Tagging (1)
• Git has the ability to tag specific points in history as
being important. Typically people use this functionality to
mark release points.
• Git uses two main types of tags: lightweight and
annotated.
• A lightweight tag is very much like a branch that doesn’t
(shouldn’t) change. It’s just a pointer to a specific commit.
• Annotated tags, however, are stored as full objects in the
Git database. They contain the tagger name, email, and
date and they have a tagging message.
Tagging (2)
• By default, the git push command doesn’t
transfer tags to remote servers.
• By default, SourceTree transfers tags to remote
servers (Look at push all tags checkbox on
push window).
git commit --amend (1)
The git commit --amend command is a convenient
way to fix up the most recent commit.
It lets you combine staged changes with the
previous commit instead of committing it as an
entirely new snapshot.
It can also be used to simply edit the previous
commit message without changing its snapshot.
git commit --amend (2)
But, amending
doesn’t just alter the
most recent commit. It
replaces it entirely. To
Git, it will look like a
brand new commit,
which is visualized
with an asterisk (*) in
the diagram.
*
Initial history
Amended history
git commit --amend (3)
Never amend commits that have been pushed to a
public repository.
Coming next
• Reset (soft, mixed, hard)
• Rebase
• Checkout
• Revert
• Branching
• Merging
• Gitflow Workflow
• GitHub Flow
http://sal.va.it/1LNuBGx
Download these slides on

Contenu connexe

Tendances

Learning git
Learning gitLearning git
Learning gitSid Anand
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsCarl Brown
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Intro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostIntro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostAndrew Kerr
 
Git, from the beginning
Git, from the beginningGit, from the beginning
Git, from the beginningJames Aylett
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash CourseNilay Binjola
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitE Carter
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitLukas Fittl
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubVenkat Malladi
 

Tendances (20)

git and github
git and githubgit and github
git and github
 
Learning git
Learning gitLearning git
Learning git
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git 101
Git 101Git 101
Git 101
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Bitbucket
BitbucketBitbucket
Bitbucket
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Intro to Git, GitHub, and Devpost
Intro to Git, GitHub, and DevpostIntro to Git, GitHub, and Devpost
Intro to Git, GitHub, and Devpost
 
Git, from the beginning
Git, from the beginningGit, from the beginning
Git, from the beginning
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Inside GitHub with Chris Wanstrath
Inside GitHub with Chris WanstrathInside GitHub with Chris Wanstrath
Inside GitHub with Chris Wanstrath
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git basics
Git basicsGit basics
Git basics
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 

En vedette

eBay Selling Secrets Revealed
eBay Selling Secrets RevealedeBay Selling Secrets Revealed
eBay Selling Secrets Revealeddenlu244
 
5-Hour Gamification Workshop for eBay
5-Hour Gamification Workshop for eBay5-Hour Gamification Workshop for eBay
5-Hour Gamification Workshop for eBayYu-kai Chou
 
Gitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeGitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeTeerapat Khunpech
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGeoff Hoffman
 
Introduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideIntroduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideRohit Arora
 
ROLE OF EXPORT MARKETING IN INTERNATIONAL TRADE
ROLE OF EXPORT MARKETING IN INTERNATIONAL TRADEROLE OF EXPORT MARKETING IN INTERNATIONAL TRADE
ROLE OF EXPORT MARKETING IN INTERNATIONAL TRADEsushmitha7
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners HubSpot
 
The 150 Most Powerful Marketing & Sales Tools
The 150 Most Powerful Marketing & Sales ToolsThe 150 Most Powerful Marketing & Sales Tools
The 150 Most Powerful Marketing & Sales ToolsBrian Downard
 

En vedette (9)

eBay Selling Secrets Revealed
eBay Selling Secrets RevealedeBay Selling Secrets Revealed
eBay Selling Secrets Revealed
 
Gitlab
GitlabGitlab
Gitlab
 
5-Hour Gamification Workshop for eBay
5-Hour Gamification Workshop for eBay5-Hour Gamification Workshop for eBay
5-Hour Gamification Workshop for eBay
 
Gitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTreeGitlab Training with GIT and SourceTree
Gitlab Training with GIT and SourceTree
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Introduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideIntroduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guide
 
ROLE OF EXPORT MARKETING IN INTERNATIONAL TRADE
ROLE OF EXPORT MARKETING IN INTERNATIONAL TRADEROLE OF EXPORT MARKETING IN INTERNATIONAL TRADE
ROLE OF EXPORT MARKETING IN INTERNATIONAL TRADE
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
The 150 Most Powerful Marketing & Sales Tools
The 150 Most Powerful Marketing & Sales ToolsThe 150 Most Powerful Marketing & Sales Tools
The 150 Most Powerful Marketing & Sales Tools
 

Similaire à Introduction to Git (part 1)

Git slides
Git slidesGit slides
Git slidesNanyak S
 
11 git version control
11 git version control11 git version control
11 git version controlWasim Alatrash
 
GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016Peter Denev
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of GitDivineOmega
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Ahmed El-Arabawy
 
Git Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of GitGit Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of GitNicola Costantino
 
Git tutorial git branches 20131206-Bryan
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-BryanLearningTech
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubDSC GVP
 
An introduction to Git
An introduction to GitAn introduction to Git
An introduction to GitMuhil Vannan
 
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
 
Git_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_GuidewireGit_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_GuidewireGandhi Ramu
 

Similaire à Introduction to Git (part 1) (20)

Git slides
Git slidesGit slides
Git slides
 
Introduction to Git (part 2)
Introduction to Git (part 2)Introduction to Git (part 2)
Introduction to Git (part 2)
 
11 git version control
11 git version control11 git version control
11 git version control
 
GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016GIT_training_SoftServeBulgaria2016
GIT_training_SoftServeBulgaria2016
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Mastering GIT
Mastering GITMastering GIT
Mastering GIT
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of Git
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
 
Git Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of GitGit Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of Git
 
Git 101
Git 101Git 101
Git 101
 
Git tutorial git branches 20131206-Bryan
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-Bryan
 
Gitlikeapro 2019
Gitlikeapro 2019Gitlikeapro 2019
Gitlikeapro 2019
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
Intro to Git
Intro to GitIntro to Git
Intro to Git
 
An introduction to Git
An introduction to GitAn introduction to Git
An introduction to Git
 
Git more done
Git more doneGit more done
Git more done
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Git_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_GuidewireGit_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_Guidewire
 

Plus de Salvatore Cordiano

Transformed: Moving to the Product Operating Model
Transformed: Moving to the Product Operating ModelTransformed: Moving to the Product Operating Model
Transformed: Moving to the Product Operating ModelSalvatore Cordiano
 
Executive Master in Business Administration
Executive Master in Business AdministrationExecutive Master in Business Administration
Executive Master in Business AdministrationSalvatore Cordiano
 
Facile.it Partner 🚀 Hackathon 2023 - What we learned
Facile.it Partner 🚀 Hackathon 2023 - What we learnedFacile.it Partner 🚀 Hackathon 2023 - What we learned
Facile.it Partner 🚀 Hackathon 2023 - What we learnedSalvatore Cordiano
 
Accrescere la motivazione per raggiungere gli obiettivi
Accrescere la motivazione per raggiungere gli obiettiviAccrescere la motivazione per raggiungere gli obiettivi
Accrescere la motivazione per raggiungere gli obiettiviSalvatore Cordiano
 
Migliora le prestazioni dei tuoi collaboratori
Migliora le prestazioni dei tuoi collaboratoriMigliora le prestazioni dei tuoi collaboratori
Migliora le prestazioni dei tuoi collaboratoriSalvatore Cordiano
 
Delivering Effective Feedback - FP Talks
Delivering Effective Feedback - FP TalksDelivering Effective Feedback - FP Talks
Delivering Effective Feedback - FP TalksSalvatore Cordiano
 
No Silver Bullet - Essence and Accident in Software Engineering
No Silver Bullet - Essence and Accident in Software EngineeringNo Silver Bullet - Essence and Accident in Software Engineering
No Silver Bullet - Essence and Accident in Software EngineeringSalvatore Cordiano
 
Facile.it Partner Hackathon - What we learned
Facile.it Partner Hackathon - What we learnedFacile.it Partner Hackathon - What we learned
Facile.it Partner Hackathon - What we learnedSalvatore Cordiano
 
FP Hackathon - Closing, remarks and awards ceremony
FP Hackathon - Closing, remarks and awards ceremonyFP Hackathon - Closing, remarks and awards ceremony
FP Hackathon - Closing, remarks and awards ceremonySalvatore Cordiano
 
Facile.it Partner Hackathon 2022
Facile.it Partner Hackathon 2022Facile.it Partner Hackathon 2022
Facile.it Partner Hackathon 2022Salvatore Cordiano
 
The Blake Mouton Managerial Grid
The Blake Mouton Managerial GridThe Blake Mouton Managerial Grid
The Blake Mouton Managerial GridSalvatore Cordiano
 
Facile.it Partner Hackathon (kick-off)
Facile.it Partner Hackathon (kick-off)Facile.it Partner Hackathon (kick-off)
Facile.it Partner Hackathon (kick-off)Salvatore Cordiano
 

Plus de Salvatore Cordiano (20)

Transformed: Moving to the Product Operating Model
Transformed: Moving to the Product Operating ModelTransformed: Moving to the Product Operating Model
Transformed: Moving to the Product Operating Model
 
Executive Master in Business Administration
Executive Master in Business AdministrationExecutive Master in Business Administration
Executive Master in Business Administration
 
Facile.it Partner 🚀 Hackathon 2023 - What we learned
Facile.it Partner 🚀 Hackathon 2023 - What we learnedFacile.it Partner 🚀 Hackathon 2023 - What we learned
Facile.it Partner 🚀 Hackathon 2023 - What we learned
 
Accrescere la motivazione per raggiungere gli obiettivi
Accrescere la motivazione per raggiungere gli obiettiviAccrescere la motivazione per raggiungere gli obiettivi
Accrescere la motivazione per raggiungere gli obiettivi
 
Il potere delle domande
Il potere delle domandeIl potere delle domande
Il potere delle domande
 
Impara a delegare
Impara a delegareImpara a delegare
Impara a delegare
 
Migliora il tuo ascolto
Migliora il tuo ascoltoMigliora il tuo ascolto
Migliora il tuo ascolto
 
Negoziazione organizzativa
Negoziazione organizzativaNegoziazione organizzativa
Negoziazione organizzativa
 
Migliora le prestazioni dei tuoi collaboratori
Migliora le prestazioni dei tuoi collaboratoriMigliora le prestazioni dei tuoi collaboratori
Migliora le prestazioni dei tuoi collaboratori
 
Charles Péguy - Il denaro
Charles Péguy - Il denaroCharles Péguy - Il denaro
Charles Péguy - Il denaro
 
Delivering Effective Feedback - FP Talks
Delivering Effective Feedback - FP TalksDelivering Effective Feedback - FP Talks
Delivering Effective Feedback - FP Talks
 
No Silver Bullet - Essence and Accident in Software Engineering
No Silver Bullet - Essence and Accident in Software EngineeringNo Silver Bullet - Essence and Accident in Software Engineering
No Silver Bullet - Essence and Accident in Software Engineering
 
Facile.it Partner Hackathon - What we learned
Facile.it Partner Hackathon - What we learnedFacile.it Partner Hackathon - What we learned
Facile.it Partner Hackathon - What we learned
 
FP Hackathon - Closing, remarks and awards ceremony
FP Hackathon - Closing, remarks and awards ceremonyFP Hackathon - Closing, remarks and awards ceremony
FP Hackathon - Closing, remarks and awards ceremony
 
Facile.it Partner Hackathon 2022
Facile.it Partner Hackathon 2022Facile.it Partner Hackathon 2022
Facile.it Partner Hackathon 2022
 
Remarks about Ownership
Remarks about OwnershipRemarks about Ownership
Remarks about Ownership
 
Introducing Kaizen
Introducing KaizenIntroducing Kaizen
Introducing Kaizen
 
Introducing Eisenhower Matrix
Introducing Eisenhower MatrixIntroducing Eisenhower Matrix
Introducing Eisenhower Matrix
 
The Blake Mouton Managerial Grid
The Blake Mouton Managerial GridThe Blake Mouton Managerial Grid
The Blake Mouton Managerial Grid
 
Facile.it Partner Hackathon (kick-off)
Facile.it Partner Hackathon (kick-off)Facile.it Partner Hackathon (kick-off)
Facile.it Partner Hackathon (kick-off)
 

Dernier

WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 

Dernier (20)

WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

Introduction to Git (part 1)

  • 2. Agenda • Git References • SourceTree configuration • Git history • working directory, Git directory, staging area • File Status Lifecycle • git init, clone, checkout, add, commit, blame, log, status, pull, fetch, push, archive • gitignore • Git in action • HEAD or head? • Fast-forward Merge • Tracked branches • Tagging • git commit --amend
  • 3. Git References • https://www.atlassian.com/git/ • https://git-scm.com/documentation • http://www.vogella.com/tutorials/Git/article.html
  • 4. Git history • Git repository is one giant graph • Node := a Git commit is a node in a graph
  • 5.
  • 6. SourceTree configuration (1) • Fullname • Email address • Project folder
  • 7.
  • 8. SourceTree configuration (2) • Visual Diff Tool • Merge Tool
  • 9. What is a branch? A branch represents an independent line of development.
  • 10. • git init := Create an empty Git repository or reinitialize an existing one • git clone := Clone a repository into a new directory from remote Git server • git checkout := Switch branches or restore working tree files
  • 11. • git add := Add file contents to the index (staging area) • git commit := Record changes to the repository
  • 12. Directory Git doesn’t track directories, it tracks files, so to acheive this you need to track at least one file
  • 13.
  • 14. • working directory := A folder that contains an initialized GIT repository • Git directory := It’s contained in working directory and it’s called “.git”. In the Git directory there are files and folders that compose our repository • staging area := The staging area is a file, generally contained in your Git directory, that stores information about what will go into your next commit. It’s sometimes referred to as the “index”, but it’s also common to refer to it as the staging area.
  • 15.
  • 16. • git blame := Show what revision and author last modified each line of a file • git log := Show commit logs • git status := Show the working tree status
  • 17. • git pull := Fetch from and integrate with another repository or a local branch (fetch + merge) • git fetch := Download objects and refs from another repository • git push := Update remote refs along with associated objects
  • 18. • git archive := Create an archive of files from a named tree
  • 19. .gitignore (1) • A gitignore file specifies intentionally untracked files that Git should ignore. • Files already tracked by Git are not affected. • Each line in a gitignore file specifies a pattern. • Three levels: $GIT_DIR, $HOME, $WORKING_DIR
  • 21. .gitignore (3) • http://git-scm.com/docs/gitignore • https://github.com/github/gitignore • https://www.gitignore.io/
  • 22.
  • 24. HEAD o head? • A head is simply a reference to a commit object. Each head has a name (branch name or tag name, etc). By default, there is a head in every repository called master. A repository can contain any number of heads. At any given time, one head is selected as the “current head”. This head is aliased to HEAD, always in capitals. • Note this difference: a “head” (lowercase) refers to any one of the named heads in the repository; “HEAD” (uppercase) refers exclusively to the currently active head. This distinction is used frequently in Git documentation.
  • 25. Fast-forward Git merge (1) Merging a branch is a pretty common operation when using Git. In some circumstances, Git by default will try to merge a branch in a fast-forward mode.
  • 26. Fast-forward Git merge (2) Let us assume that I created a feature branch named test from the current master. After working on this branch for a while, I finally decided that I am done and then I pushed it to my own remote. Meanwhile, nothing else happened in the master branch, it remained in the same state right before I branched off. master feature/test 3 commit
  • 27. Fast-forward Git merge (3) Once my branch is ready to be integrated, we might use the usual steps of git fetch followed by git merge (git pull). Because master has not been changed since the commit (gray circle) which serves as the base for the said topic branch, Git will perform the merge using fast- forward. The whole series of the commits will be linear. The history will look like the diagram on the right.
  • 28. Fast-forward Git merge (4) Another variant of the merge is to use -no-ff option (no fast- forward). In this case, the history looks slightly different, there is an additional commit (dotted circle) emphasizing the merge. This commit even has the right message informing us about the merged branch. The default behaviour of Git is to use fast-forwarding whenever possible. merge
  • 29. Introducing Tracked branches (Local and remote branches) • A local branch is a branch that only you (the local user) can see. It exists only on your local machine. • If you're using Git collaboratively, you'll probably need to sync your commits with other machines or locations. Each machine or location is called a remote, in Git's terminology, and each one may have one or more branches. Most often, you'll just have one, named origin. • A remote branch was once a local branch that was pushed to origin. In other words now every user has access to it. • A local tracking branch on the other hand is a branch that is a local image of the remote branch (think of it as your copy of the remote branch).
  • 30. Tracked branches (1) (Remote tracking branch) • Each branch has the concept of what it is tracking. As well as the branches that will be affected by a fetch/pull/push, tracking says which branch is upstream of which. • Normally, branches checked out of a remote repository are automatically set up as tracking branches.
  • 31. Tracked branches (2) (Remote tracking branch) • They’re used to link what you’re working on locally compared to what’s on the remote. • They will automatically know what remote branch to get changes from when you use git pull/fetch/push. • Even better, git status will recognize him how many commits you are in front of the remote version of the branch.
  • 32. Tagging (1) • Git has the ability to tag specific points in history as being important. Typically people use this functionality to mark release points. • Git uses two main types of tags: lightweight and annotated. • A lightweight tag is very much like a branch that doesn’t (shouldn’t) change. It’s just a pointer to a specific commit. • Annotated tags, however, are stored as full objects in the Git database. They contain the tagger name, email, and date and they have a tagging message.
  • 33. Tagging (2) • By default, the git push command doesn’t transfer tags to remote servers. • By default, SourceTree transfers tags to remote servers (Look at push all tags checkbox on push window).
  • 34. git commit --amend (1) The git commit --amend command is a convenient way to fix up the most recent commit. It lets you combine staged changes with the previous commit instead of committing it as an entirely new snapshot. It can also be used to simply edit the previous commit message without changing its snapshot.
  • 35. git commit --amend (2) But, amending doesn’t just alter the most recent commit. It replaces it entirely. To Git, it will look like a brand new commit, which is visualized with an asterisk (*) in the diagram. * Initial history Amended history
  • 36. git commit --amend (3) Never amend commits that have been pushed to a public repository.
  • 37. Coming next • Reset (soft, mixed, hard) • Rebase • Checkout • Revert • Branching • Merging • Gitflow Workflow • GitHub Flow