SlideShare a Scribd company logo
Git and Github Fundamentals
What is Git?
● Git is an Open Source Distributed
Version Control System (VCS).
● Git was developed by Linus Torvalds in 2005.
● The same person who has developed
Linux Operating System.
What is Version Control System (VCS)
● Version control is a system that records changes to a file or set of files over time so
that you can recall specific versions later.
● For an Example: You have created an App which is on 1.0 version. Suppose you
want to add a feature and so the App is upgraded to 1.1 version.
● But after few days the app is crashing because of the feature. So now you want to
rollback to 1.0 version.
● So here VCS comes into picture. You can track all the changes to file made from
particular checkpoint (commit).
What is Github?
● GitHub is a code hosting platform for version control and
collaboration. It lets you and others work together on projects from
anywhere.
● Other Alternatives are: Gitlab, Bit-Bucket
Git Commands
● git --version
● git init
● git add
● git commit
● git status
● git diff
● git log
● git clone
● git remote
● git push
● git pull
● git branch
● git checkout
● git merge
git --version
● git --version - Returns the version of the git
installed on the machine.
git init
● git init - Creates an empty Git repository or
reinitialize the existing one.
git add
● git add [filename] - Add file contents to staging
area
● git add . - Add all the changed files to staging
area.
○ Staging Area - Git knows what files are changed,
but doesn’t know why changed.
git commit
● git commit -m “commit message” - Create a
new commit containing the current contents of the
index and the given log message describing the
changes.
git status
● git status - Show the working tree status.
○ Gives the list of files changed
git diff
● git diff - Show changes between commits,
commit and working tree, etc
○ git diff [filename] - Shows the content
changed in file after last commit.
git log
● git log - Shows the commit logs.
git clone
● git clone - Clone a repository into a new
directory.
git remote
● git remote - Adds a remote named <name> for
the repository at <url>
○ git remote add origin [url]
git push
● git push - Update remote refs along with
associated objects.
○ git push origin master - update local branch
with remote branch.
git pull
● git pull - Fetch from and integrate with another
repository or a local branch.
○ git pull origin master - Fetch from master
branch of remote repository and integrate with
local branch.
git branch
● git branch - List all the branches
○ git branch [branch-name] - Creates a branch
with name as [branch-name]
git checkout
● git checkout - Switch branches or restore
working tree files.
○ git checkout [branch-name] - Checkout to
[branch-name]
○ Git checkout -b [branch-name] - Creates an
checkout to [branch-name]
git merge
● git merge - Join two or more development
histories together
○ git merge [branch-name] - Merge a [branch-
name] with current branch.
End of Day-1
Merge conflicts
● When two or more people are working on the same file in a repo and are
making changes to it, there are chances that a merge conflict will occur.
● These conflicts needs to be solved manually by deciding which code to keep
and which code to discard.
Hello_world.txt
User 1 User 2
How collaboration works at software companies?
● Suppose, the code for an application is hosted on a platform like GitHub.
● The repository will have 2 branches: Master and Develop
● Master: This contains the code of application that is currently in production.
● Develop: This branch has the latest stable code for the application.
● Now let’s see how an employee works when he/she has to add a new feature
to the application.
Scenario
● Assume that you are an employee working on Instagram Android App.
● And you are asked to work on a feature that allows users to like anyone’s
story.
master develop
master develop
Story-like-feature
Pull Request
● A pull request is opened to propose some new changes or features.
● Once a pull request is opened, someone reviews it and suggests some
changes if needed.
● After few iterations, if everything is good to go then the proposed feature is
merged into master branch.
Practical Demonstration
Visarg
Opening a Pull Request
Raj
Reviewing a Pull Request
Repository Link: https://github.com/DSC-
RNGPIT/git-github-demo
Thank you

More Related Content

PDF
Git and github 101
PDF
Introduction to Git
PDF
Git & GitHub WorkShop
PPT
Git basic
PPTX
Introduction to github slideshare
PDF
Git and Github slides.pdf
PPTX
Git - Basic Crash Course
PPTX
GIT presentation
Git and github 101
Introduction to Git
Git & GitHub WorkShop
Git basic
Introduction to github slideshare
Git and Github slides.pdf
Git - Basic Crash Course
GIT presentation

What's hot (20)

PPTX
Github basics
PPTX
Intro to git and git hub
PDF
Git and git flow
PDF
Git Series. Episode 3. Git Flow and Github-Flow
PDF
Introducing GitLab (September 2018)
PPTX
Git and GitHub
PPTX
Git Lab Introduction
PDF
Introduction to Git and GitHub
PPTX
GitLab.pptx
PPTX
PDF
Git 101: Git and GitHub for Beginners
PDF
Git real slides
PPTX
Introduction git
PPTX
Git and github
PDF
Introduction to Git and Github
PPTX
PPTX
Introduction to Gitlab | Gitlab 101 | Training Session
PPTX
Git basics to advance with diagrams
PDF
git and github
PDF
Gitlab ci, cncf.sk
Github basics
Intro to git and git hub
Git and git flow
Git Series. Episode 3. Git Flow and Github-Flow
Introducing GitLab (September 2018)
Git and GitHub
Git Lab Introduction
Introduction to Git and GitHub
GitLab.pptx
Git 101: Git and GitHub for Beginners
Git real slides
Introduction git
Git and github
Introduction to Git and Github
Introduction to Gitlab | Gitlab 101 | Training Session
Git basics to advance with diagrams
git and github
Gitlab ci, cncf.sk
Ad

Similar to Git and github fundamentals (20)

PDF
Formation git
PDF
Introducing Git and git flow
ODP
Git for standalone use
PDF
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
PDF
GIT_Overview.
PPTX
Git Basics
PPTX
Git Session 2K23.pptx
PPTX
PPTX
Git & Github
PPTX
Introduction to git hub
ODP
Git tech talk
PPTX
ODP
introduction in version control system
PPTX
GDSC Git event 2023.pptx
PDF
Version control and GIT Primer
PPTX
Git and GitHub Workshop of GDG on Campus UNSTPB
PPTX
Git & GitLab
PPTX
git & git hub course in information retrieval .pptx
PPTX
Using Git with WordPress - Presented by Nigel Rodgers.
PPTX
Git and GitHub
Formation git
Introducing Git and git flow
Git for standalone use
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
GIT_Overview.
Git Basics
Git Session 2K23.pptx
Git & Github
Introduction to git hub
Git tech talk
introduction in version control system
GDSC Git event 2023.pptx
Version control and GIT Primer
Git and GitHub Workshop of GDG on Campus UNSTPB
Git & GitLab
git & git hub course in information retrieval .pptx
Using Git with WordPress - Presented by Nigel Rodgers.
Git and GitHub
Ad

Recently uploaded (20)

PDF
01-Introduction-to-Information-Management.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Cell Types and Its function , kingdom of life
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
01-Introduction-to-Information-Management.pdf
PPH.pptx obstetrics and gynecology in nursing
Renaissance Architecture: A Journey from Faith to Humanism
102 student loan defaulters named and shamed – Is someone you know on the list?
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Insiders guide to clinical Medicine.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
2.FourierTransform-ShortQuestionswithAnswers.pdf
Week 4 Term 3 Study Techniques revisited.pptx
Supply Chain Operations Speaking Notes -ICLT Program
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Final Presentation General Medicine 03-08-2024.pptx
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Microbial diseases, their pathogenesis and prophylaxis
Cell Types and Its function , kingdom of life
O5-L3 Freight Transport Ops (International) V1.pdf

Git and github fundamentals

  • 1. Git and Github Fundamentals
  • 2. What is Git? ● Git is an Open Source Distributed Version Control System (VCS). ● Git was developed by Linus Torvalds in 2005. ● The same person who has developed Linux Operating System.
  • 3. What is Version Control System (VCS) ● Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. ● For an Example: You have created an App which is on 1.0 version. Suppose you want to add a feature and so the App is upgraded to 1.1 version. ● But after few days the app is crashing because of the feature. So now you want to rollback to 1.0 version. ● So here VCS comes into picture. You can track all the changes to file made from particular checkpoint (commit).
  • 4. What is Github? ● GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere. ● Other Alternatives are: Gitlab, Bit-Bucket
  • 5. Git Commands ● git --version ● git init ● git add ● git commit ● git status ● git diff ● git log ● git clone ● git remote ● git push ● git pull ● git branch ● git checkout ● git merge
  • 6. git --version ● git --version - Returns the version of the git installed on the machine.
  • 7. git init ● git init - Creates an empty Git repository or reinitialize the existing one.
  • 8. git add ● git add [filename] - Add file contents to staging area ● git add . - Add all the changed files to staging area. ○ Staging Area - Git knows what files are changed, but doesn’t know why changed.
  • 9. git commit ● git commit -m “commit message” - Create a new commit containing the current contents of the index and the given log message describing the changes.
  • 10. git status ● git status - Show the working tree status. ○ Gives the list of files changed
  • 11. git diff ● git diff - Show changes between commits, commit and working tree, etc ○ git diff [filename] - Shows the content changed in file after last commit.
  • 12. git log ● git log - Shows the commit logs.
  • 13. git clone ● git clone - Clone a repository into a new directory.
  • 14. git remote ● git remote - Adds a remote named <name> for the repository at <url> ○ git remote add origin [url]
  • 15. git push ● git push - Update remote refs along with associated objects. ○ git push origin master - update local branch with remote branch.
  • 16. git pull ● git pull - Fetch from and integrate with another repository or a local branch. ○ git pull origin master - Fetch from master branch of remote repository and integrate with local branch.
  • 17. git branch ● git branch - List all the branches ○ git branch [branch-name] - Creates a branch with name as [branch-name]
  • 18. git checkout ● git checkout - Switch branches or restore working tree files. ○ git checkout [branch-name] - Checkout to [branch-name] ○ Git checkout -b [branch-name] - Creates an checkout to [branch-name]
  • 19. git merge ● git merge - Join two or more development histories together ○ git merge [branch-name] - Merge a [branch- name] with current branch.
  • 21. Merge conflicts ● When two or more people are working on the same file in a repo and are making changes to it, there are chances that a merge conflict will occur. ● These conflicts needs to be solved manually by deciding which code to keep and which code to discard. Hello_world.txt User 1 User 2
  • 22. How collaboration works at software companies? ● Suppose, the code for an application is hosted on a platform like GitHub. ● The repository will have 2 branches: Master and Develop ● Master: This contains the code of application that is currently in production. ● Develop: This branch has the latest stable code for the application. ● Now let’s see how an employee works when he/she has to add a new feature to the application.
  • 23. Scenario ● Assume that you are an employee working on Instagram Android App. ● And you are asked to work on a feature that allows users to like anyone’s story.
  • 25. Pull Request ● A pull request is opened to propose some new changes or features. ● Once a pull request is opened, someone reviews it and suggests some changes if needed. ● After few iterations, if everything is good to go then the proposed feature is merged into master branch.
  • 26. Practical Demonstration Visarg Opening a Pull Request Raj Reviewing a Pull Request