SlideShare una empresa de Scribd logo
1 de 43
Git and GitHub
By Saquib Khan
About Me
In the industry for ~15 years
Solving problems for our customers and users
Mentor and Coach, Open Source Collaboration
Currently Senior Engg Mgr in Github India, prior to that with Microsoft, Intuit,
Ciena, Huawei
Technologies mostly worked on Java, C#, C/C++, ReactJs, Angular, RoR, NodeJs,
AWS, Azure, iOS, Android etc.
More About me and Contact
https://www.linkedin.com/in/saquibkhan
https://github.com/saquibkhan
saquibofficial@gmail.com
Problem 1: Maintaining history of changes made on a file,
what changed?
when change was made?
why it was made?
Developer want to travel back and forth in time and get any version of the file for the
given version/time.
Version Control System (VCS)
Problem 2: More than one developer (a Team) want to collaborate working on same files and
also able to maintain history of file versions/changes
Who made the change?
Types of VCS: Centralized (CVCS)
Types of VCS: Distributed (DVCS)
Short History of Git
● Creator - Linus Travold, also creator of Linux Kernel
● In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper(similar to Git).
● In 2005 BitKeeper was no longer free.
● Created Git based on some of the lessons they learned while using BitKeeper. Some of the goals of the new system were as
follows:
○ Speed
○ Simple design
○ Strong support for non-linear development (thousands of parallel branches)
○ Fully distributed
○ Able to handle large projects like the Linux kernel efficiently (speed and data size)
Git - CVCS or DVCS ?
How its Different?
Git : The core Idea
One major thing which Git did differently apart from all other VCS was
how it stores the Data
Differences vs Snapshots
Differences
Snapshots
Three Sections and States of Git
modified
staged
committed
How to use Git?
Git Command Line Tool Install
Downloadable/HomeBrew Mac, Linux, Win - https://git-scm.com/downloads
Git First Time Setup
git --version
git config --global user.name “Saquib”
git config --global user.email saquibofficial@gmail.com
Ref - https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
Create a New Repo or Get an Existing one
git init
git clone https://127.0.0.1/existing_repo
The default branch for new repo is main and for older repos it was master
(with ref to GitHub git server)
The three Stages
git status
This will show up status of working directory
Files Modified and Ready to be Staged
Files Staged and Ready to be Committed
Modified -> Stage -> Commit
git status
git add file1
git commit -m “short msg desc what and why change is done”
History
git log
Check a version in History
git show 760359b66d6f7620adbeab0bd602c0d0aa9e5852
Go back to a version in History
git checkout 760359b66d6f7620adbeab0bd602c0d0aa9e5852
Day to Day Working on bugs and Features
Best Practice - Always have a new branch for every bug or feature
Cost of creating a new branch - 4 bytes
Create a New Branch
git checkout -b <branch name> -t <remote>/<default branch>
git checkout -b branch_name -t origin/master
Working with Remote Server
git remote -vv
git remote add origin https://github.com/saquibkhan/javaFlameGraph.git
git remote add upstream https://github.com/saquibkhan2/javaFlameGraph.git
git remote add server2 https://github.com/saquibkhan3/javaFlameGraph.git
Push
git push <remote> <branch>
git push origin branch_name
Pull
git pull <remote> <branch>
git pull origin master
Pull (another way)
git fetch <remote> <branch>
git rebase <remote>/<branch>
git fetch origin branch_name
git rebase origin/branch
GitHUB
History
2008 founded in San Francisco, California
2018 Microsoft acquired Github for nearly 7.5 billion USD
Aug 2020 Github India, Hyderabad Office started
https://github.com/about/careers
~70% Employee are Remote
GitHub Profile
Repository Page
Commits and Branches
Pull Requests, Code Reviews, Approvals, CI,CD
Issues
Actions (CI/CD)
Insights
Education/Students
https://education.github.com/
Extend GitHub
https://github.com/marketplace
Github Sponsors
Refernce
Book - https://git-scm.com/book/en/v2

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

GitHub Classroom - An Open Source Learning Platform by Dr. Anchal Garg
GitHub Classroom - An Open Source Learning Platform by Dr. Anchal GargGitHub Classroom - An Open Source Learning Platform by Dr. Anchal Garg
GitHub Classroom - An Open Source Learning Platform by Dr. Anchal Garg
 
Github
GithubGithub
Github
 
Getting Started with GitHub
Getting Started with GitHubGetting Started with GitHub
Getting Started with GitHub
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Using Git to Organize Your Project
Using Git to Organize Your ProjectUsing Git to Organize Your Project
Using Git to Organize Your Project
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
Git best practices 2016
Git best practices 2016Git best practices 2016
Git best practices 2016
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
 
Git Tutorial
Git TutorialGit Tutorial
Git Tutorial
 
Social Coding GitHub 2015
Social Coding GitHub 2015Social Coding GitHub 2015
Social Coding GitHub 2015
 
Intro to Git & GitHub
Intro to Git & GitHubIntro to Git & GitHub
Intro to Git & GitHub
 
Git & GitHub
Git & GitHubGit & GitHub
Git & GitHub
 
What is version control software and why do you need it?
What is version control software and why do you need it?What is version control software and why do you need it?
What is version control software and why do you need it?
 
Beginner's guide to git and github
Beginner's guide to git and github Beginner's guide to git and github
Beginner's guide to git and github
 
Git'in on Windows
Git'in on WindowsGit'in on Windows
Git'in on Windows
 
GitHub
GitHubGitHub
GitHub
 
Software Versioning with Bitbucket and Eclipse
Software Versioning with Bitbucket and EclipseSoftware Versioning with Bitbucket and Eclipse
Software Versioning with Bitbucket and Eclipse
 
Github
GithubGithub
Github
 
Github
GithubGithub
Github
 
Git'in in 15
Git'in in 15Git'in in 15
Git'in in 15
 

Similar a Git and GitHub

Similar a Git and GitHub (20)

Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
You can git
You can gitYou can git
You can git
 
GitHub Event.pptx
GitHub Event.pptxGitHub Event.pptx
GitHub Event.pptx
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Migrating To GitHub
Migrating To GitHub  Migrating To GitHub
Migrating To GitHub
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
CSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GITCSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GIT
 
Version control git - lecture-1
Version control git - lecture-1Version control git - lecture-1
Version control git - lecture-1
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Git
GitGit
Git
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Version control with git
Version control with gitVersion control with git
Version control with git
 
Exploring Git in Visual Studio 2013
Exploring Git in Visual Studio 2013Exploring Git in Visual Studio 2013
Exploring Git in Visual Studio 2013
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
 
14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx
 
GIT GITHUB.pptx
GIT GITHUB.pptxGIT GITHUB.pptx
GIT GITHUB.pptx
 
Introduction to git & github
Introduction to git & githubIntroduction to git & github
Introduction to git & github
 
Git 101, or, how to sanely manage your Koha customizations
Git 101, or, how to sanely manage your Koha customizationsGit 101, or, how to sanely manage your Koha customizations
Git 101, or, how to sanely manage your Koha customizations
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Git workshop
Git workshopGit workshop
Git workshop
 

Más de AshwinRaj57

Foundation of UI/UX
Foundation of UI/UXFoundation of UI/UX
Foundation of UI/UXAshwinRaj57
 
Python for Everybody - Solution Challenge 2021
Python for Everybody - Solution Challenge 2021Python for Everybody - Solution Challenge 2021
Python for Everybody - Solution Challenge 2021AshwinRaj57
 
Information session - UCEK DSC
Information session - UCEK DSCInformation session - UCEK DSC
Information session - UCEK DSCAshwinRaj57
 
Prior programming experience track
Prior programming experience trackPrior programming experience track
Prior programming experience trackAshwinRaj57
 
30 Days of Google Cloud
30 Days of Google Cloud30 Days of Google Cloud
30 Days of Google CloudAshwinRaj57
 

Más de AshwinRaj57 (6)

Foundation of UI/UX
Foundation of UI/UXFoundation of UI/UX
Foundation of UI/UX
 
Revamp Your CV
Revamp Your CVRevamp Your CV
Revamp Your CV
 
Python for Everybody - Solution Challenge 2021
Python for Everybody - Solution Challenge 2021Python for Everybody - Solution Challenge 2021
Python for Everybody - Solution Challenge 2021
 
Information session - UCEK DSC
Information session - UCEK DSCInformation session - UCEK DSC
Information session - UCEK DSC
 
Prior programming experience track
Prior programming experience trackPrior programming experience track
Prior programming experience track
 
30 Days of Google Cloud
30 Days of Google Cloud30 Days of Google Cloud
30 Days of Google Cloud
 

Último

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
🐬 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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 

Git and GitHub

  • 1. Git and GitHub By Saquib Khan
  • 2. About Me In the industry for ~15 years Solving problems for our customers and users Mentor and Coach, Open Source Collaboration Currently Senior Engg Mgr in Github India, prior to that with Microsoft, Intuit, Ciena, Huawei Technologies mostly worked on Java, C#, C/C++, ReactJs, Angular, RoR, NodeJs, AWS, Azure, iOS, Android etc.
  • 3. More About me and Contact https://www.linkedin.com/in/saquibkhan https://github.com/saquibkhan saquibofficial@gmail.com
  • 4. Problem 1: Maintaining history of changes made on a file, what changed? when change was made? why it was made? Developer want to travel back and forth in time and get any version of the file for the given version/time.
  • 6. Problem 2: More than one developer (a Team) want to collaborate working on same files and also able to maintain history of file versions/changes Who made the change?
  • 7. Types of VCS: Centralized (CVCS)
  • 8. Types of VCS: Distributed (DVCS)
  • 9. Short History of Git ● Creator - Linus Travold, also creator of Linux Kernel ● In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper(similar to Git). ● In 2005 BitKeeper was no longer free. ● Created Git based on some of the lessons they learned while using BitKeeper. Some of the goals of the new system were as follows: ○ Speed ○ Simple design ○ Strong support for non-linear development (thousands of parallel branches) ○ Fully distributed ○ Able to handle large projects like the Linux kernel efficiently (speed and data size)
  • 10. Git - CVCS or DVCS ?
  • 12. Git : The core Idea One major thing which Git did differently apart from all other VCS was how it stores the Data Differences vs Snapshots
  • 15. Three Sections and States of Git modified staged committed
  • 16. How to use Git?
  • 17. Git Command Line Tool Install Downloadable/HomeBrew Mac, Linux, Win - https://git-scm.com/downloads
  • 18. Git First Time Setup git --version git config --global user.name “Saquib” git config --global user.email saquibofficial@gmail.com Ref - https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
  • 19. Create a New Repo or Get an Existing one git init git clone https://127.0.0.1/existing_repo The default branch for new repo is main and for older repos it was master (with ref to GitHub git server)
  • 20. The three Stages git status This will show up status of working directory Files Modified and Ready to be Staged Files Staged and Ready to be Committed
  • 21. Modified -> Stage -> Commit git status git add file1 git commit -m “short msg desc what and why change is done”
  • 23. Check a version in History git show 760359b66d6f7620adbeab0bd602c0d0aa9e5852
  • 24. Go back to a version in History git checkout 760359b66d6f7620adbeab0bd602c0d0aa9e5852
  • 25. Day to Day Working on bugs and Features Best Practice - Always have a new branch for every bug or feature Cost of creating a new branch - 4 bytes
  • 26. Create a New Branch git checkout -b <branch name> -t <remote>/<default branch> git checkout -b branch_name -t origin/master
  • 27. Working with Remote Server git remote -vv git remote add origin https://github.com/saquibkhan/javaFlameGraph.git git remote add upstream https://github.com/saquibkhan2/javaFlameGraph.git git remote add server2 https://github.com/saquibkhan3/javaFlameGraph.git
  • 28. Push git push <remote> <branch> git push origin branch_name
  • 29. Pull git pull <remote> <branch> git pull origin master
  • 30. Pull (another way) git fetch <remote> <branch> git rebase <remote>/<branch> git fetch origin branch_name git rebase origin/branch
  • 32. History 2008 founded in San Francisco, California 2018 Microsoft acquired Github for nearly 7.5 billion USD Aug 2020 Github India, Hyderabad Office started https://github.com/about/careers ~70% Employee are Remote
  • 36. Pull Requests, Code Reviews, Approvals, CI,CD

Notas del editor

  1. Disadvantage: Single point of failure
  2. clients don’t just check out the latest snapshot of the files; rather, they fully mirror the repository, including its full history. Thus, if any server dies, and these systems were collaborating via that server, any of the client repositories can be copied back up to the server to restore it. Every clone is really a full backup of all the data.
  3. Command Line and many other GUI tools
  4. Clone from any git server, use the server ip for cloning a repo, till now Github is not in picture.
  5. In other VCS creating a new branch was very costly effort. This is another strength where git shines.
  6. Please note for new repo it will be main, its the default branch. Origin is remote
  7. Pull is a 2 step process internally, git fetch and git rebase