Beginner's guide to git and github

Beginner's guide to git and github
1. Install git and create a GitHub account
2. What is git?
3. Important terminologies in git
4. What is GitHub
5. Quick example using git and GitHub
Windows
https://git-scm.com/download/win
Mac
https://git-scm.com/download/mac
Linux (Debian based distro)
$ sudo apt install git
Linux (Arch based distro)
$ sudo pacman –S git
• Visit: https://github.com
• Click sign up
• Enter your email id and password
Git is version control tool
Now what is version control?
• A system that keeps records of your changes.
• Allows for collaborative development.
• Allows you to know who made what changes and
when.
• Allows you to revert any changes and go back to a
previous state.
• Git was made by Linus Torvald
(founder of Linux kernel) to aid in
linux kernel development
• It was made in 2005
• Uses checksum to ensure
data integrity
• Distributed version control
• Free and opensource!
• Cross platform
• Git tracks changes not
versions
Snapshots:
Git keeps record of all of your files and
their history which makes it possible to go
back to older snapshots.
Commit:
It is command used to create snapshot.
Add:
It is a command used to add
files to snapshot
Repository aka repo:
It contains files and their
history. It can exist locally or
on a remote server (GitHub!)
Branch
Branch contains your
snapshots a repo can have
infinite branches. Usually main
branch is called as master or
main
HEAD
A head is the reference of
most recent commit
Cherry-pick
It is a command used to
add changes from a
remote repository
Merge
It is a command used to
merge a branch from a
remote repository
Init
It is a command used to
initialize a repository
To create a repo you will require to create a dir or a folder. In Windows you can use GUI to so. On Linux
you use cmd
$ mkdir first-repo
Now, first-repo is your directory where you will initialize a repo.
To initialize a repo
$ git init
Now we can start by adding files to our directory lets say we add HelloWorld.java
$ git add HelloWorld.java
We can check what all files are added to commit using git status
$ git status
It should show HelloWorld.java added to the list
Now will finally commit out change using:
$ git commit –m “My first commit”
Note: My first commit is a message we added to our commit message. It is used to track history
It is basically a largest web
hosting platform to host remote
repositories which was recently
bought by Microsoft.
Now there are alternatives to
GitHub, popular ones are Gitlab
and Bitbucket.
Remember we created our first local repo few slides ago? We will push that to GitHub now!
To get started we will have to created a empty repository on GitHub to-do so visit GitHub’s
webpage, sign in into your account and press + on right top of the page. Create a repository
Name and we are halfway done!
Now lets get back to our first-repo dir launch a terminal and type the following commands
git remote add origin https://github.com/SahilSonar/first-repo
(Note: SahilSonar is my GitHub username and first-repo is empty repo I created on GitHub
change it according to your)
git push –u origin master
(It should ask you your username and password. BTW GitHub now uses a token instead of
password make sure you create a token and enter it instead of your actual password)
GitHub provides benefits for students via their student
developer pack which offers free credits on various
cloud services and tools you can checkout here:
https://education.github.com/pack
1 von 13

Recomendados

How to install and use git von
How to install and  use gitHow to install and  use git
How to install and use gitFaysal Hossain Shezan
446 views25 Folien
Github von
GithubGithub
GithubJaneAlamAdnan
212 views23 Folien
GitHub Classroom - An Open Source Learning Platform by Dr. Anchal Garg von
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 GargNisha Garg
104 views48 Folien
Github 101 An Adventurer's Guide To Open Source von
Github 101   An Adventurer's Guide To Open SourceGithub 101   An Adventurer's Guide To Open Source
Github 101 An Adventurer's Guide To Open SourcePrachitibhukan
147 views36 Folien
Introduction to git and github von
Introduction to git and githubIntroduction to git and github
Introduction to git and githubAderemi Dadepo
4.3K views23 Folien
Extra bit with git von
Extra bit with gitExtra bit with git
Extra bit with gitHimanshu Agrawal
838 views19 Folien

Más contenido relacionado

Was ist angesagt?

Git and github fundamentals von
Git and github fundamentalsGit and github fundamentals
Git and github fundamentalsRajKharvar
186 views28 Folien
Introduction to git and Github von
Introduction to git and GithubIntroduction to git and Github
Introduction to git and GithubWycliff1
125 views22 Folien
Github Case Study By Amil Ali von
Github Case Study By Amil AliGithub Case Study By Amil Ali
Github Case Study By Amil AliAmilAli1
476 views14 Folien
Github von
GithubGithub
Githubpiyush khadse
1.1K views15 Folien
Github von
GithubGithub
GithubIFEDAYO ADEYEMI
200 views14 Folien
Intro to Git & GitHub von
Intro to Git & GitHubIntro to Git & GitHub
Intro to Git & GitHubGoogleDevelopersStud
254 views33 Folien

Was ist angesagt?(20)

Git and github fundamentals von RajKharvar
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
RajKharvar186 views
Introduction to git and Github von Wycliff1
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
Wycliff1125 views
Github Case Study By Amil Ali von AmilAli1
Github Case Study By Amil AliGithub Case Study By Amil Ali
Github Case Study By Amil Ali
AmilAli1476 views
Git,Github,How to host using Github von Sujata Regoti
Git,Github,How to host using GithubGit,Github,How to host using Github
Git,Github,How to host using Github
Sujata Regoti410 views
Git & Github Workshop - Le Wagon Melbourne von Paal Ringstad
Git & Github Workshop - Le Wagon MelbourneGit & Github Workshop - Le Wagon Melbourne
Git & Github Workshop - Le Wagon Melbourne
Paal Ringstad259 views
Contributing to Open Source #Hacktoberfest von Cheah Eng Soon
Contributing to Open Source #HacktoberfestContributing to Open Source #Hacktoberfest
Contributing to Open Source #Hacktoberfest
Cheah Eng Soon171 views
Getting started With GIT von GhadiAlGhosh
Getting started With GITGetting started With GIT
Getting started With GIT
GhadiAlGhosh132 views
Using the GitHub App to Connect to Bitbucket von Liam Dempsey
Using the GitHub App to Connect to BitbucketUsing the GitHub App to Connect to Bitbucket
Using the GitHub App to Connect to Bitbucket
Liam Dempsey16.3K views
How Git and Gerrit make you more productive von Karsten Dambekalns
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productive
Karsten Dambekalns10.5K views
Git and GitHub von Rick Umali
Git and GitHubGit and GitHub
Git and GitHub
Rick Umali507 views
Inside GitHub von err
Inside GitHubInside GitHub
Inside GitHub
err69.1K views

Similar a Beginner's guide to git and github

GIT By Sivakrishna von
GIT By SivakrishnaGIT By Sivakrishna
GIT By SivakrishnaNyros Technologies
1.1K views28 Folien
Git presentation von
Git presentationGit presentation
Git presentationVikas Yaligar
1.8K views41 Folien
16 Git von
16 Git16 Git
16 GitHadley Wickham
664 views57 Folien
Let's Git this Party Started: An Introduction to Git and GitHub von
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubKim Moir
2K views54 Folien
Git/GitHub von
Git/GitHubGit/GitHub
Git/GitHubCindy Royal
3K views3 Folien
Introduction to Git & GitHub von
Introduction to Git & GitHubIntroduction to Git & GitHub
Introduction to Git & GitHubWasit Shafi
19 views15 Folien

Similar a Beginner's guide to git and github (20)

Let's Git this Party Started: An Introduction to Git and GitHub von Kim Moir
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir2K views
Introduction to Git & GitHub von Wasit Shafi
Introduction to Git & GitHubIntroduction to Git & GitHub
Introduction to Git & GitHub
Wasit Shafi19 views
Introduction to GitHub, Open Source and Tech Article von PRIYATHAMDARISI
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
PRIYATHAMDARISI224 views
Beginner Workshop for Student Developers - Tratech-presentation.pdf von GDSCKNUST
Beginner Workshop for Student Developers - Tratech-presentation.pdfBeginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdf
GDSCKNUST23 views
Git installation and configuration von Kishor Kumar
Git installation and configurationGit installation and configuration
Git installation and configuration
Kishor Kumar722 views
introductiontogitandgithub-120702044048-phpapp01.pdf von BruceLee275640
introductiontogitandgithub-120702044048-phpapp01.pdfintroductiontogitandgithub-120702044048-phpapp01.pdf
introductiontogitandgithub-120702044048-phpapp01.pdf
BruceLee2756407 views
Intro to Git for Drupal 7 von Chris Caple
Intro to Git for Drupal 7Intro to Git for Drupal 7
Intro to Git for Drupal 7
Chris Caple8.1K views

Último

When Sex Gets Complicated: Porn, Affairs, & Cybersex von
When Sex Gets Complicated: Porn, Affairs, & CybersexWhen Sex Gets Complicated: Porn, Affairs, & Cybersex
When Sex Gets Complicated: Porn, Affairs, & CybersexMarlene Maheu
67 views73 Folien
The basics - information, data, technology and systems.pdf von
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdfJonathanCovena1
115 views1 Folie
MIXING OF PHARMACEUTICALS.pptx von
MIXING OF PHARMACEUTICALS.pptxMIXING OF PHARMACEUTICALS.pptx
MIXING OF PHARMACEUTICALS.pptxAnupkumar Sharma
77 views35 Folien
The Accursed House by Émile Gaboriau von
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile GaboriauDivyaSheta
201 views15 Folien
Structure and Functions of Cell.pdf von
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdfNithya Murugan
545 views10 Folien
Sociology KS5 von
Sociology KS5Sociology KS5
Sociology KS5WestHatch
70 views23 Folien

Último(20)

When Sex Gets Complicated: Porn, Affairs, & Cybersex von Marlene Maheu
When Sex Gets Complicated: Porn, Affairs, & CybersexWhen Sex Gets Complicated: Porn, Affairs, & Cybersex
When Sex Gets Complicated: Porn, Affairs, & Cybersex
Marlene Maheu67 views
The basics - information, data, technology and systems.pdf von JonathanCovena1
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdf
JonathanCovena1115 views
The Accursed House by Émile Gaboriau von DivyaSheta
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile Gaboriau
DivyaSheta201 views
Structure and Functions of Cell.pdf von Nithya Murugan
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdf
Nithya Murugan545 views
Sociology KS5 von WestHatch
Sociology KS5Sociology KS5
Sociology KS5
WestHatch70 views
7 NOVEL DRUG DELIVERY SYSTEM.pptx von Sachin Nitave
7 NOVEL DRUG DELIVERY SYSTEM.pptx7 NOVEL DRUG DELIVERY SYSTEM.pptx
7 NOVEL DRUG DELIVERY SYSTEM.pptx
Sachin Nitave61 views
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx von Ms. Pooja Bhandare
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptxPharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Psychology KS5 von WestHatch
Psychology KS5Psychology KS5
Psychology KS5
WestHatch93 views
How to empty an One2many field in Odoo von Celine George
How to empty an One2many field in OdooHow to empty an One2many field in Odoo
How to empty an One2many field in Odoo
Celine George65 views
REPRESENTATION - GAUNTLET.pptx von iammrhaywood
REPRESENTATION - GAUNTLET.pptxREPRESENTATION - GAUNTLET.pptx
REPRESENTATION - GAUNTLET.pptx
iammrhaywood100 views
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB... von Nguyen Thanh Tu Collection
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
11.28.23 Social Capital and Social Exclusion.pptx von mary850239
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptx
mary850239298 views

Beginner's guide to git and github

  • 2. 1. Install git and create a GitHub account 2. What is git? 3. Important terminologies in git 4. What is GitHub 5. Quick example using git and GitHub
  • 3. Windows https://git-scm.com/download/win Mac https://git-scm.com/download/mac Linux (Debian based distro) $ sudo apt install git Linux (Arch based distro) $ sudo pacman –S git
  • 4. • Visit: https://github.com • Click sign up • Enter your email id and password
  • 5. Git is version control tool Now what is version control? • A system that keeps records of your changes. • Allows for collaborative development. • Allows you to know who made what changes and when. • Allows you to revert any changes and go back to a previous state.
  • 6. • Git was made by Linus Torvald (founder of Linux kernel) to aid in linux kernel development • It was made in 2005 • Uses checksum to ensure data integrity • Distributed version control • Free and opensource! • Cross platform • Git tracks changes not versions
  • 7. Snapshots: Git keeps record of all of your files and their history which makes it possible to go back to older snapshots. Commit: It is command used to create snapshot. Add: It is a command used to add files to snapshot
  • 8. Repository aka repo: It contains files and their history. It can exist locally or on a remote server (GitHub!) Branch Branch contains your snapshots a repo can have infinite branches. Usually main branch is called as master or main HEAD A head is the reference of most recent commit
  • 9. Cherry-pick It is a command used to add changes from a remote repository Merge It is a command used to merge a branch from a remote repository Init It is a command used to initialize a repository
  • 10. To create a repo you will require to create a dir or a folder. In Windows you can use GUI to so. On Linux you use cmd $ mkdir first-repo Now, first-repo is your directory where you will initialize a repo. To initialize a repo $ git init Now we can start by adding files to our directory lets say we add HelloWorld.java $ git add HelloWorld.java We can check what all files are added to commit using git status $ git status It should show HelloWorld.java added to the list Now will finally commit out change using: $ git commit –m “My first commit” Note: My first commit is a message we added to our commit message. It is used to track history
  • 11. It is basically a largest web hosting platform to host remote repositories which was recently bought by Microsoft. Now there are alternatives to GitHub, popular ones are Gitlab and Bitbucket.
  • 12. Remember we created our first local repo few slides ago? We will push that to GitHub now! To get started we will have to created a empty repository on GitHub to-do so visit GitHub’s webpage, sign in into your account and press + on right top of the page. Create a repository Name and we are halfway done! Now lets get back to our first-repo dir launch a terminal and type the following commands git remote add origin https://github.com/SahilSonar/first-repo (Note: SahilSonar is my GitHub username and first-repo is empty repo I created on GitHub change it according to your) git push –u origin master (It should ask you your username and password. BTW GitHub now uses a token instead of password make sure you create a token and enter it instead of your actual password)
  • 13. GitHub provides benefits for students via their student developer pack which offers free credits on various cloud services and tools you can checkout here: https://education.github.com/pack