SlideShare a Scribd company logo
+ +Presented by
Introduction to Git and GitHub
AGENDA
1. Introduction to Version Control System
- What is Version Control System
- Centralised vs Distributed Version Control Systems
2. Introduction to Git
- What is Git
- Configuring Git and Creating repositories
- Add, commit, push
- The .gitignore file
- Branches
- Synchronising changes and Make changes
3. Introduction to GitHub
- What is GitHub
- Collaborating using Git and GitHub
Version Control System
- A way to manage files and directories
- Track changes over time
- Recalls previous versions
Centralised vs Distributed VCS
Git
What is Git?
Git is distributed version
control software.Git
repository has a copy of
that entire repository -
every commit, every
branch, every file.
Why use Git
● Speed
● Merge Conflicts
● Cheap Branches
● Ease of roll back
Configure Tooling
Configure user information for all local repositories
$ git config --global user.name "[name]"
Sets the name you want attached to your commit transactions
$ git config --global user.email "[email address]"
Sets the email you want attached to your commit transactions
⚙
Creating Repository
When starting out with a new repository, you only need to do it once; either
locally, then push to GitHub, or by cloning an existing repository.
$ git init
Or
$ git clone [url]
Clone (download) a repository that already exists on GitHub,
including all of the files, branches, and commits
git add
The git add command adds new or changed files in your working directory to the Git
staging area.
Few commonly used git add commands are:
$ git add <path>
Stage a specific directory or file
$ git add .
Stage all files (that are not listed in the .gitignore) in the entire repository
$ git add -p
Interactively stage hunks of changes
git status
$ git status shows the current state of your Git working directory and staging
area.
Why use git status?
The git status command only outputs information, it won't modify commits or changes
in your local repository.
What kind of information do we get?
Where HEAD is pointing, whether that is a branch or a commit .
If changed files are staged or not
git commit
git commit creates a commit, which is like a snapshot of your repository.
These commits are snapshots of your entire repository at specific times. It
should tell a story of the history of your repository and how it came to be the
way that it currently is.
How to use git commit?
git commit -m "descriptive commit message"
git commit -am "descriptive commit message"
git commit --amend
The .gitignore file
A .gitignore file is a plain text file where each line
contains a pattern for files/directories to ignore.
Generally, this is placed in the root folder of the
repository. You can also have multiple .gitignore files.
Why use .gitignore?
It is too easy to accidentally commit files containing
sensitive information or unnecessary files. The .gitignore
file comes in handy, escaping from these accidents.
https://www.toptal.com/developers/gitignore -> This link
can be used to generate .gitignore files effortlessly.
git push
$ git push uploads all local branch commits to the corresponding
remote branch. You can think of git push as “update” or “publish”. It only
updates the corresponding branch on the remote.
Common usages for git push
● $ git push -f
● $ git push -u origin [branch]
● $ git push --all
Branches
A branch in Git is simply a lightweight movable pointer to one of these commits. The
default branch name in Git is master . As you start making commits, you're given a
master branch that points to the last commit you made. Every time you commit, the
master branch pointer moves forward automatically.
Creating a New Branch
$ git branch <branch name>
Switching Branches
To switch to an existing branch, you run the git checkout command.
$ git checkout <branch name>
This moves HEAD to point to the <branch name> branch.
git pull
git pull updates your current local working branch, and all of the remote
tracking branches.
Common usages and options for git pull
● $ git pull
● $ git pull --rebase
● $ git pull --force
● $ git pull --all
Synchronising changes
$ git fetch
Downloads all history from the remote tracking branches
$ git merge
Combines remote tracking branches into current local branch
Make changes
$ git log
Lists version history for the current branch
$ git log --follow [file]
Lists version history for a file, including renames
$ git diff [first-branch]...[second-branch]
Shows content differences between two branches
$ git show [commit]
Outputs metadata and content changes of the specified commit
How to Undo Commits in Git
$ git revert
git revert looks at the changes introduced in a specific commit,
then applies the inverse of those changes in a new commit.
$ git reset
git reset is a very powerful command that may cause you to lose
work. By resetting, you move the HEAD pointer and the branch
pointer to another point in time - maybe making it seem like the
commits in between never happened
Introduction to GitHub
GitHub is a repository hosting platform for version
control system git. It lets you and others work together
on projects from anywhere.
Collaborating with GitHub
Adding collaborators in GitHub repository
A. On GitHub, navigate to the main
page of the repository.
B. Under your repository name,
click Settings.
C. In the left sidebar, click Manage
access.
D. Click Invite a collaborator and
Add NAME to REPOSITORY.
E. The user will receive an email
inviting them to the repository.
Presented by
The End

More Related Content

What's hot (19)

PPTX
Git and github
Teodora Ahkozidou
 
PPT
Github By Nyros Developer
Nyros Technologies
 
PDF
Git cheat sheet
Lam Hoang
 
PDF
Advance workshop on git
Himanshu Agrawal
 
PPTX
Git commands
Viyaan Jhiingade
 
PDF
Git 入门与实践
Terry Wang
 
PPTX
Extra bit with git
Himanshu Agrawal
 
PDF
Introduction To Git
Nikhil Vishnu P.V
 
PDF
Git Tricks
Ivelina Dimova
 
PPTX
Git tutorial undoing changes
LearningTech
 
PPTX
Extra bit with git
gdgjss
 
PDF
Git for developers
Hacen Dadda
 
DOCX
Git cheatsheet
synapsefre
 
PDF
Git in 5 Minutes
Robert Dumas
 
PPTX
Git basic
Akbar Uddin
 
PPTX
Git presentation
Sai Kumar Satapathy
 
PPTX
Git rewriting git history
LearningTech
 
PPTX
Version controll.pptx
Md. Main Uddin Rony
 
PDF
Git 101 Workshop
Joy Seng
 
Git and github
Teodora Ahkozidou
 
Github By Nyros Developer
Nyros Technologies
 
Git cheat sheet
Lam Hoang
 
Advance workshop on git
Himanshu Agrawal
 
Git commands
Viyaan Jhiingade
 
Git 入门与实践
Terry Wang
 
Extra bit with git
Himanshu Agrawal
 
Introduction To Git
Nikhil Vishnu P.V
 
Git Tricks
Ivelina Dimova
 
Git tutorial undoing changes
LearningTech
 
Extra bit with git
gdgjss
 
Git for developers
Hacen Dadda
 
Git cheatsheet
synapsefre
 
Git in 5 Minutes
Robert Dumas
 
Git basic
Akbar Uddin
 
Git presentation
Sai Kumar Satapathy
 
Git rewriting git history
LearningTech
 
Version controll.pptx
Md. Main Uddin Rony
 
Git 101 Workshop
Joy Seng
 

Similar to Hacktoberfest intro to Git and GitHub (20)

PDF
Git slides
Nanyak S
 
PPT
Git introduction
satyendrajaladi
 
DOCX
Git github
Anurag Deb
 
PPTX
Introduction to Git and Github
Md Atique Ahmed Ziad
 
PPTX
Git 101
jayrparro
 
PDF
Git Commands Every Developer Should Know?
9 series
 
PDF
Git basic introduction & tutorial for begginer
AnDiLestiAnto2
 
PPT
Learn Git Basics
Prakash Dantuluri
 
PDF
Git and Github - A primer
Suryakumar Sudar
 
PDF
Git
Terry Wang
 
PDF
Git and github 101
Senthilkumar Gopal
 
PDF
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
PDF
Git 入门 与 实践
Terry Wang
 
PDF
Git basics for beginners
PravallikaTammisetty
 
PPT
390a gitintro 12au
Nguyen Van Hung
 
PDF
Improving your workflow with git
Dídac Ríos
 
PDF
Learning git
Sid Anand
 
PPTX
Git_and_GitHub Integration_with_Guidewire
Gandhi Ramu
 
PPTX
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
PPTX
Introduction git
Dian Sigit Prastowo
 
Git slides
Nanyak S
 
Git introduction
satyendrajaladi
 
Git github
Anurag Deb
 
Introduction to Git and Github
Md Atique Ahmed Ziad
 
Git 101
jayrparro
 
Git Commands Every Developer Should Know?
9 series
 
Git basic introduction & tutorial for begginer
AnDiLestiAnto2
 
Learn Git Basics
Prakash Dantuluri
 
Git and Github - A primer
Suryakumar Sudar
 
Git and github 101
Senthilkumar Gopal
 
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
Git 入门 与 实践
Terry Wang
 
Git basics for beginners
PravallikaTammisetty
 
390a gitintro 12au
Nguyen Van Hung
 
Improving your workflow with git
Dídac Ríos
 
Learning git
Sid Anand
 
Git_and_GitHub Integration_with_Guidewire
Gandhi Ramu
 
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
Introduction git
Dian Sigit Prastowo
 

Recently uploaded (20)

PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 

Hacktoberfest intro to Git and GitHub

  • 2. Introduction to Git and GitHub
  • 3. AGENDA 1. Introduction to Version Control System - What is Version Control System - Centralised vs Distributed Version Control Systems 2. Introduction to Git - What is Git - Configuring Git and Creating repositories - Add, commit, push - The .gitignore file - Branches - Synchronising changes and Make changes 3. Introduction to GitHub - What is GitHub - Collaborating using Git and GitHub
  • 4. Version Control System - A way to manage files and directories - Track changes over time - Recalls previous versions
  • 6. Git What is Git? Git is distributed version control software.Git repository has a copy of that entire repository - every commit, every branch, every file. Why use Git ● Speed ● Merge Conflicts ● Cheap Branches ● Ease of roll back
  • 7. Configure Tooling Configure user information for all local repositories $ git config --global user.name "[name]" Sets the name you want attached to your commit transactions $ git config --global user.email "[email address]" Sets the email you want attached to your commit transactions ⚙
  • 8. Creating Repository When starting out with a new repository, you only need to do it once; either locally, then push to GitHub, or by cloning an existing repository. $ git init Or $ git clone [url] Clone (download) a repository that already exists on GitHub, including all of the files, branches, and commits
  • 9. git add The git add command adds new or changed files in your working directory to the Git staging area. Few commonly used git add commands are: $ git add <path> Stage a specific directory or file $ git add . Stage all files (that are not listed in the .gitignore) in the entire repository $ git add -p Interactively stage hunks of changes
  • 10. git status $ git status shows the current state of your Git working directory and staging area. Why use git status? The git status command only outputs information, it won't modify commits or changes in your local repository. What kind of information do we get? Where HEAD is pointing, whether that is a branch or a commit . If changed files are staged or not
  • 11. git commit git commit creates a commit, which is like a snapshot of your repository. These commits are snapshots of your entire repository at specific times. It should tell a story of the history of your repository and how it came to be the way that it currently is. How to use git commit? git commit -m "descriptive commit message" git commit -am "descriptive commit message" git commit --amend
  • 12. The .gitignore file A .gitignore file is a plain text file where each line contains a pattern for files/directories to ignore. Generally, this is placed in the root folder of the repository. You can also have multiple .gitignore files. Why use .gitignore? It is too easy to accidentally commit files containing sensitive information or unnecessary files. The .gitignore file comes in handy, escaping from these accidents. https://www.toptal.com/developers/gitignore -> This link can be used to generate .gitignore files effortlessly.
  • 13. git push $ git push uploads all local branch commits to the corresponding remote branch. You can think of git push as “update” or “publish”. It only updates the corresponding branch on the remote. Common usages for git push ● $ git push -f ● $ git push -u origin [branch] ● $ git push --all
  • 14. Branches A branch in Git is simply a lightweight movable pointer to one of these commits. The default branch name in Git is master . As you start making commits, you're given a master branch that points to the last commit you made. Every time you commit, the master branch pointer moves forward automatically. Creating a New Branch $ git branch <branch name> Switching Branches To switch to an existing branch, you run the git checkout command. $ git checkout <branch name> This moves HEAD to point to the <branch name> branch.
  • 15. git pull git pull updates your current local working branch, and all of the remote tracking branches. Common usages and options for git pull ● $ git pull ● $ git pull --rebase ● $ git pull --force ● $ git pull --all
  • 16. Synchronising changes $ git fetch Downloads all history from the remote tracking branches $ git merge Combines remote tracking branches into current local branch
  • 17. Make changes $ git log Lists version history for the current branch $ git log --follow [file] Lists version history for a file, including renames $ git diff [first-branch]...[second-branch] Shows content differences between two branches $ git show [commit] Outputs metadata and content changes of the specified commit
  • 18. How to Undo Commits in Git $ git revert git revert looks at the changes introduced in a specific commit, then applies the inverse of those changes in a new commit. $ git reset git reset is a very powerful command that may cause you to lose work. By resetting, you move the HEAD pointer and the branch pointer to another point in time - maybe making it seem like the commits in between never happened
  • 19. Introduction to GitHub GitHub is a repository hosting platform for version control system git. It lets you and others work together on projects from anywhere.
  • 20. Collaborating with GitHub Adding collaborators in GitHub repository A. On GitHub, navigate to the main page of the repository. B. Under your repository name, click Settings. C. In the left sidebar, click Manage access. D. Click Invite a collaborator and Add NAME to REPOSITORY. E. The user will receive an email inviting them to the repository.

Editor's Notes

  • #9: git init turns any directory into a Git repository. To initialize a repository, Git creates a hidden directory called .git. That directory stores all of the objects and refs that Git uses and creates as a part of your project's history. This hidden .git directory is what separates a regular directory from a Git repository. The git clone command is used to create a copy of a specific repository or branch within a repository. To start a repository, use either git init or git clone - not both. git init: One Person Starting a New Repository Locally git clone: The Remote Already Exists
  • #12: git commit creates a commit, which is like a snapshot of your repository. These commits are snapshots of your entire repository at specific times. You should make new commits often, based around logical units of change. Over time, commits should tell a story of the history of your repository and how it came to be the way that it currently is. Commits include lots of metadata in addition to the contents and message, like the author, timestamp, and more. git commit -m "descriptive commit message": This starts the commit process, and allows you to include the commit message at the same time. git commit -am "descriptive commit message": In addition to including the commit message, this option allows you to skip the staging phase. git commit --amend: Replaces the most recent commit with a new commit.
  • #13: What Kind of Files Should You Ignore? Log files Files with API keys/secrets, credentials, or sensitive information Useless system files like .DS_Store on macOS Generated files like dist folders Dependencies which can be downloaded from a package manager And there might be other reasons (maybe you make little todo.md files)
  • #14: git push updates the remote branch with local commits. It is one of the four commands in Git that prompts interaction with the remote repository. You can also think of git push as update or publish. By default, git push only updates the corresponding branch on the remote. So, if you are checked out to the master branch when you execute git push, then only the master branch will be updated. It's always a good idea to use git status to see what branch you are on before pushing to the remote. Common usages and options for git push git push -f: Force a push that would otherwise be blocked, usually because it will delete or overwrite existing commits (Use with caution!) git push -u origin [branch]: Useful when pushing a new branch, this creates an upstream tracking branch with a lasting relationship to your local branch git push --all: Push all branches
  • #15: https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell
  • #16: Common usages and options for git pull git pull: Update your local working branch with commits from the remote, and update all remote tracking branches. git pull --rebase: Update your local working branch with commits from the remote, but rewrite history so any local commits occur after all new commits coming from the remote, avoiding a merge commit. git pull --force: This option allows you to force a fetch of a specific remote tracking branch when using the <refspec> option that would otherwise not be fetched due to conflicts. To force Git to overwrite your current branch to match the remote tracking branch, read below about using git reset. git pull --all: Fetch all remotes - this is handy if you are working on a fork or in another use case with multiple remotes.