0% found this document useful (0 votes)
6 views12 pages

Git and Github

Uploaded by

pidih75296
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)
6 views12 pages

Git and Github

Uploaded by

pidih75296
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

Git & Github Workshop

Mastering Version Control and Collaboration


Git Github

• Git is a distributed version control • Github is a cloud platform for hosting git
system. repositories.

• Tracks changes in the code. • Helps to share code.

• Tracks the history. • Collaborate with others.

• Helps to collaborate • Review changes and manage projects


Setting up GitHub Account
-> https://github.com

SignUp -> Enter your email -> Create password -> Enter Username -> verify account ->just me ->collaborative work, community -> continue for free

Setting up Git

• Windows (Git bash)

• Mac (Terminal)

• Downloading Git
->https://git-scm.com

• git - - version
Con guring git

• git config - -global user.name “userName”

• git config - -global user.email “[email protected]"

• Git config - -list


fi
Pushing our local files to GitHub
• git init
git init is used to create a new git repository.
git starts tracking changes in that folder.
• git add <- - filename - ->
Adds all the changes in your current directory.

• git commit -m “msg”


This saves your staged changes to the repository.
It is like snapshot of your project at a certain point in time.
• git remote add origin <- - link - ->
This command connects your local git repository to a remote repository (Github).

• git push origin main

Uploads your local commits to the remote Github repository.


Clone :

• Cloning a repository on our local machines

git clone <- - link - ->

Git status :

• git status command is used to display the state of working directory.

git status
Git Branch
A git branch is a separate line of development in a git repository . It allows you to
work on different features, bug fixes, or experiments independently from the main
codebase (usually the main or master branch).

Why use Branches ?

• To develop features without affecting the main class.

• To test ideas safely.

• To fix bugs in isolation.


• git branch

• git branch -M main (to rename branch)

• git checkout <- - branch name - -> (to navigate)

• git checkout -b <- - branch name - -> (to create new branch)

• git branch -d <- -branch name- -> (to delete branch)


Pull Request

It lets you tell others about changes you have pushed to a branch in a repository on
Github.

Forking

A Fork is a new repository that shares code and visibility settings with original
upstream repository.

Fork is a rough copy.


Fixing mistakes

• Case-1: staged changes by mistake


git reset <- - filename - ->

• Case-2: committed changes by mistake


git reset HEAD~1 (for one commit)

• Case-3: commited changes (for many commits)


git reset <- - commit hash - - >
we get hash code by git log
Thank you

You might also like