SlideShare a Scribd company logo
INTRODUCTION TO GIT AND GITHUB
ATIQUE AHMED ZIAD
LEAD DEVELOPER, LEGALX LTD.
MOZILLA REPRESENTATIVE
LET’S DISCUSS SOME ISSUES…
 Can not work parallelly.
 No version controlling.
 Wrestling with bugs.
 Revision is not made easy.
WHAT IS GIT AND GITHUB
“Git is a free and open source distributed version control system
designed to handle everything from small to very large projects
with speed and efficiency.”
“GitHub is a cloud based platform built around the Git tool. It is an
online service that stores code pushed to it from computers
running the Git tool. It offers all of the distributed version control
and source code management functionality of Git as well as adding
its own features.”
A SHORT STORY OF GIT
In 2002, the Linux kernel project began using a proprietary DVCS
called BitKeeper
In 2005, BitKeeper’s free-of-charge status was revoked.
This prompted the Linux development community (and in
particular Linus Torvalds, the creator of Linux) to develop their
own tool.
This gave birth to Git in 2005. It’s amazingly fast, very efficient
with large projects, and it has an incredible branching system for
non-linear development
INSTALLATION OF GIT
 Download Git from https://git-scm.com/downloads
 Downloaded ? Time to install it !
 Verify Git installation.
Git Config
Username config:
Email config:
$ git config --global user.name yourusername
$ git config --global user.email youremail@example.com
$ git
MAKE YOUR FIRST REPOSITORY IN GITHUB
 Open a new repository in Github.
 Choose / create a directory with some files inside it.
Follow the below commands in Terminal / CMD:
This will initialize Git in the directory. A folder named .git has been
created.
The git status command displays the state of the working directory and
the staging area.
$ git init
$ git status
MAKE YOUR FIRST REPOSITORY IN GITHUB
$ git add .
$ git commit –m “commit title”
$ git remote add origin <REMOTE_URL>
$ git push –u origin master
Git add all files
Commit the added files
Set remote repository url (if not set previously)
Push to remote repository
Checkout remote urls
$ git remote -v
CONGRATULATION !
YOU HAVE UPLOADED YOUR FIRST
GIT REPOSITORY.
GIT WORKFLOW
RECORDING CHANGES TO THE REPOSITORY
GIT COMMIT
• A commit in a git repository records a snapshot of all the
files in your directory. It's like a giant copy and paste, but
even better!
• A commit takes all staged changes into it.
$ git commit –m “commit title”
VIEWING COMMIT HISTORY
$ git log
VIEW LOG WITH PATCH AND LAST ENTRIES
$ git log –p -1
-p stands for patch which shows the differences in each commit
-1 used for showing only last one commit
POINTER & HEAD
When you make a commit, Git stores a commit object that contains a pointer
to the snapshot of the content you staged.
How does Git know what branch you’re currently on? It keeps a special pointer
called HEAD.
GIT BRANCHES
Branching means you diverge from the main line of development
and continue to do work without messing with that main line.
• Branches in git are incredibly lightweight.
• They are simply pointers to a specific commit -- nothing more.
• “Killer Feature” of git.
GIT CREATING NEW BRANCH
$ git branch <branch_name>
Here the new branch name is testing
GIT BRANCHES COMMANDS
$ git checkout –b <branch_name>
Opening a new branch and switching to that branch
$ git checkout –d <branch_name>
Deleting a local branch
$ git push <remote_name> –d <branch_name>
Deleting a remote branch
$ git checkout <branch_name>
Switching to a branch
$ git branch
See all branches
GIT MERGE
$ git merge <branch_name>
Fast Forward Merge
IGNORING FILES: .GITINGNORE
GIT MERGE CONFLICT
 When two people edit the same line having different branch with
different commit history.
 If c3 and c4 commit edit the same line & we want to merge iss53
branch into master branch, then the conflict happens.
GIT FORK AND CLONE
$ git clone REMOTE_URL
NOTE: It sets the remote repository URL while performing git clone command.
PULL REQUEST
• Pull request is created by comparing changes in branches.
• Once a pull request is sent, interested parties can review the set
of changes, discuss potential modifications, and even push
follow-up commits if necessary
ISSUES
• Issues are a great way to keep track of tasks.
• Issues can act as more than just a place to report software bugs.
ADD-ONS MOZILLA GITHUB REPOSITORY
 Open source, where anyone can contribute code
 How can one contribute code:
 Fix any mentioned issue in your forked repository
and send a pull request
https://github.com/mozilla/addons-server
HOW WILL YOU COLLABORATIVELY
WORK ON YOUR PROJECT
 Break each features into small piece of work and write them as
issues in GitHub.
 Everytime you work on an issue, you open a new branch and
make a patch on that branch for the issue.
 When you make the patch, send a pull request to master branch
from that branch (that branch where you have made the patch
that fixes the issue)
REFERENCES
• ProGit book – https://git-scm.com/book/en/v2
• Interactive git learning online -
https://learngitbranching.js.org/

More Related Content

What's hot (20)

PPTX
Git basics to advance with diagrams
Dilum Navanjana
 
PDF
Git Version Control System
KMS Technology
 
PDF
Version control system
Andrew Liu
 
PPTX
Introduction to git & GitHub
Poornachandrakashi
 
PPTX
Introduction git
Dian Sigit Prastowo
 
PPTX
Git and GitHub
Md. Ahsan Habib Nayan
 
PPTX
Intro to git and git hub
Venkat Malladi
 
PDF
Github - Git Training Slides: Foundations
Lee Hanxue
 
PDF
Git and Github
Wen-Tien Chang
 
KEY
The everyday developer's guide to version control with Git
E Carter
 
PPTX
A prentation on github
Veronica Ojochona Michael (MCP)
 
PPT
Introduction to Git Commands and Concepts
Carl Brown
 
PPTX
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 
PDF
Learning git
Sid Anand
 
PPTX
Git commands
Viyaan Jhiingade
 
PPTX
Git One Day Training Notes
glen_a_smith
 
PPTX
Github
MeetPatel710
 
PDF
Git real slides
Lucas Couto
 
PPTX
Introduction to git hub
Naveen Pandey
 
PPTX
Github basics
Radoslav Georgiev
 
Git basics to advance with diagrams
Dilum Navanjana
 
Git Version Control System
KMS Technology
 
Version control system
Andrew Liu
 
Introduction to git & GitHub
Poornachandrakashi
 
Introduction git
Dian Sigit Prastowo
 
Git and GitHub
Md. Ahsan Habib Nayan
 
Intro to git and git hub
Venkat Malladi
 
Github - Git Training Slides: Foundations
Lee Hanxue
 
Git and Github
Wen-Tien Chang
 
The everyday developer's guide to version control with Git
E Carter
 
A prentation on github
Veronica Ojochona Michael (MCP)
 
Introduction to Git Commands and Concepts
Carl Brown
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 
Learning git
Sid Anand
 
Git commands
Viyaan Jhiingade
 
Git One Day Training Notes
glen_a_smith
 
Github
MeetPatel710
 
Git real slides
Lucas Couto
 
Introduction to git hub
Naveen Pandey
 
Github basics
Radoslav Georgiev
 

Similar to Introduction to Git and Github (20)

PPTX
Git and Github
Teodora Ahkozidou
 
PPTX
Hacktoberfest intro to Git and GitHub
DSC GVP
 
PPTX
Git and github
Teodora Ahkozidou
 
PPTX
Mini-training: Let’s Git It!
Betclic Everest Group Tech Team
 
PDF
Git Commands Every Developer Should Know?
9 series
 
PPT
Github By Nyros Developer
Nyros Technologies
 
PPTX
Git overview
Gowarthini
 
PPTX
Git and Github workshop GDSC MLRITM
gdsc13
 
PPTX
Version control git day02
Gourav Varma
 
PPTX
Introduction to git and githhub with practicals.pptx
Abdul Salam
 
DOCX
Git github
Anurag Deb
 
PPT
Git introduction
satyendrajaladi
 
PPTX
git github PPT_GDSCIIITK.pptx
AbelPhilipJoseph
 
PPT
GIT By Sivakrishna
Nyros Technologies
 
PPTX
GitHub and Open Source - GDGoC MIT Anna University
mitgdsc
 
PPTX
Version control git day03
Gourav Varma
 
PDF
Git
Terry Wang
 
PDF
Git 入门与实践
Terry Wang
 
PDF
Git 入门 与 实践
Terry Wang
 
Git and Github
Teodora Ahkozidou
 
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Git and github
Teodora Ahkozidou
 
Mini-training: Let’s Git It!
Betclic Everest Group Tech Team
 
Git Commands Every Developer Should Know?
9 series
 
Github By Nyros Developer
Nyros Technologies
 
Git overview
Gowarthini
 
Git and Github workshop GDSC MLRITM
gdsc13
 
Version control git day02
Gourav Varma
 
Introduction to git and githhub with practicals.pptx
Abdul Salam
 
Git github
Anurag Deb
 
Git introduction
satyendrajaladi
 
git github PPT_GDSCIIITK.pptx
AbelPhilipJoseph
 
GIT By Sivakrishna
Nyros Technologies
 
GitHub and Open Source - GDGoC MIT Anna University
mitgdsc
 
Version control git day03
Gourav Varma
 
Git 入门与实践
Terry Wang
 
Git 入门 与 实践
Terry Wang
 
Ad

Recently uploaded (20)

PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Biography of Daniel Podor.pdf
Daniel Podor
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Ad

Introduction to Git and Github

  • 1. INTRODUCTION TO GIT AND GITHUB ATIQUE AHMED ZIAD LEAD DEVELOPER, LEGALX LTD. MOZILLA REPRESENTATIVE
  • 2. LET’S DISCUSS SOME ISSUES…  Can not work parallelly.  No version controlling.  Wrestling with bugs.  Revision is not made easy.
  • 3. WHAT IS GIT AND GITHUB “Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.” “GitHub is a cloud based platform built around the Git tool. It is an online service that stores code pushed to it from computers running the Git tool. It offers all of the distributed version control and source code management functionality of Git as well as adding its own features.”
  • 4. A SHORT STORY OF GIT In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper In 2005, BitKeeper’s free-of-charge status was revoked. This prompted the Linux development community (and in particular Linus Torvalds, the creator of Linux) to develop their own tool. This gave birth to Git in 2005. It’s amazingly fast, very efficient with large projects, and it has an incredible branching system for non-linear development
  • 5. INSTALLATION OF GIT  Download Git from https://git-scm.com/downloads  Downloaded ? Time to install it !  Verify Git installation. Git Config Username config: Email config: $ git config --global user.name yourusername $ git config --global user.email [email protected] $ git
  • 6. MAKE YOUR FIRST REPOSITORY IN GITHUB  Open a new repository in Github.  Choose / create a directory with some files inside it. Follow the below commands in Terminal / CMD: This will initialize Git in the directory. A folder named .git has been created. The git status command displays the state of the working directory and the staging area. $ git init $ git status
  • 7. MAKE YOUR FIRST REPOSITORY IN GITHUB $ git add . $ git commit –m “commit title” $ git remote add origin <REMOTE_URL> $ git push –u origin master Git add all files Commit the added files Set remote repository url (if not set previously) Push to remote repository Checkout remote urls $ git remote -v
  • 8. CONGRATULATION ! YOU HAVE UPLOADED YOUR FIRST GIT REPOSITORY.
  • 10. RECORDING CHANGES TO THE REPOSITORY
  • 11. GIT COMMIT • A commit in a git repository records a snapshot of all the files in your directory. It's like a giant copy and paste, but even better! • A commit takes all staged changes into it. $ git commit –m “commit title”
  • 12. VIEWING COMMIT HISTORY $ git log VIEW LOG WITH PATCH AND LAST ENTRIES $ git log –p -1 -p stands for patch which shows the differences in each commit -1 used for showing only last one commit
  • 13. POINTER & HEAD When you make a commit, Git stores a commit object that contains a pointer to the snapshot of the content you staged. How does Git know what branch you’re currently on? It keeps a special pointer called HEAD.
  • 14. GIT BRANCHES Branching means you diverge from the main line of development and continue to do work without messing with that main line. • Branches in git are incredibly lightweight. • They are simply pointers to a specific commit -- nothing more. • “Killer Feature” of git.
  • 15. GIT CREATING NEW BRANCH $ git branch <branch_name> Here the new branch name is testing
  • 16. GIT BRANCHES COMMANDS $ git checkout –b <branch_name> Opening a new branch and switching to that branch $ git checkout –d <branch_name> Deleting a local branch $ git push <remote_name> –d <branch_name> Deleting a remote branch $ git checkout <branch_name> Switching to a branch $ git branch See all branches
  • 17. GIT MERGE $ git merge <branch_name> Fast Forward Merge
  • 19. GIT MERGE CONFLICT  When two people edit the same line having different branch with different commit history.  If c3 and c4 commit edit the same line & we want to merge iss53 branch into master branch, then the conflict happens.
  • 20. GIT FORK AND CLONE $ git clone REMOTE_URL NOTE: It sets the remote repository URL while performing git clone command.
  • 21. PULL REQUEST • Pull request is created by comparing changes in branches. • Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary ISSUES • Issues are a great way to keep track of tasks. • Issues can act as more than just a place to report software bugs.
  • 22. ADD-ONS MOZILLA GITHUB REPOSITORY  Open source, where anyone can contribute code  How can one contribute code:  Fix any mentioned issue in your forked repository and send a pull request https://github.com/mozilla/addons-server
  • 23. HOW WILL YOU COLLABORATIVELY WORK ON YOUR PROJECT  Break each features into small piece of work and write them as issues in GitHub.  Everytime you work on an issue, you open a new branch and make a patch on that branch for the issue.  When you make the patch, send a pull request to master branch from that branch (that branch where you have made the patch that fixes the issue)
  • 24. REFERENCES • ProGit book – https://git-scm.com/book/en/v2 • Interactive git learning online - https://learngitbranching.js.org/