0% found this document useful (0 votes)
17 views18 pages

Git & Github

The document provides an overview of Git, a version control system that allows users to track changes in files and collaborate on projects. It also introduces GitHub as a web-based hosting service for Git repositories, detailing commands for repository management, configuration, and branch handling. Key commands such as git init, git clone, git push, and git pull are explained to facilitate the use of Git and GitHub effectively.

Uploaded by

Mujahid Hussain
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)
17 views18 pages

Git & Github

The document provides an overview of Git, a version control system that allows users to track changes in files and collaborate on projects. It also introduces GitHub as a web-based hosting service for Git repositories, detailing commands for repository management, configuration, and branch handling. Key commands such as git init, git clone, git push, and git pull are explained to facilitate the use of Git and GitHub effectively.

Uploaded by

Mujahid Hussain
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

[Link]
What is Git?

● Version Control System


○ Keep careful track of changes in your files
○ Collaborate with others on your projects more easily
○ Test changes without losing the original versions
○ Revert back to older versions when/if needed

● GitHub: web-based hosting service for git


○ Provides a "remote" location for storing your git workspaces
○ Useful if you lose/break your computer, etc.
[Link]
Git is the free and open source distributed version control system .
Add a little bit of body text

Code Managment

Version Control system

Collabration tool

[Link]
Using Git
● Installation
○ [Link]
○ [Link]
● How it works ○ Create a "repository" (workspace) for your project
○ Add/remove/save/edit files
○ Push local files online to GitHub / pull remote files from GitHub to your local
workspace
○ And more!

[Link]
Create your first repository, then add and commit files

● git init - initialize an existing directory as a Git repository

● git status - show modified files in working directory, staged for


your next commit

● git add [file] - add a file as it looks now to your next commit (stage)

● git commit -m "Initial commit" - commit your staged content as a new commit snapshot

[Link]
●git log - show all commits in the current branch’s history

● git remote add origin [Link] - add a git URL

[Link]
Clone a repository

The git clone command is used to copy an existing Git repository


from a server to the local machine.

● git clone [Link]

[Link]
Configure Git & GitHub
It has nothing to do with authentication when pushing to a remote repository
● git config --global [Link] “username”

● git config --global [Link] “xyz@[Link]”

● git config --list

Remove a global identity


● git config --global --remove-section [Link]
● git config --global --remove-section [Link]
[Link]
PUSH, PULL & FETCH

● git remote add origin Repository link - add a gitHub URL

● git remote -v - check the remote names:

● git push origin main - share data git to remote

● git pull origin main - share data remote to local (git)

● git fetch - share all branches data to local

[Link]
BRANCHES
● Each repository by default has a "master" branch
where all your work lives
● Sometimes useful to create separate branches in your
repository (to test new features, separate work among
collaborators, etc.)

[Link]
[Link]
[Link]
[Link]
[Link]
BRANCHES

MASTER STAGING DEVELOPER

FEATURE1

FEATURE2

FEATURE3
[Link]
git branch
● By default, lists all of the branches in your repository, but has a
few other variations:
● git branch - ( to check branch)
● git branch -d dev delete dev branch
● git branch -M main (to rename branch)
● git checkout -b dev (create new dev branch)
● git checkout master - switch to master branch
● git merge (branch name) merge branch to current branch

[Link]
● git revert #hash id - revert in comment
● rebase - show all history any branch
● git rebase master
● git cherrpick #id - whenever comment you want
● git pull origin master --rebase (remove histotry)
● git diff - check differnce b/w branch
● git reset --hard [commit]
● clear staging area, rewrite working tree from specified commit

[Link]
THANK YOU

[Link]

You might also like