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

What's hot

Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
Tilton2
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
Naveen Pandey
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Rueful Robin
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
Panagiotis Papadopoulos
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
Behzad Altaf
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
James Gray
 
git and github
git and githubgit and github
git and github
Darren Oakley
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
Emanuele Olivetti
 
Git
GitGit
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
"FENG "GEORGE"" YU
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
Nicolás Tourné
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
Naim Latifi
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Lukas Fittl
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
viniciusban
 
Git training v10
Git training v10Git training v10
Git training v10
Skander Hamza
 
Version Control with Git & GitHub
Version Control with Git & GitHubVersion Control with Git & GitHub
Version Control with Git & GitHub
Piet Cordemans
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
Arulmurugan Rajaraman
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
Venkat Malladi
 
Git basic
Git basicGit basic
Git basic
Emran Ul Hadi
 

What's hot (20)

Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
git and github
git and githubgit and github
git and github
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
 
Git
GitGit
Git
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
 
Git training v10
Git training v10Git training v10
Git training v10
 
Version Control with Git & GitHub
Version Control with Git & GitHubVersion Control with Git & GitHub
Version Control with Git & GitHub
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git basic
Git basicGit basic
Git basic
 

Similar to Git and github fundamentals

Formation git
Formation gitFormation git
Formation git
Ghariani Tewfik
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
Sebin Benjamin
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone use
Ikuru Kanuma
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
AbhijitNarayan2
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
Mithilesh Singh
 
Git Basics
Git BasicsGit Basics
Git Basics
Ryan Condron
 
Git Session 2K23.pptx
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptx
Eshaan35
 
GIT
GITGIT
Git & Github
Git & GithubGit & Github
Git & Github
Aman Lalpuria
 
Git tech talk
Git tech talkGit tech talk
Git tech talkrazasayed
 
Git
GitGit
introduction in version control system
introduction in version control systemintroduction in version control system
introduction in version control system
Biga Gaber
 
GDSC Git event 2023.pptx
GDSC Git event 2023.pptxGDSC Git event 2023.pptx
GDSC Git event 2023.pptx
fsxflyer789Productio
 
Version control and GIT Primer
Version control and GIT PrimerVersion control and GIT Primer
Version control and GIT Primer
saadulde
 
Git introduction
Git introductionGit introduction
Git introduction
satyendrajaladi
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
Gaurav Wable
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.
WordCamp Harare
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
Priya Nayak
 
Git for developers
Git for developersGit for developers
Git for developers
Hacen Dadda
 
Day 2_ Get Git with It! A Developer's Workshop.pptx
Day 2_ Get Git with It! A Developer's Workshop.pptxDay 2_ Get Git with It! A Developer's Workshop.pptx
Day 2_ Get Git with It! A Developer's Workshop.pptx
Google Developer Students Clubs - CTU
 

Similar to Git and github fundamentals (20)

Formation git
Formation gitFormation git
Formation git
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone use
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
 
Git Basics
Git BasicsGit Basics
Git Basics
 
Git Session 2K23.pptx
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptx
 
GIT
GITGIT
GIT
 
Git & Github
Git & GithubGit & Github
Git & Github
 
Git tech talk
Git tech talkGit tech talk
Git tech talk
 
Git
GitGit
Git
 
introduction in version control system
introduction in version control systemintroduction in version control system
introduction in version control system
 
GDSC Git event 2023.pptx
GDSC Git event 2023.pptxGDSC Git event 2023.pptx
GDSC Git event 2023.pptx
 
Version control and GIT Primer
Version control and GIT PrimerVersion control and GIT Primer
Version control and GIT Primer
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git for developers
Git for developersGit for developers
Git for developers
 
Day 2_ Get Git with It! A Developer's Workshop.pptx
Day 2_ Get Git with It! A Developer's Workshop.pptxDay 2_ Get Git with It! A Developer's Workshop.pptx
Day 2_ Get Git with It! A Developer's Workshop.pptx
 

Recently uploaded

GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 

Recently uploaded (20)

GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 

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