Git and Github

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 17

GIT

&
GITHUB
GIT - Global Information Tracker
• Git is a free and open-source distributed version control system. Designed to
handle everything from small to very large file projects with speed and
efficiency.
• Git is a distributed version control system that means every clone of a git
repository is a complete repository with a full copy of the project’s history. This
makes it easy to collaborate with other, as each developer can work on their own
branch of the project and then merge their changes back together when they are
ready.
• Git is widely used for both open-source and commercial software
development, with significant benefits for individuals, teams and businesses.
• Linux Torvalds along with other is the linux development community build &
released by in 2005.
GITHUB
• GitHub is a web-based interface that uses Git, the open source version control
software that lets multiple people make separate changes to web pages at the same
time. GitHub was founded by Tom Preston-Werner, Chris Wanstrath, and PJ Hyett in
2008.
• GitHub had been acquired by Microsoft in 2018.
• GitHub is a web-based platform primarily used for version control and collaboration
on software development projects. It provides a variety of features that facilitate the
management of codebases, the coordination of team members, and the tracking of
changes made to code over time.
Open Source
• Git is available for free under GNU. GNU is a free and open-source operating
system (OS). It's a collection of free software that can be used as an operating system
or in parts with other operating systems.
• GNU General Public Licence(GPL), is a developed by Richard Stallman.
• GNU is a series of widely used free software licence or copyleft that guarantee end
user the four freedom,
1. Run 2.Study 3.Share 4.Modify the software
• The GPL is copyleft licence in which licence is protective (or) reciprocal for all works
that are designed from the original.
• Copyleft --- Redistributing the software with (or) without changes
• Eg: Linux Kernal
Version control system
• Version control system that records changes to file or set of file over time so that
can recall specific version later.
• It allow you to revert selected file back to a previous state, revert the entire project
back to previous state, compare changes over time, see who last modified
something that might be causing a problem.
• Using VCS also generally mean that if you screw thing up or lose file, you can
easily recover.
There are three type of VCS:
Local version control system
Centralized version control system
Distributed version control system
Local version control system
• Programmer long ago developed local version control system that had a simple
database that kept all the changes to files under revision control.
• You manage and version all the files only within your local system.There in no
remote server in this scenario. All the changes are recorded in a local database.
Centralized version control system
• Centralized version control system developed these system such as CVCS, that
stored all version and changes to file on a single server. That contain all the files and
the numbers of clint that checkout files from that central place.
• Eg: 1. Concurrent version system 2. Perforce 3. Subversion
Distributed Version Control System
• The changes are then synchronized with other developers through a process
called pushing and pulling It is that allows to work on the same project without
relying the central server.
• Each developer has a complete copy of the project history on their local
machine and can commit, branch and merge change locally.
• Eg: 1. GIT 2. Mercurical 3. AWS code commit
• ( Client don’t just check out the latest snapshot of the files, rather they fully
mirror the repository including its full history )
• If server dies & there system were collaborating that server any of the client
repository can be copied back upto the server to restore it every clone is really a
full backup of all the data.
• Git has a remote repository which is stored in a server & a local repository which is
stored in computer of each developer.
• Git is distributed which mean that a project complete history is stored both on the
client and on the server.
• HASH --- Git uses hashes that are 160 bits large if the file time and data stamp its
changed.
• Git use SHA-1 algorithm.
• .git --- Git repository on your machine contains a .git folder.
• You know that some how the folder holds the history of every version of every file
over committed to the repository.
• The git folder will contain details of entry single change mode to the code base. All
snapshorts of the modification will be recorded in this folder like a database.

Directory (or) Folder


• A directory is a file system cataloging structure which contains references to other
computer files, and possibly other directories
• Only contain files and other directory Just create, modify and delete.
Repository
• A repository is the most basic element of GitHub. It's a place where you can store
your code, your files, and each file's revision history. is essentially a collection of
files and folders that make up a project, along with the entire history of changes
made to those files. Repositories on GitHub can be either public (visible to anyone)
or private (accessible only to authorized users).
• It is also like directory, it’s stored a modification history.
Inside the .git repository

Hooks
Object
Config
Refs
Head
Index
a) Hooks:
• This folder contain script file. Git hook are the script that are executed before a
or after event like commit. push etc
b) Object
• This folder represents an object database of git
c) Config
• This is the local configuration file
d) Head
• This stores reference to the current branch.It point to the master branch by default

e) Index
• This is a binary file & stores staging information
f) Refs
• This folder stores information about tags & branches.
GIT WORKFLOW
GIT COMMANDS
• git config is a command used to set or get configuration options for Git. It allows you
to configure settings such as user name, email, default editor, merge tool, and more.
• git config --global user.name "Your Name"
• git config --local user.email "your_email@example.com"
• git config --list
• git init: Initializes a new Git repository in the current directory.
• git clone [url]: Clones a repository from a remote source (e.g., GitHub) to your local
machine.
• git add [file]: Adds a file to the staging area, preparing it for commit.
• git commit -m "[message]": Commits the staged changes to the local repository
with a descriptive message.
• git status: Displays the current status of the repository, including tracked/untracked
files and changes to be committed.
• git push: Uploads local repository content to a remote repository.
• git pull: Fetches changes from a remote repository and merges them into the local
repository.
• git branch: Lists all local branches in the current repository.
• git checkout [branch_name]: Switches to the specified branch.
• git merge [branch_name]: Merges the specified branch into the current branch.
• git log: Displays a log of commits.
• git diff: Shows changes between commits, commit and working tree, etc.
• git remote: Lists remote repositories associated with the local repository.
• git fetch: Downloads objects and refs from another repository.
• git reset [file]: Resets the changes of a specific file or the entire working directory to
the last commit.
• git rm [file]: Removes a file from the working directory and stages the removal for
commit.
• git mv [old_path] [new_path]: Renames or moves a file, and stages the change for
commit.

THANK YOU

You might also like