SlideShare a Scribd company logo
1 of 69
Git &
Github
Introduction to
Chandra Bose
• GDSC Lead MLRITM • 8x Hackathon winner
• Frontend Developer • Frelancer
• Arbitrum ambassador • Web3 enthusiast
Things you need to know
• Repository - Repo - Folder • Local repo
• Remote repo • Code-Base
• Terminal / Command Line • Version
• Initialize • Configure
• git init -> inisalisasi repo
• git clone -> duplicate repo
• git commit -m “ ....” -> pesan commit
• git add . -> menambahkan semua file
• git log -> melihat semua commit yang
dilakukan
• git status -> melihat apa ada file yang
belum ditambahkan
• git checkout -> restore file
• git branch -> mengecek ada berapa
branch
#Repository -> project folder
#Commit -> riwayat perubahan
#Checkout -> berpindah ke commit lain
#Branch -> cabang dari commit
#Merge -> gabungan dua branch
#Remote -> alamat repo project
#Clone -> duplicate repo dari remote
#Push -> mengirim commit ke repo
#Pull -> getl update dari repo(merge)
#Fetch -> getl update dari repo(no merge)
What you should know
Version Control Sistem
👩
💻
Git is a version control system designed to managing multiple versions of a
project, Often involving multiple developers of teams.
Global Information
Tracker
GitHub is a web application which
serves as the user interface ( UI ) for Git.
Can store your Git repositories created using Git on a
remote server, where users can access from anywhere.
• Collaboration • Remote Access
• Community and Ecosystem • Public and Private Repositories
• Version Control for No-Code Files • Social Coding Platform
What is Version control system
• Track Changes
• Backup and Recovery
• Code Review
New Feature Error
New Feature
V/S
• CLI Tool (Command Line)
• Works Locally
• Tracks Changes in a codebase
• Web based application
• Works on Cloud
• Provides Interface to view changes
Installation
git -v
Open your terminal and type
https://git-scm.com/downloads
https://github.com/
Creating Github account
https://github.com/
Creating Github account
Lets dive into
Some exciting stuff
Git Architecture
Remote Repo
Local
Remote / Internet
Local Repo
Staging Index
Working Area
git add
git commit
git push
Git Life cycle of a file
Untracked
Staged
Committed
Modified
Git isn't aware of these files, Happens to newly created
files.
Files which are modified will be included in
staged.
Staged files are can be committed to git
repo.
Files that are modified since the last
commit.
Stage
s
Config your
git environment
$ git config
•Configure options for your git environment.
•We only use this command when we want to
add a user to it.
$ git config --global user.name “your name”
$ git config --global user.email “xyz@xyz.com”
Setting user info
$ git config --list lists all git
configuration
displays user
name
displays user
email
$ git config user.name
$ git config user.email
Hard-working viewers!
Time for some break
Lets add git to our project /
project
$ git init
•Initialize your repo with git.
•Giving your repo superpowers to track all
your changes.
Branching in Git
Master
(default)
feature
1
Child branch - feature
commit
head
git
•Its a hidden folder.
•Git uses to store metadata of the repo.
Lets modify few files
Lets modify few files
$ git status
•To check the status of your files.
•Displays current status of working directory.
Current working
not being tracked
currently
Lets add some files
$ git add .
$ git add xyx.txt
All files
Untracked Staged
(Files are
staged)
files will be tracked from
To unstage the
files
$ git commit -m “msg”
•Save the changes made to files in repo
•Takes a snapshot of all the changes that have
staged since last commit.
all flies at this point of time
$ git commit -m “msg”
•A unique commit ID is generated for every commit.
•Data is stored in your local machine and all
the files are tracked.
UID for present
commit
$ git log
•Used to get all the commits that have done till
now.
$ git log
$ git log -n (number)
•Display the total number of commits that want
to be displayed.
$ git diff
•Compares the data of a particular file to
another files of different stages.
$ git rev-parse --short HEAD
•Display the current commit head.
$ git revert commitid
•Undoes previous commit but creating a new
commit that undoes the changes.
•Moves its current commit head to previous one.
$ git branch
•Displays current branch name.
•Also used to do operations on branch by
using additional flags.
$ git reset commitid
•Move the repository back to a previous commit,
discarding any changes made after that commit.
$ git reset is used to unstage the
changes
Doesn't track
changes
of the files
gitignore
Branching in Git
Master
feature
1
Child branch - feature
$ git checkout -b name
•To add a new branch.
•Creates and switches to new branch.
branch
name
$ git checkout name
•To change to different branch.
•Resets any changes that done in current
branch.
branch
name
$ git branch -d name
•To remove a branch from the git tree.
branch
name
Git Architecture
Remote Repo
Local
Remote / Internet
Local Repo
Staging Index
Working Area
git add
git commit
git push
$ git remote add name url
•To add a remote repository from github.
remote url
remote
name
Lets create a remote repo
To create a new
repo
Remote repo
url
$ git clone repo-url
•To clone the remote repo.
•Create a local copy of a remote repo.
$ git clone repo-url
Remote
repo url
Push & Pull
•git push cmd is used to update the remote
repo with the local changes you made in your
local branch.
•git pull cmd is used to fetch all the changes
from the remote repo or branch and merges
them into local branch.
$ git push remote
$ git pull remote
Remote repo url
$ git fetch origin
•only fetched the data from the repo but
doesn't integrate new data into the working
file.
defines original repository
$ git merge
•Integrate the fetched changes into the local
branch.
$ git pull origin
•git pull automatically merge the changes into
the local branch.
defines original repository
$ git pull
$ git fetch $ git merge
+
=
Clone the repo
•Contributing to open-source projects
starts from cloning the repo.
Create a new branch
•Contributing to open-source projects
starts from cloning the repo.
Stage and commit
your changes
•Commit all the stages with a proper desc
commit message.
Push your branch to
github
Create a PR
•Contributing to open-source projects
starts from creating a PR.
Pull
request
Create a PR
Pull
request
Thank you
for following till the
end
@gdsc-mlritm gdsc@mlritm.ac.in

More Related Content

Similar to Git and Github workshop GDSC MLRITM

Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
Things Lab
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 

Similar to Git and Github workshop GDSC MLRITM (20)

Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
 
git.ppt.pdf
git.ppt.pdfgit.ppt.pdf
git.ppt.pdf
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of Git
 
Git github
Git githubGit github
Git github
 
Git and github introduction
Git and github introductionGit and github introduction
Git and github introduction
 
Git hub
Git hubGit hub
Git hub
 
簡單介紹git
簡單介紹git簡單介紹git
簡單介紹git
 
Let's Git this Party Started: An Introduction to Git and GitHub
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
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Git
GitGit
Git
 
Git & Github
Git & GithubGit & Github
Git & Github
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
Learning git
Learning gitLearning git
Learning git
 

Recently uploaded

audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
lolsDocherty
 
Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptx
ChloeMeadows1
 

Recently uploaded (16)

iThome_CYBERSEC2024_Drive_Into_the_DarkWeb
iThome_CYBERSEC2024_Drive_Into_the_DarkWebiThome_CYBERSEC2024_Drive_Into_the_DarkWeb
iThome_CYBERSEC2024_Drive_Into_the_DarkWeb
 
How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?
 
Pvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdf
 
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
 
I’ll See Y’All Motherfuckers In Game 7 Shirt
I’ll See Y’All Motherfuckers In Game 7 ShirtI’ll See Y’All Motherfuckers In Game 7 Shirt
I’ll See Y’All Motherfuckers In Game 7 Shirt
 
GOOGLE Io 2024 At takes center stage.pdf
GOOGLE Io 2024 At takes center stage.pdfGOOGLE Io 2024 At takes center stage.pdf
GOOGLE Io 2024 At takes center stage.pdf
 
Development Lifecycle.pptx for the secure development of apps
Development Lifecycle.pptx for the secure development of appsDevelopment Lifecycle.pptx for the secure development of apps
Development Lifecycle.pptx for the secure development of apps
 
Reggie miller choke t shirtsReggie miller choke t shirts
Reggie miller choke t shirtsReggie miller choke t shirtsReggie miller choke t shirtsReggie miller choke t shirts
Reggie miller choke t shirtsReggie miller choke t shirts
 
Bug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's GuideBug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's Guide
 
Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptx
 
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital PresenceCyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
 
The Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyThe Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case Study
 
TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.
TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.
TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.
 
Thank You Luv I’ll Never Walk Alone Again T shirts
Thank You Luv I’ll Never Walk Alone Again T shirtsThank You Luv I’ll Never Walk Alone Again T shirts
Thank You Luv I’ll Never Walk Alone Again T shirts
 
Premier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdfPremier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdf
 
Statistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdfStatistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdf
 

Git and Github workshop GDSC MLRITM