SlideShare a Scribd company logo
Intro to
Git & GitHub
Hands-on workshop
@angeloseby | #gdscbmc
Whoa!
Hi, I am Angelo Seby
GDSC BMC Lead🤩 - Flutter Developer💙 - ML Enthusiast🤖
@angeloseby | #gdscbmc
Heyy!
Hi, I am Vijay
GDSC BMC Outreach Lead💌 - Python Developer💛 - ML Enthusiast🤖
@angeloseby | #gdscbmc
Setup Check
@angeloseby | #gdscbmc
just type ‘git’ in your terminal
(GDSC BMC)
I am not a git expert….
@angeloseby | #gdscbmc
(GDSC BMC)
Agenda
Git History
Git Concepts
Basic Git Workflow
Branching
Resources
@angeloseby | #gdscbmc
(GDSC BMC)
Git History
@angeloseby | #gdscbmc
A ‘git’ is a cranky old man
(GDSC BMC)
@angeloseby | #gdscbmc
● Git is a free and open source distributed Version
Control System
● Can handle small to very large projects with speed
and efficiency
● Created by Linus Torvalds, launched April 7 2005
● Every Git working directory contains a repository
with complete history and full revision capabilities
● Git is local , not dependant of a network or a
central server
(GDSC BMC)
@angeloseby | #gdscbmc
Goals of Git
● Speed
● Non - linear development / Parallel branches
● Fully distributed
● Able to handle large projects efficiently
(GDSC BMC)
Git Concepts
@angeloseby | #gdscbmc
(GDSC BMC)
@angeloseby | #gdscbmc
VERSION CONTROL
A system that
records change
over time.
@angeloseby | #gdscbmc
(GDSC BMC)
@angeloseby | #gdscbmc
GIT REPOSITORY (REPO)
A container for
project files
@angeloseby | #gdscbmc
(GDSC BMC)
@angeloseby | #gdscbmc
SNAPSHOTS
Information about
the state of the
project
@angeloseby | #gdscbmc
(GDSC BMC)
Basic Git Workflow
@angeloseby | #gdscbmc
Let’s ‘git’ with it…
(GDSC BMC)
@angeloseby | #gdscbmc
git --help
@angeloseby | #gdscbmc
Git’s
documentation
is built in - try it
for yourself
(GDSC BMC)
@angeloseby | #gdscbmc
Setup the
workspace
@angeloseby | #gdscbmc
Make a folder
named ‘project’
in desktop of
your system
$ mkdir project // Make new folder
$ cd project // Change directory
c:/desktop/project> $
Goto Desktop -> Right Click -> Open Terminal Here
(GDSC BMC)
@angeloseby | #gdscbmc
Config git
@angeloseby | #gdscbmc
Set the email
and name for Git
to use when you
commit
/project> $ git config --global user.name "John Doe"
/project> $ git config --global user.email bugs@gmail.com
(GDSC BMC)
@angeloseby | #gdscbmc
Creating git repo
@angeloseby | #gdscbmc
Set the email
and name for Git
to use when you
commit
/project> $ git init
To create a new local git repo in your cd
This will create a .git directory in your cd
Then you can commit files in that directory into the repo.
/project> $ git clone url
To clone a remote repo into to your cd
This will create the given local directory, containing a working
copy of the files from the repo, and a .git directory
(GDSC BMC)
@angeloseby | #gdscbmc
git status
@angeloseby | #gdscbmc
View the status
of your files in
the working
directory and
staging area
/project> $ git status
To view the git status
It lets you see which changes have been staged, which haven't,
and which files aren't being tracked by Git.
/project> $ git status -s
To view the short version of git status
(GDSC BMC)
@angeloseby | #gdscbmc
Add a file
@angeloseby | #gdscbmc
Create a file in
your cd
Create a new text file in your in cd.
Write something in it 😃
(GDSC BMC)
@angeloseby | #gdscbmc
git add
@angeloseby | #gdscbmc
Add the files that
are created and
modified for
staging commit
/project> $ git add file name
To add a single file for staging commit
Now when check the git status you can see that the added file
is now added to the tracked files list
/project> $ git add .
To add all the files for staging commit
This will add all the new and modified files for staging to commit
(GDSC BMC)
@angeloseby | #gdscbmc
git reset
@angeloseby | #gdscbmc
Remove your file
from staging /project> $ git reset filename
To reset filename
Removes that file from staged files
(GDSC BMC)
@angeloseby | #gdscbmc
git commit
@angeloseby | #gdscbmc
Captures a
snapshot of the
project's
currently staged
changes
/project> $ git commit -m “Initial Commit”
To save a current version of repo we commit
This will commit (make a safe zone) with all the tracked /
staged files
-m stands for commit message , it can be any
meaningful message.
The statement in the quoted enclosed near to it is the
commit msg
(GDSC BMC)
@angeloseby | #gdscbmc
git diff
@angeloseby | #gdscbmc
To view the
difference
between files
/project> $ git diff
To view the difference between staged and unstaged files
To the view the difference between staged and last
committed file
/project> $ git diff --cached
(GDSC BMC)
@angeloseby | #gdscbmc
git log
@angeloseby | #gdscbmc
See the git
commit history
in command line
interface
/project> $ git log
To see the history of all git commits with message & author
To the view the shorter version of git history
/project> $ git log --oneline
(GDSC BMC)
@angeloseby | #gdscbmc
Amend a commit
@angeloseby | #gdscbmc
Edit the last
commit if you
forgot to add
some file
/project> $ git commit -amend
This will take all the files in the staging area and add it to the
last commit
(GDSC BMC)
Branching
@angeloseby | #gdscbmc
‘git’ to the branch of tree
@angeloseby | #gdscbmc
@angeloseby | #gdscbmc
/project> $ git branch
Lists all branches in the repository
@angeloseby | #gdscbmc
@angeloseby | #gdscbmc
/project> $ git branch name
Creates a new branch from current working branch with given name
@angeloseby | #gdscbmc
@angeloseby | #gdscbmc
/project> $ git checkout branch_name
Switch to the local branch with given branch name
If such branch doesn’t exist, creates a new branch with that name from the current
working branch
@angeloseby | #gdscbmc
@angeloseby | #gdscbmc
/project> $ git branch -d branch_name
/project> $ git branch -D branch_name
Both deletes a branch with given name
@angeloseby | #gdscbmc
@angeloseby | #gdscbmc
/project> $ git merge branch_name
Merges the branch with given branch name to the currently working branch
(GDSC BMC)
Resources
@angeloseby | #gdscbmc
Continue learning about ‘git’
@angeloseby | #gdscbmc
@angeloseby | #gdscbmc
Read the manual
https://git-scm.com/doc
@angeloseby | #gdscbmc
@angeloseby | #gdscbmc
@angeloseby | #gdscbmc
Learn git branching like a game
https://learngitbranching.js.org/
@angeloseby | #gdscbmc
@angeloseby | #gdscbmc
@angeloseby | #gdscbmc
Git tutorial - Atlassian
https://www.atlassian.com/git/tutorials
@angeloseby | #gdscbmc
Thank You
@angeloseby | #gdscbmc

More Related Content

Similar to Introduction to Git

Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
Becky Todd
 
GIT Basics
GIT BasicsGIT Basics
GIT Basics
Tagged Social
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
Aleksey Asiutin
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
Sothearin Ren
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
E Carter
 
Git Developer Cheatsheet
Git Developer CheatsheetGit Developer Cheatsheet
Git Developer CheatsheetAbdul Basit
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践Terry Wang
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
Arulmurugan Rajaraman
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
BADR
 
Git
GitGit
Git cheat sheet_dark
Git cheat sheet_darkGit cheat sheet_dark
Git cheat sheet_darkKing Hom
 
Git cheat sheet__white
Git cheat sheet__whiteGit cheat sheet__white
Git cheat sheet__whiteKing Hom
 
Git cheat sheet__grey
Git cheat sheet__greyGit cheat sheet__grey
Git cheat sheet__greyKing Hom
 
Git github
Git githubGit github
Git github
Anurag Deb
 
Git basics : a beginner's guide
Git basics : a beginner's guideGit basics : a beginner's guide
Git basics : a beginner's guide
Digital Product School
 
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010
Matt Gauger
 
Git cheat-sheet 2021
Git cheat-sheet 2021Git cheat-sheet 2021
Git cheat-sheet 2021
Rana Faisal Haroon
 

Similar to Introduction to Git (20)

Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
 
GIT Basics
GIT BasicsGIT Basics
GIT Basics
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Git Developer Cheatsheet
Git Developer CheatsheetGit Developer Cheatsheet
Git Developer Cheatsheet
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Hello git
Hello git Hello git
Hello git
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
 
Git
GitGit
Git
 
Git cheat sheet_dark
Git cheat sheet_darkGit cheat sheet_dark
Git cheat sheet_dark
 
Git cheat sheet__white
Git cheat sheet__whiteGit cheat sheet__white
Git cheat sheet__white
 
Git cheat sheet__grey
Git cheat sheet__greyGit cheat sheet__grey
Git cheat sheet__grey
 
Git github
Git githubGit github
Git github
 
Git basics : a beginner's guide
Git basics : a beginner's guideGit basics : a beginner's guide
Git basics : a beginner's guide
 
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010
 
Git cheat-sheet 2021
Git cheat-sheet 2021Git cheat-sheet 2021
Git cheat-sheet 2021
 

Recently uploaded

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
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
 
JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
ShivajiThube2
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
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
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 

Recently uploaded (20)

A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
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
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 

Introduction to Git

  • 1. Intro to Git & GitHub Hands-on workshop @angeloseby | #gdscbmc
  • 2. Whoa! Hi, I am Angelo Seby GDSC BMC Lead🤩 - Flutter Developer💙 - ML Enthusiast🤖 @angeloseby | #gdscbmc
  • 3. Heyy! Hi, I am Vijay GDSC BMC Outreach Lead💌 - Python Developer💛 - ML Enthusiast🤖 @angeloseby | #gdscbmc
  • 4. Setup Check @angeloseby | #gdscbmc just type ‘git’ in your terminal
  • 5. (GDSC BMC) I am not a git expert…. @angeloseby | #gdscbmc
  • 6. (GDSC BMC) Agenda Git History Git Concepts Basic Git Workflow Branching Resources @angeloseby | #gdscbmc
  • 7. (GDSC BMC) Git History @angeloseby | #gdscbmc A ‘git’ is a cranky old man
  • 8. (GDSC BMC) @angeloseby | #gdscbmc ● Git is a free and open source distributed Version Control System ● Can handle small to very large projects with speed and efficiency ● Created by Linus Torvalds, launched April 7 2005 ● Every Git working directory contains a repository with complete history and full revision capabilities ● Git is local , not dependant of a network or a central server
  • 9. (GDSC BMC) @angeloseby | #gdscbmc Goals of Git ● Speed ● Non - linear development / Parallel branches ● Fully distributed ● Able to handle large projects efficiently
  • 11. (GDSC BMC) @angeloseby | #gdscbmc VERSION CONTROL A system that records change over time. @angeloseby | #gdscbmc
  • 12. (GDSC BMC) @angeloseby | #gdscbmc GIT REPOSITORY (REPO) A container for project files @angeloseby | #gdscbmc
  • 13. (GDSC BMC) @angeloseby | #gdscbmc SNAPSHOTS Information about the state of the project @angeloseby | #gdscbmc
  • 14. (GDSC BMC) Basic Git Workflow @angeloseby | #gdscbmc Let’s ‘git’ with it…
  • 15. (GDSC BMC) @angeloseby | #gdscbmc git --help @angeloseby | #gdscbmc Git’s documentation is built in - try it for yourself
  • 16. (GDSC BMC) @angeloseby | #gdscbmc Setup the workspace @angeloseby | #gdscbmc Make a folder named ‘project’ in desktop of your system $ mkdir project // Make new folder $ cd project // Change directory c:/desktop/project> $ Goto Desktop -> Right Click -> Open Terminal Here
  • 17. (GDSC BMC) @angeloseby | #gdscbmc Config git @angeloseby | #gdscbmc Set the email and name for Git to use when you commit /project> $ git config --global user.name "John Doe" /project> $ git config --global user.email bugs@gmail.com
  • 18. (GDSC BMC) @angeloseby | #gdscbmc Creating git repo @angeloseby | #gdscbmc Set the email and name for Git to use when you commit /project> $ git init To create a new local git repo in your cd This will create a .git directory in your cd Then you can commit files in that directory into the repo. /project> $ git clone url To clone a remote repo into to your cd This will create the given local directory, containing a working copy of the files from the repo, and a .git directory
  • 19. (GDSC BMC) @angeloseby | #gdscbmc git status @angeloseby | #gdscbmc View the status of your files in the working directory and staging area /project> $ git status To view the git status It lets you see which changes have been staged, which haven't, and which files aren't being tracked by Git. /project> $ git status -s To view the short version of git status
  • 20. (GDSC BMC) @angeloseby | #gdscbmc Add a file @angeloseby | #gdscbmc Create a file in your cd Create a new text file in your in cd. Write something in it 😃
  • 21. (GDSC BMC) @angeloseby | #gdscbmc git add @angeloseby | #gdscbmc Add the files that are created and modified for staging commit /project> $ git add file name To add a single file for staging commit Now when check the git status you can see that the added file is now added to the tracked files list /project> $ git add . To add all the files for staging commit This will add all the new and modified files for staging to commit
  • 22. (GDSC BMC) @angeloseby | #gdscbmc git reset @angeloseby | #gdscbmc Remove your file from staging /project> $ git reset filename To reset filename Removes that file from staged files
  • 23. (GDSC BMC) @angeloseby | #gdscbmc git commit @angeloseby | #gdscbmc Captures a snapshot of the project's currently staged changes /project> $ git commit -m “Initial Commit” To save a current version of repo we commit This will commit (make a safe zone) with all the tracked / staged files -m stands for commit message , it can be any meaningful message. The statement in the quoted enclosed near to it is the commit msg
  • 24. (GDSC BMC) @angeloseby | #gdscbmc git diff @angeloseby | #gdscbmc To view the difference between files /project> $ git diff To view the difference between staged and unstaged files To the view the difference between staged and last committed file /project> $ git diff --cached
  • 25. (GDSC BMC) @angeloseby | #gdscbmc git log @angeloseby | #gdscbmc See the git commit history in command line interface /project> $ git log To see the history of all git commits with message & author To the view the shorter version of git history /project> $ git log --oneline
  • 26. (GDSC BMC) @angeloseby | #gdscbmc Amend a commit @angeloseby | #gdscbmc Edit the last commit if you forgot to add some file /project> $ git commit -amend This will take all the files in the staging area and add it to the last commit
  • 27. (GDSC BMC) Branching @angeloseby | #gdscbmc ‘git’ to the branch of tree
  • 28. @angeloseby | #gdscbmc @angeloseby | #gdscbmc /project> $ git branch Lists all branches in the repository
  • 29. @angeloseby | #gdscbmc @angeloseby | #gdscbmc /project> $ git branch name Creates a new branch from current working branch with given name
  • 30. @angeloseby | #gdscbmc @angeloseby | #gdscbmc /project> $ git checkout branch_name Switch to the local branch with given branch name If such branch doesn’t exist, creates a new branch with that name from the current working branch
  • 31. @angeloseby | #gdscbmc @angeloseby | #gdscbmc /project> $ git branch -d branch_name /project> $ git branch -D branch_name Both deletes a branch with given name
  • 32. @angeloseby | #gdscbmc @angeloseby | #gdscbmc /project> $ git merge branch_name Merges the branch with given branch name to the currently working branch
  • 33. (GDSC BMC) Resources @angeloseby | #gdscbmc Continue learning about ‘git’
  • 34. @angeloseby | #gdscbmc @angeloseby | #gdscbmc Read the manual https://git-scm.com/doc @angeloseby | #gdscbmc
  • 35. @angeloseby | #gdscbmc @angeloseby | #gdscbmc Learn git branching like a game https://learngitbranching.js.org/ @angeloseby | #gdscbmc
  • 36. @angeloseby | #gdscbmc @angeloseby | #gdscbmc Git tutorial - Atlassian https://www.atlassian.com/git/tutorials @angeloseby | #gdscbmc