0% found this document useful (0 votes)
12 views

Git and GitHub For Beginners

Uploaded by

hashirkhalil3
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Git and GitHub For Beginners

Uploaded by

hashirkhalil3
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Git and GitHub

A comprehensive overview
Contents
Intro to Git and Github
Difference between
git and Github
Github Account
creation and git
settings
Configuring Git
Git Commands
Concept of branches
Merging of code
Pull Command
Fork Concept
Git
Version Control System is a tool
that helps to track changes in code
Git is Version control system it is:
popular
free and open source
fast and reliable
With the help of Git you can
Track the history
Collaborate
Github
Website that allows developers to
store and manage their code using
git.
https://github.com
Stores the code in the form of
folder called (Repository)
Github Account

Create a new repository:


DemoRepo
Make our first Commit
Setting up Git

Visual Studio Code


Windows (Git Bash)
Mac (Terminal)
git --version
Configuring Git

git config --global user.name “My


Name”
git config --global user.email “email”
git config --list
Git Commands
Clone and Status
clone -cloning a repository on our
local machine ( git clone <- some
link->
status -displays the status of the
code (git status)
Git Commands
Types of status you may
encounter:
untracked
new file that git doesn’t yet track
modified
changed
staged
file is ready to be committed
unmodified
unchanged
Git Commands
Add & Commit
add - adds new or changed files
in your working directory to the
git staging area. (git add <- file
name ->)
commit - it is the record of
change (git commit -m “some
message”)
Git Commands

Push Command
push - upload local repo content
to remote repo (git push origin
main)
Git Commands
Init Command
init - used to create a new git
repo
Different commands
git init
git remote add origin <-link->
git remote -v (to verify remote)
git branch (to check branch)
git branch -M main (to rename
branch)
git push origin main
Git Work Flow

Github Repo clone changes add commit


Git Branches
Branch Commands
git branch (to check branch)
git main -M main ( to rename
branch)
git checkout <- branch name -> (
to navigate ->
git checkout -b <- new branch
name -> ( to create new branch)
git branch -d <- branch name -> (
to delete branch)
Merging Code

git diff <- branch name -> ( to


compare commits, branches, files
& more)
git merge <- branch name -> (to
merge 2 branches)
Crate a PR
Pull Command

Used to fetch and download


content from a remote repo and
immediately update the local repo
to match that content
git pull origin main
Fork

A Fork is a new repository that


shares code and visibility settings
with the original “upstream”
repository.
fork is rough copy
The End
Thanks for git-ting here!

You might also like