KEMBAR78
Git and Github | PDF | Version Control | Computing
0% found this document useful (0 votes)
68 views21 pages

Git and Github

Git is a popular, free, and open-source version control system that tracks changes in code, facilitates teamwork, and acts as a safety net for developers. GitHub is a platform for hosting Git repositories that enhances collaboration through features like issue tracking and pull requests, while also supporting open source projects. Key Git commands include initializing a repository, adding changes, committing, pushing, and merging code, along with methods for resolving conflicts and undoing changes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views21 pages

Git and Github

Git is a popular, free, and open-source version control system that tracks changes in code, facilitates teamwork, and acts as a safety net for developers. GitHub is a platform for hosting Git repositories that enhances collaboration through features like issue tracking and pull requests, while also supporting open source projects. Key Git commands include initializing a repository, adding changes, committing, pushing, and merging code, along with methods for resolving conflicts and undoing changes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

GIT AND GITHUB:

Presented By : Abdur Rehman Shah.


GIT:
• Git is a version control system. It is :
 Popular
 Free and open source
 Fast and scalable

• Version control system is a tools that helps to track changes in code.


GITHUB:

• GitHub is a platform for hosting and sharing Git repositories online.


• It provides collaboration features like issue tracking, pull requests, and code
review.
• It's a place where developers can contribute to open source projects and
collaborate with others.
PURPOSE OF GIT:

• Keeps track of changes: Git helps you remember every change you make to
your code, like a history book for your project.
• Makes teamwork easier: It lets multiple people work on the same project at
the same time without messing things up for each other.
• Acts as a safety net: If something goes wrong with your code, Git allows you
to go back to an earlier, safer version.
PURPOSE OF GITHUB:

• Provides a home for your code: GitHub is like a house where you can store
your project's code safely.
• Encourages teamwork: It helps people collaborate on projects by providing
tools for discussion, sharing ideas, and working together.
• Supports open source: GitHub is a hub for open source projects, allowing
anyone to contribute to or use code for free.
CONFIGURING GIT:

• Git config - -global user.name “My Name”


• Git config - -global user.email “email”
GIT COMMANDS:
GIT INIT:

• Initializes a new Git repository in your current


directory.
• git init
• .git repository
• git remote add origin <link>
GIT CLONE[URL]

• Copies an existing Git repository from a remote server


to your local machine.
GIT STATUS:

• Shows the current status of your working directory and


staging area.
GIT STATUS:

• Shows the current status of your working directory and


staging area.
 Untracked.
 Modified.
 Staged.
 Unmodified.
GIT ADD:

• Adds changes in a file to the staging area, preparing


them to be committed.
GIT COMMIT:

• Commits the changes in the staging area to the


repository with a descriptive message.
GIT PUSH:

• Uploads local repository content to a remote


repository.
• git push origin main
GIT BRANCHES

• git branch
• git branch –M main (to rename branch)
• git checkout <branch name>
• git checkout –b <new branch name>(to create new
branch)
• git branch –d <branch name> (to delete branch)
MERGING CODE

• Way 1 :
• git diff <branch name> (to compare commits, branches , files and more)
• git merge <branch name> (to merge two branches)

• Way 2 :
• Create a PR.
RESOLVING MERGE CONFLICTS:

• An event that takes place when Git is unable to automatically resolve


differences in code between two commits .
GIT PULL:

• Fetches changes from a remote repository and merges


them into your local branch.
• git pull origin main
UNDOING CHANGES:
• Case 1 : staged changes
• git reset <file name>
• git reset

• Case 2 : committed changes(for one commit)


• git reset HEAD-1

• Case 3 : committed changes(for many commits)


• git reset <commit hash>
• git log
FORK:

• A fork is a new repository that shares code and visibility settings with the
original upstream.
• Fork is a rough copy.
THANK YOU

You might also like