0% found this document useful (0 votes)
12 views21 pages

Git and GitHub: A Beginner's Guide

The document provides an overview of Git and GitHub, explaining their roles as a version control system and a cloud platform for hosting Git repositories, respectively. It outlines the installation process, Git workflow, common commands, and the differences between Git and GitHub. Additionally, it introduces GitLab and encourages practice through open-source contributions and using GitHub Desktop for easier management.

Uploaded by

anamikasingh.xnr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views21 pages

Git and GitHub: A Beginner's Guide

The document provides an overview of Git and GitHub, explaining their roles as a version control system and a cloud platform for hosting Git repositories, respectively. It outlines the installation process, Git workflow, common commands, and the differences between Git and GitHub. Additionally, it introduces GitLab and encourages practice through open-source contributions and using GitHub Desktop for easier management.

Uploaded by

anamikasingh.xnr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CUrBrain

Rishika Mukherjee Subham Dhar Swaraj Roy


nd nd nd
CSE(AIML) - 2 Year CSBS - 2 Year BCA - 2 Year
INTRODUCTION

What is Git?
•A version control system
•Local tool installed on
your computer
What is GitHub?

GitHub is a powerful platform for hosting Git


repositories that facilitates collaboration among •An online cloud platform to host Git
developers. It provides tools for version control, repositories
enabling teams to manage and track changes in their •Used for storing, sharing, and collaborating on
code efficiently. With features like branching, forking, code
and pull requests, GitHub fosters a social coding
•Connects your local Git to the cloud
environment where developers can contribute to each
other's projects. Understanding GitHub is essential for
modern software development, as it streamlines
workflows and enhances collaboration within teams
and open-source communities.
Git is mainly used to :

Tracks who changed what and


when
Enables teamwork (many people
working on same project)
Lets you experiment safely
(branches)
Syncs code online with GitHub
Difference between Git and github

GitHub is a service Git is a software

GitHub is a graphical user interface Git is a command-line tool

GitHub is hosted on the web Git is installed locally on the system

GitHub is maintained by Microsoft Git is maintained by linux

GitHub is focused on centralized souce code hosting Git is focused on version control and code sharing

Git is a version control system to manage source code


GitHub is a hosting service for Git repositories
history
INSTALLATION AND CONFIG
Installing Git (You can skip this during session if already installed):
Download: [Link]

After installation, check:


git --version

Run these commands once on your computer (replace your name/email):


git config --global [Link] "github_username"
git config --global [Link] "youremail@[Link]"

To verify:
git config --list
GIT WORKFLOW:
Git divides your project into three logical areas:

Area Location What happens here

Working Your project


Where you create or edit files
Directory folder

Staging Area Inside Git Where you prepare files before saving them
(Index) memory permanently

Repository Hidden .git


Where Git stores commits (history of changes)
(Local Repo) folder

WORKING DIRECTORY → STAGING AREA → LOCAL REPOSITORY → REMOTE REPOSITORY (GITHUB)


(EDIT) (ADD) (COMMIT) (PUSH)
MOST COMMON GIT COMMANDS
Initialize a Repository:
git init → Creates a hidden .git folder — now your project is being tracked.

Check repository status:


git status → Shows which files are modified, staged, or untracked.

Add files to staging area:


git add filename → To add a specific file

or all files:
git add . → Think of it as “mark these files for saving.”

Commit (save snapshot):


git commit -m "Your message"→ Saves the staged changes with a message describing
what you did.

View commit history:


git log → Shows all commits with author, date, and message.
HOW TO PUSH A GIT REPOSITORY TO GITHUB ?

git init

git add .

git commit -m "message"

git remote add origin <URL>

git branch -M main

git push -u origin main


HOW TO GIT CLONE A REPOSITORY FROM GITHUB

git clone <HTTPS link>


WHAT IS A BRANCH
Why are Git branches needed?
CREATING AND MERGING A BRANCH
Creating A Branch
Create a Branch:
git branch branch-name

Switch to it:
git checkout branch-name

or create + switch together:


git checkout -b new-feature

Go back to main branch:


git checkout main

Merging A Branch
Merge a Branch:
git merge branch-name
FEATURE BRANCH WORKFLOW

Create & Switch: Use git


checkout -b <name> to start
a new isolated branch.
Commit Locally: Save your
changes to this branch using
git add and git commit.
Push to Remote: Upload
your branch to GitHub with
git push -u origin <name> to
share it.
HOW TO FORK A REPOSITORY FROM GITHUB?

Fork on [Link]

Git checkout
GITLAB
GitLab is a web-based DevOps platform that provides tools for
version control, continuous integration (CI), continuous deployment
(CD), and collaboration — all in one place. It helps developers
manage code, automate testing, and deploy software efficiently.

CI - Example: Every time you push code, GitLab automatically


runs tests
CD - Automatically deploys the tested code to production.
Pipeline - A sequence of automated stages (like build → test→
deploy) defined in a .[Link] file.
Each stage ensures your code moves smoothly from
development to production.
we use .[Link] file
CUrBrain

SUMMARY - WHAT WE LEARNED


Topic Key Idea

Git Tracks versions of your code — you can go back, branch, and collaborate safely.

GitHub A platform to host repos, collaborate, review code, and contribute globally.

Similar to GitHub but self-hosted and DevOps-focused —


GitLab
GitHub Desktop Visual tool to manage Git repos without command-line complexity.

Open Source Global collaboration — build, learn, and contribute to real-world projects
CUrBrain

WHAT’S NEXT – LEVEL UP YOUR JOURNEY

🔧 1. Practice
Create your own repo → push projects → learn commit, branch,
merge.

Contribute to small open-source issues labeled “good first issue.”

Try both GitHub and GitLab to see workflow differences.


CUrBrain

EXPLORE OPEN SOURCE PROGRAMS

Program When For

Students & first-time contributors — mentored


Google Summer of Annual (March–
coding projects with real orgs.
Code (GSoC) Sept)

GirlScript Summer Open-source program for beginners, especially


Feb–May
of Code (GSSoC) focused on diversity & learning.
GITHUB DESKTOP
Clone repositories from GitHub easily.
Create new branches and switch
between them visually.
Commit changes with a simple
message box instead of typing
commands.
See diffs (what exactly changed in
each file) in a clear visual layout.
Push and pull code with a single
button.
Resolve merge conflicts using a simple
visual comparison tool.
any‌
doubts?‌
Rishika Mukherjee Subham Dhar Swaraj Roy
nd nd nd
CSE(AIML) - 2 Year CSBS - 2 Year BCA - 2 Year
CUrBrain

T‌hank you !‌

You might also like