SlideShare a Scribd company logo
1 of 32
Effective Git
Mayank Bairagi
Sr. Software Consultant
Knoldus Software LLP
Agenda
l

Version control system

l

History

l

Diffrent Types of VCS

l

CVCS vs DVCS

l

Introduction : Git

l

Git terminology

l

Installing Server

l

Branching Wizard

l

Demo Time
Verson Control System
l

Version control is like Wikipedia. You check it for

l

What changes people has made.

l

Inspect these changes

l

Contribute your own.
VCS: Properties
l

Versioning

l

History

l

Collaboration

l

Deletion
Brief History : VCS
Revision Control System : This was the first version control
system , Introduced in early 1980's. A directory of source code
could contains many RCS repositories. Each repository
concerning itself with a single file.
Concurrent Versioned System. : It allowed multiple users to
contribute on a project. It is collection of multiple RCV repository
with network awareness. Dealing with directories was still very
difficult and different then Unix file system.
SubVersion (SVN) : It improved CVS by providing better solution
for directory , history , deletion management.
Centralized VCS

“Centralized version control systems are based on the
idea that there is a single “central” copy of your project
somewhere (probably on a server), and programmers will
“commit” their changes to this central copy.”
SVN : Breif Intro
SVN ..........Continue
Distributed VCS
“distributed revision control system (DVCS) keeps track
of software revisions and allows many developers to
work on a given project without requiring that they
maintain a connection to a common network. It believes
in Peer to Peer approach”
Brief Introduction : GIT
Git is one of the most popular DVCS.
Git was initially designed and developed by Linus Torvalds for
Linux Kernel development in 2005.
Every Git working directory is a full-fledged repository with
complete history and full version tracking capabilities, not
dependent on network access or a central server.
Git is a free software distributed under the term of GNU
General Public License version 2.
Centralized Model
Distributed Model
Distributed Versioning
Multiple Remote Repositories
Git : Terminologies
l

l

l

l

l

Saving State
1 Initialize, add and commit git repo
$ git init
$ git add .
$ git commit -m "My first backup"
Terminology............
Reset : If you have committed junk but not pushed.
$ get reset –hard
reset --hard wipe out all the work and move the head to last
commit. Thus any changes to tracked files in the working tree
since the commit before head are lost.
reset --soft moves the head to specific commit but do not
discard the changes. It will leave all your changed files
"Changes to be committed", as git status would put it.
Terminology............
Reset : If you have committed junk but not pushed.
$ get reset –hard
reset --hard wipe out all the work and move the head to last
commit. Thus any changes to tracked files in the working tree
since the commit before head are lost.
reset --soft moves the head to specific commit but do not
discard the changes. It will leave all your changed files
"Changes to be committed", as git status would put it.
Terminology............
checkout : If you want to switch to old state briefly.
$ git checkout 7554b6
This takes you back in time, while preserving newer commits.
However, like time travel in a science-fiction movie, if you now edit
and commit, you will be in an alternate reality, because your actions
are different to what they were the first time around.
Terminology............

l

$git revert HEAD

revert : If you have committed the just and pushed it as well. This will
create a new commit that reverses everything introduced by the
accidental commit.
Terminology............
$ git rebase -i HEAD~10
Remove commits by deleting lines. Like the revert command, but off
the record: it will be as if the commit never existed.
Reorder commits by reordering lines.
Replace pick with:
edit to mark a commit for amending.
reword to change the log message.
squash to merge a commit with the previous one.
fixup to merge a commit with the previous one and discard the log
message
Terminology............
l

l

$ git stash
$ git stash apply
Terminology............
l

l

l

l

l

l

What you have done ?
$ git diff
Since yesterday
$ git diff @{yesterday}
Bitween perticular version and 2 version ago
$ git diff 2b27 "master~2"
Installing GIT
Creating bare repository
$ git –bare init
Cloning the repository
git clone ssh://user@server.com/~/myrepo.git
Do Some Work and Push to Repo
$git push -u origin <branch-name>
Pull before changing the code
Or
Be Ready For Conflicts
Branching
Creating a branch
$ git branch <branch-name>
Creating a new branch from parent ( commit , branch or tag) and switch
to newly created branch
$ git checkout -b <branch-name> <parent>
Alice and Bob's Key
Quick Fixes
Merging
no local changes, then the merge is a fast forward
if you do have local changes, Git will automatically merge,
and report any conflicts.
Thank You

More Related Content

What's hot (20)

Latex with git
Latex with gitLatex with git
Latex with git
 
Git
GitGit
Git
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
Gitting out of trouble
Gitting out of troubleGitting out of trouble
Gitting out of trouble
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git 101
Git 101Git 101
Git 101
 
Git and fundamentals
Git and fundamentalsGit and fundamentals
Git and fundamentals
 
Git - The Incomplete Introduction
Git - The Incomplete IntroductionGit - The Incomplete Introduction
Git - The Incomplete Introduction
 
Basic Git
Basic GitBasic Git
Basic Git
 
Git commands
Git commandsGit commands
Git commands
 
Collaboration With Git and GitHub
Collaboration With Git and GitHubCollaboration With Git and GitHub
Collaboration With Git and GitHub
 
Introducción a Git
Introducción a GitIntroducción a Git
Introducción a Git
 
Git (Sistema Distribuido de Control de Versiones)
Git (Sistema Distribuido de Control de Versiones)Git (Sistema Distribuido de Control de Versiones)
Git (Sistema Distribuido de Control de Versiones)
 
Tài liệu sử dụng GitHub
Tài liệu sử dụng GitHubTài liệu sử dụng GitHub
Tài liệu sử dụng GitHub
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
 
آموزش کار با GIT
آموزش کار با GITآموزش کار با GIT
آموزش کار با GIT
 
Git basic
Git basicGit basic
Git basic
 

Similar to Knolx master-slides

Similar to Knolx master-slides (20)

Git introduction
Git introductionGit introduction
Git introduction
 
Exprimiendo GIT
Exprimiendo GITExprimiendo GIT
Exprimiendo GIT
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 
Learning git
Learning gitLearning git
Learning git
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
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
 
Git for developers
Git for developersGit for developers
Git for developers
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
Git and github
Git and githubGit and github
Git and github
 
Git like a pro EDD18 - Full edition
Git like a pro EDD18 - Full editionGit like a pro EDD18 - Full edition
Git like a pro EDD18 - Full edition
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
Git for a newbie
Git for a newbieGit for a newbie
Git for a newbie
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Git and Github
Git and GithubGit and Github
Git and Github
 
GIT Basics
GIT BasicsGIT Basics
GIT Basics
 
setting up a repository using GIT
setting up a repository using GITsetting up a repository using GIT
setting up a repository using GIT
 
Version control with GIT
Version control with GITVersion control with GIT
Version control with GIT
 

Recently uploaded

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 

Recently uploaded (20)

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 

Knolx master-slides

  • 1. Effective Git Mayank Bairagi Sr. Software Consultant Knoldus Software LLP
  • 2. Agenda l Version control system l History l Diffrent Types of VCS l CVCS vs DVCS l Introduction : Git l Git terminology l Installing Server l Branching Wizard l Demo Time
  • 3. Verson Control System l Version control is like Wikipedia. You check it for l What changes people has made. l Inspect these changes l Contribute your own.
  • 5. Brief History : VCS Revision Control System : This was the first version control system , Introduced in early 1980's. A directory of source code could contains many RCS repositories. Each repository concerning itself with a single file. Concurrent Versioned System. : It allowed multiple users to contribute on a project. It is collection of multiple RCV repository with network awareness. Dealing with directories was still very difficult and different then Unix file system. SubVersion (SVN) : It improved CVS by providing better solution for directory , history , deletion management.
  • 6. Centralized VCS “Centralized version control systems are based on the idea that there is a single “central” copy of your project somewhere (probably on a server), and programmers will “commit” their changes to this central copy.”
  • 7. SVN : Breif Intro
  • 9. Distributed VCS “distributed revision control system (DVCS) keeps track of software revisions and allows many developers to work on a given project without requiring that they maintain a connection to a common network. It believes in Peer to Peer approach”
  • 10. Brief Introduction : GIT Git is one of the most popular DVCS. Git was initially designed and developed by Linus Torvalds for Linux Kernel development in 2005. Every Git working directory is a full-fledged repository with complete history and full version tracking capabilities, not dependent on network access or a central server. Git is a free software distributed under the term of GNU General Public License version 2.
  • 15. Git : Terminologies l l l l l Saving State 1 Initialize, add and commit git repo $ git init $ git add . $ git commit -m "My first backup"
  • 16. Terminology............ Reset : If you have committed junk but not pushed. $ get reset –hard reset --hard wipe out all the work and move the head to last commit. Thus any changes to tracked files in the working tree since the commit before head are lost. reset --soft moves the head to specific commit but do not discard the changes. It will leave all your changed files "Changes to be committed", as git status would put it.
  • 17. Terminology............ Reset : If you have committed junk but not pushed. $ get reset –hard reset --hard wipe out all the work and move the head to last commit. Thus any changes to tracked files in the working tree since the commit before head are lost. reset --soft moves the head to specific commit but do not discard the changes. It will leave all your changed files "Changes to be committed", as git status would put it.
  • 18. Terminology............ checkout : If you want to switch to old state briefly. $ git checkout 7554b6 This takes you back in time, while preserving newer commits. However, like time travel in a science-fiction movie, if you now edit and commit, you will be in an alternate reality, because your actions are different to what they were the first time around.
  • 19. Terminology............ l $git revert HEAD revert : If you have committed the just and pushed it as well. This will create a new commit that reverses everything introduced by the accidental commit.
  • 20. Terminology............ $ git rebase -i HEAD~10 Remove commits by deleting lines. Like the revert command, but off the record: it will be as if the commit never existed. Reorder commits by reordering lines. Replace pick with: edit to mark a commit for amending. reword to change the log message. squash to merge a commit with the previous one. fixup to merge a commit with the previous one and discard the log message
  • 22. Terminology............ l l l l l l What you have done ? $ git diff Since yesterday $ git diff @{yesterday} Bitween perticular version and 2 version ago $ git diff 2b27 "master~2"
  • 24. Creating bare repository $ git –bare init
  • 25. Cloning the repository git clone ssh://user@server.com/~/myrepo.git
  • 26. Do Some Work and Push to Repo $git push -u origin <branch-name>
  • 27. Pull before changing the code Or Be Ready For Conflicts
  • 28. Branching Creating a branch $ git branch <branch-name> Creating a new branch from parent ( commit , branch or tag) and switch to newly created branch $ git checkout -b <branch-name> <parent>
  • 31. Merging no local changes, then the merge is a fast forward if you do have local changes, Git will automatically merge, and report any conflicts.

Editor's Notes

  1. $ git –bare init