KEMBAR78
Introduction-to-Git-Github-andWorshop.pdf
Introduction to
Git and Github
Contents
1. Why should I care?
2. Introduction to git
3. Git commands
4. Version Control Platform: Github
2
3
Traditional File system
4
Why work hard when
you can work smart... or
better yet, watch
someone smart do the
work for you?
5
VCS provides
1. History and tracking
2. Collaboration
3. Backup
6
3
Introduction to
Git
Facts about Git
7
Development started by Linus Torvalds in 2005.
Later continued by Junio Hamano and others
Created mainly to meet version control
requirements of Linux Kernel
Open Source with GPL license
Terms we shall use
8
● Repository(repo): where Git stores all your
project files, along with their history.
● Commit: A snapshot of your repo at a specific
point in time.
● Branch: Pointer to a series of commits.
● Clone: Cloning means creating a copy of a
remote repo on your local machine.
● Fork(in github): Creating a copy of someone’s
repo into your own remote repo. Useful for
PRs.
Git: Internal structure
9
Push
Checkout the
project
Pull
Working
directory
Staging
area
Git repo
(Local)
Remote
Repo
Stage fixes
Commit Files
10
3
Git
workflow
11
Branching and Merging
12
Main
branch
Merging
Feature-A
Feature-A
Hotfix
Merging
Hotfix
Creating
branch
Creating
branch
Commands related to
branching and merging
13
▪ git branch <bname>: Create a git branch
▪ git branch: List all git branches in a repository
▪ git checkout <bname> : Switch to branch bname
▪ git branch –d <bname>: Deletes a branch
▪ git merge <bname>: Merge changes from
specified branch to current branch
14
VCS usage worldwide
15
4
Version Control
Platform-
GitHub
Where is my code ?
● A centralised web-based platform also called
remote repository.
● Developers create copy of the code from this remote
repository and collaborate in parallel
● Some popular web-based Version control platforms
include- Gitlab, Bitbucket, and Github.
16
Facts about
Github
● Developed in 2008 by Preston-werner, Wanstrath,
Hyett and Chacon
● Acquired by Microsoft in 2018. Currently a proprietary
platform.
● Offers robust security of code and efficient source
code management, free of cost.
● World’s most used version control platform
17
Some powerful features
1. Pull request: Request by developers to
push their proposed changes to main
repository
2. Github Pages: Free hosting service for
web based projects
3. Github Copilot: AI-powered coding
assistant, available as extension
18
19
Version Control Platforms usage
worldwide
20
Questions
Time!
21
Well, we have
questions!!
How does git help us?
● Track changes in code
● Debug unnecessary changes
● Stores deployment details
● Notifies developers about tasks
22
Correct git workflow?
● Create, merge, delete
● Clone, edit, push
● Pull, edit, clone
● Merge, pull, push
23
Purpose of fork on github?
● Merge two branches
● Create personal copy of remote repo
● Delete a repository
● Create a new issue in remote repo
24
Purpose of pull request on
github?
● Requesting to pull someone’s repo
● Propose changes in repo
● Pull someone’s code in your code
● Requesting for pull command
25
26
Time to Start
Typing!
TASK 1: Configure your git
● git config --global user.name "John Doe"
● git config --global user.email johndoe@example.com
● git config --global init.defaultBranch main
27
TASK 2: Commit Changes
● git status
● git add .
● git status
● git commit -m “I just did some changes”
● git log --oneline
28
TASK 3: Work with Github
● Making fork of remote repo
● git push -u origin main
● Making PRs to remote repo
29
30
Questions
Time!
References and More
resources
● Medium article(For diagrams)
● Medium article
● Medium article(With snippets)
● Git cheatsheet
● Youtube tutorial
● Ultimate solution to all issues :)
31
32
Thank You

Introduction-to-Git-Github-andWorshop.pdf