SlideShare a Scribd company logo
Git & Github - A primer
Suryakumar Sudar, iQuanti
Git - Installation Instructions
For Linux :
sudo apt-get install git
For Windows:
https://git-scm.com/download/win
Version Control Systems - an Introduction
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.
It acts as a backup system as well as a
revision tool.
**What features would you want in your
ideal VCS?
Version Control System - Essential Functions
● Should support reversion of a project/file to a previous state
● Should support Branching/Merging
● Should aid Traceability
● Should be distributed, not centralized
Git - Architecture & Salient Features
● Entire history is present locally
● Fast operations with no need of a
network
● Distributed architecture
● Supports parallelism at scale, eg:
thousands of feature branches
Workflow - Three States [Modified - Staged - Committed]
● Committed means that the data is safely
stored in your local database
● Modified means that you have changed
the file but have not committed it to your
database yet.
● Staged means that you have marked a
modified file in its current version to go
into your next commit snapshot
** the current working directory is referred to
as HEAD
To create a new
repository
git init
Create a new directory and execute the
command to initialize a repository
To add files to
repository and
commit the
changes
Create a new file and add it to the
staging area:
git add --all
Commit the changes and add a log
message:
git commit -a
Git - Branching
Branches are used to develop
features in isolation without
affecting the primary branch
(master*)
git branch
<branch_name>
Creates a new branch
*By default, the primary branch is
named “master” by git.
To switch between
states*
*States can refer to either branches
or commits
Create a new branch from the current
state of the project:
git checkout -b <branch name>
To switch to an already existing branch:
git checkout <branch_name>
To switch to a different commit ID:
git checkout <commit_id>
To inspect a
repository
Lists commit history with additional
information including author, commit ID
and log message:
git log
Check the status of working directory
and the staging area:
git status
Git - Merging
Merging is done to combine the changes
made in one branch to another.
Command to merge:
“git merge <branch1>“ will merge
branch1 with the current branch
**Do you foresee any potential pitfalls?
Merge conflicts and resolution
git automatically merges files when
possible
Exceptions arise when git tries to merge
files where contents are changed in both
the branches.
These ‘merge-conflicts’ have to be
resolved manually. The code-segment to
the right describes how git presents
conflicts.
Git remotes and Github
● Remotes refer to servers which host repositories
● Companies which provide such service (Remotes): Github, Bitbucket, AWS CodeCommit
etc..
● As convention, we refer to the primary remote as ‘origin’. This is purely conventional
and there is no specific importance attached to the term ‘origin’.
Add/List remotes of
a repository
Add a remote to an existing repository:
git remote add <remote_name>
<remote_URL>
Eg: git remote add origin
https://github.com/user/repo.git
List remotes of a repository:
git remote -v
Working with
remotes
To download/clone a repository:
git clone <github_URL>
To push changes from local to remote:
git push
To pull changes from remote to local:
git pull [will merge local
branch with remote]
Additional Tips
● Commit often
● Branch whenever required
● Decide upon a workflow with your team
● Always pull before you push code to
remote
● Write meaningful commit messages
● “git stash” and “git stash pop” to
save intermediate changes
● “git reset HEAD --hard” to reset
local changes
● Never push sensitive keys/credentials
to a public repository
References and further reading
● https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control
● https://in.udacity.com/course/how-to-use-git-and-github--ud775
● https://www.atlassian.com/git/tutorials/learn-git-with-bitbucket-cloud
● https://github.com/pluralsight/git-internals-pdf
Thank you

More Related Content

What's hot (20)

PPTX
Version control git day02
Gourav Varma
 
PPTX
Using Git and BitBucket
Medhat Dawoud
 
PPTX
Version control git day01
Gourav Varma
 
PPTX
Techoalien git
Aditya Tiwari
 
PPTX
Git commands
Vivek Gupta
 
PPTX
Introduction to git hub
Naveen Pandey
 
PPTX
Git Training
Prabal Tyagi
 
PPTX
Version control git day03
Gourav Varma
 
PPTX
Introduction to git
Shilu Shrestha
 
PPTX
Git hub abduallah abu nada
Lama K Banna
 
PPTX
Git overview
Gowarthini
 
PDF
Gitt and Git-flow
Md. Masud
 
PPTX
Demystifying Git
Pablo Quiroga
 
ODP
An introductory guide to GIT
Amith jayasekara
 
PDF
Git 101: Force-sensitive to Jedi padawan
James Ford
 
PDF
Git strategies for DevOps
Ahmad Iqbal Ali
 
PPTX
Git 101
jayrparro
 
PDF
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
AbhijitNarayan2
 
PDF
Introduction to Git
Yan Vugenfirer
 
PPTX
Git basics
Denys Haryachyy
 
Version control git day02
Gourav Varma
 
Using Git and BitBucket
Medhat Dawoud
 
Version control git day01
Gourav Varma
 
Techoalien git
Aditya Tiwari
 
Git commands
Vivek Gupta
 
Introduction to git hub
Naveen Pandey
 
Git Training
Prabal Tyagi
 
Version control git day03
Gourav Varma
 
Introduction to git
Shilu Shrestha
 
Git hub abduallah abu nada
Lama K Banna
 
Git overview
Gowarthini
 
Gitt and Git-flow
Md. Masud
 
Demystifying Git
Pablo Quiroga
 
An introductory guide to GIT
Amith jayasekara
 
Git 101: Force-sensitive to Jedi padawan
James Ford
 
Git strategies for DevOps
Ahmad Iqbal Ali
 
Git 101
jayrparro
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
AbhijitNarayan2
 
Introduction to Git
Yan Vugenfirer
 
Git basics
Denys Haryachyy
 

Similar to Git and Github - A primer (20)

PPTX
01 - Git vs SVN
Edward Goikhman
 
PPTX
Git and github
Teodora Ahkozidou
 
PPTX
Git and Github
Teodora Ahkozidou
 
PDF
Starting with Git & GitHub
Nicolás Tourné
 
PPTX
Mastering Git: Version Control for Developers
AyeshaSharif19
 
PDF
git.ppt.pdf
Roniel Lopez Alvarez
 
PPTX
Git and Github workshop GDSC MLRITM
gdsc13
 
PPTX
github ppt git ppt on git hub to know ab
infoinnext
 
PPTX
git.ppt.pptx power point presentation got Google internet
rani marri
 
PDF
Git training v10
Skander Hamza
 
PPTX
GIT.pptx
Soumen Debgupta
 
PPTX
Intro to Git and Github
Andrew Babiec
 
KEY
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir
 
PPT
Git is a distributed version control system .
HELLOWorld889594
 
PPTX
Getting Started with Git: A Primer for SVN and TFS Users
Noam Kfir
 
PPTX
GIT In Detail
Haitham Raik
 
PPTX
Git and GitHub (1).pptx
BetelAddisu
 
PPTX
GIT
Binu Paul
 
PPTX
Git and github fundamentals
RajKharvar
 
01 - Git vs SVN
Edward Goikhman
 
Git and github
Teodora Ahkozidou
 
Git and Github
Teodora Ahkozidou
 
Starting with Git & GitHub
Nicolás Tourné
 
Mastering Git: Version Control for Developers
AyeshaSharif19
 
Git and Github workshop GDSC MLRITM
gdsc13
 
github ppt git ppt on git hub to know ab
infoinnext
 
git.ppt.pptx power point presentation got Google internet
rani marri
 
Git training v10
Skander Hamza
 
GIT.pptx
Soumen Debgupta
 
Intro to Git and Github
Andrew Babiec
 
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir
 
Git is a distributed version control system .
HELLOWorld889594
 
Getting Started with Git: A Primer for SVN and TFS Users
Noam Kfir
 
GIT In Detail
Haitham Raik
 
Git and GitHub (1).pptx
BetelAddisu
 
Git and github fundamentals
RajKharvar
 
Ad

Recently uploaded (20)

PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PPTX
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PDF
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
PDF
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Import Data Form Excel to Tally Services
Tally xperts
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Human Resources Information System (HRIS)
Amity University, Patna
 
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Ad

Git and Github - A primer

  • 1. Git & Github - A primer Suryakumar Sudar, iQuanti
  • 2. Git - Installation Instructions For Linux : sudo apt-get install git For Windows: https://git-scm.com/download/win
  • 3. Version Control Systems - an Introduction 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. It acts as a backup system as well as a revision tool. **What features would you want in your ideal VCS?
  • 4. Version Control System - Essential Functions ● Should support reversion of a project/file to a previous state ● Should support Branching/Merging ● Should aid Traceability ● Should be distributed, not centralized
  • 5. Git - Architecture & Salient Features ● Entire history is present locally ● Fast operations with no need of a network ● Distributed architecture ● Supports parallelism at scale, eg: thousands of feature branches
  • 6. Workflow - Three States [Modified - Staged - Committed] ● Committed means that the data is safely stored in your local database ● Modified means that you have changed the file but have not committed it to your database yet. ● Staged means that you have marked a modified file in its current version to go into your next commit snapshot ** the current working directory is referred to as HEAD
  • 7. To create a new repository git init Create a new directory and execute the command to initialize a repository
  • 8. To add files to repository and commit the changes Create a new file and add it to the staging area: git add --all Commit the changes and add a log message: git commit -a
  • 9. Git - Branching Branches are used to develop features in isolation without affecting the primary branch (master*) git branch <branch_name> Creates a new branch *By default, the primary branch is named “master” by git.
  • 10. To switch between states* *States can refer to either branches or commits Create a new branch from the current state of the project: git checkout -b <branch name> To switch to an already existing branch: git checkout <branch_name> To switch to a different commit ID: git checkout <commit_id>
  • 11. To inspect a repository Lists commit history with additional information including author, commit ID and log message: git log Check the status of working directory and the staging area: git status
  • 12. Git - Merging Merging is done to combine the changes made in one branch to another. Command to merge: “git merge <branch1>“ will merge branch1 with the current branch **Do you foresee any potential pitfalls?
  • 13. Merge conflicts and resolution git automatically merges files when possible Exceptions arise when git tries to merge files where contents are changed in both the branches. These ‘merge-conflicts’ have to be resolved manually. The code-segment to the right describes how git presents conflicts.
  • 14. Git remotes and Github ● Remotes refer to servers which host repositories ● Companies which provide such service (Remotes): Github, Bitbucket, AWS CodeCommit etc.. ● As convention, we refer to the primary remote as ‘origin’. This is purely conventional and there is no specific importance attached to the term ‘origin’.
  • 15. Add/List remotes of a repository Add a remote to an existing repository: git remote add <remote_name> <remote_URL> Eg: git remote add origin https://github.com/user/repo.git List remotes of a repository: git remote -v
  • 16. Working with remotes To download/clone a repository: git clone <github_URL> To push changes from local to remote: git push To pull changes from remote to local: git pull [will merge local branch with remote]
  • 17. Additional Tips ● Commit often ● Branch whenever required ● Decide upon a workflow with your team ● Always pull before you push code to remote ● Write meaningful commit messages ● “git stash” and “git stash pop” to save intermediate changes ● “git reset HEAD --hard” to reset local changes ● Never push sensitive keys/credentials to a public repository
  • 18. References and further reading ● https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control ● https://in.udacity.com/course/how-to-use-git-and-github--ud775 ● https://www.atlassian.com/git/tutorials/learn-git-with-bitbucket-cloud ● https://github.com/pluralsight/git-internals-pdf