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

Git and GitHub

Git is an open-source distributed version control system designed to handle projects with high speed and efficiency. It allows teams to track changes and work together in the same workspace. GitHub is a git repository hosting service that provides collaboration features and a graphical interface. It hosts open source projects and code in various programming languages. Version control systems track changes to files over time and allow developers to recall specific versions and collaborate more efficiently.

Uploaded by

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

Git and GitHub

Git is an open-source distributed version control system designed to handle projects with high speed and efficiency. It allows teams to track changes and work together in the same workspace. GitHub is a git repository hosting service that provides collaboration features and a graphical interface. It hosts open source projects and code in various programming languages. Version control systems track changes to files over time and allow developers to recall specific versions and collaborate more efficiently.

Uploaded by

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

Git and GitHub

Git is an open-source distributed version control system. It is designed to handle minor to major projects with high speed and
efficiency. The version control system allows us to track and work together with our team members at the same workspace. It
is created by Linus Torvalds in 2005 to develop Linux kernel.

Following are some important features of Git

1. Open-source  It is an open-source tool. It is released under the GPL (General Public License) license.
2. Scalable  Git is scalable, which means number of users increases, the Git can easily handle such situation.
3. Distributed  It is one of the great feature of Git. Distributed means that instead of just having one central repository
that you send changes to, every user has their own repository that contains the entire commit history of the project.
We do not need necessary, we can push these changes to a remote repository.
4. Security  Git is secure. It uses the SHA1(Secure Hash Function) to name and identify objects within its repository. It
stores its history in such a way that the ID of particular commits depends upon the complete development history
leading up to that commit. Once it is published, one cannot make changes to its old version.
5. Branching and merging  It is the great features of Git. Git allows the creation of multiple branches without affecting
each other. Following are some important features that can be achieved by branching –
a. We can create a separate branch for a new module of the project, commit and delete it whenever we want.
b. We can have a production branch, which always has what goes into production and can be merged for testing
in the test branch.
c. We can create a demo branch for the experiment and check if it is working. We can also remove it if needed.

Benefits of Git

A version control system application allows us to keep track of all the changes what we make in the files of our project. Every
time we make changes in files of an existing project, we can push those changes to a repository. Other developers are allowed
to pull your changes from the repository and continue to work with the updates that you added to the project files.

Some significant benefits of using Git are as follows: - Save time, Offline working, Undo Mistakes, Track Changes.

What is GitHub?

GitHub is a git repository hosting service. GitHub also facilitates with many of its features, such as access control and
collaboration. It provides a web-based graphical interface.

GitHub is an American company. It hosts source code of you project in the form of different programming languages and
keeps track of the various changes made by programmers.

GitHub is a place where programmers and designers work together. They collaborate, contribute, and fix bugs together. It
hosts plenty of open source projects and codes of various programming languages.

Following are some features of GitHub

a. Collaboration
b. Graphical representation of branches
c. Git repository hosting
d. Code hosting

The key benefits of GitHub are as follows.

 It is easy to contribute to pen source projects via GitHub.


 It helps to create and excellent document.
 It allows your work to get out there in front of the public.
 You can track changes in your code across version.

What do you mean by version control system?

A version control system is a software that tracks changes to a file or set of files over time so that you can recall specific
version later.

The version control system is a collection of software tools that help a team to manage changes in a source code. It uses a
special kind of database to keep track of every modification to the code.
Developers can compare earlier version of the code with an older version to fix the mistakes.

Benefits of the version control system

The version control system is very helpful and beneficial in software development. It allows software teams to preserve
efficiency and agility according to the team scales to include more developers. Following are some key features of version
control system

 Complete change history of the file


 Simultaneously working
 Branching and merging
 Traceability

Git environment setup  the environment of any tool consists of elements that support execution with software, hardware
and network configured. It includes operating system setting, hardware configuration, software configuration, test terminals
and other support to perform the operations.

Git config command

With the help of this command we can get and set configuration variables that controls all facets of how Git looks and
operates. With the help of this command we can set git configuration values on a global or local project level.

user.name and user.email are the necessary configuration options as your name and email will show up in you commit
message.

$ git config –global user.name “subodh kumar”  this command set user name globally.

$ git config – global user.email “[email protected]”  this command set user email globally.

Git uses above user’s name and email for each commit.

There are many other configuration options that the user can set.

$ git config –list  By this command we can list all the setting that Git can find at that point.

$git config –global core.editor Vim  With the help of this command we can set the default text editor when git needs you to
type in a message. If you have not selected any of the editors, Git will your default system’s editor. Here, Vim text editor is
selected.

$ git config –global color.ui true  this command is used to configure default value of color.ui. which will apply colors to be
immediate terminal output stream. We can set the color value as true, false, auto and always.

Git configuration levels

This git command can accept arguments to specify the configuration level. The following configuration level s are available in
the Git config.

 Local
 Global
 System

1. local  this is the default level in Git. Git config will write to a local level if no configuration option is given. Local
configuration values are stored in .git/config directory as a file.
2. global  the user level configuration is user-specific configuration. User-configuration means, It is applied to an
individual operating system user. Global configuration values are stored in a user’s home directory ~/.gitconfig on
UNIX system and c:\users\\.gitconfig on windows as a file format.
3. system  the system level configuration is applied across as entire system. The entire system means all users on an
operating system and all repositories. The system-level configuration file stores in a gitconfig file off the system
directory. $(prefix)/etc/gitconfig no UNIX system and C:\ProgramData\Git\config on windows.

Some commonly used terms are:

Branch –
A branch is a version of the repository that diverges from the main working project. It is an essential feature available in most
modern version control system. A git project can have more than one branch.

Checkout –
In git, the term checkout is used for the act of switching between different versions of a target entity. The git checkout
command is used to switch between branches in a repository.

Cherry-picking –
Cherry-picking in Git meant to apply some commit from one branch into another branch. In case you made a mistake and
committed a change into the wrong branch, but do not want to merge the whole branch. You can revert the commit and
cherry-pick it on another branch.

Clone –

It is a Git utility command. It is used to make a copy of target repository or clone it. It command allows creating a local copy of
that repository on your local directory from the repository URL.

Fetch –

It is used to fetch branches and tags from one or more other repositories, along with the objects necessary to complete their
histories. It updates the remote-tracking branches.

Head –

It is the representation of the last commit in the current checkout branch. We can think of the head like a current branch.
When you switch branches with git checkout, the HEAD revision changes, and points the new branch.

Index –

The git index is a staging area between the working directory and repository. It is used as the index to build up a set of changes
that you want to commit together.

Master –

Master is a naming convention for Git branch. It’s a default branch of Git. After cloning a project from a remote server, the
resulting local repository contains only a single local branch. This branch is called a “master” branch. It means that “master” is
repository’s “default” branch.

Origin –

“origin” is a reference to the remote repository from a project was initially cloned. More precisely, it is used instead of that
original repository URL to make referencing much easier.

Pull/pull Request –

If fetches and merges changes on the remote server to you working directory. The git pull command is used to make a git pull.
The term pull is used to receive data from GitHub.

Push –

The term push refers to upload local repository content to a remote repository. Pushing is act of transfer commits from your
local repository to a remote repository. Pushing is capable of overwriting changes;

Remote –

In Git, the term remote is concerned with the remote repository. It is a shared repository that all team members use to
exchange their changes. A remote repository is stored on a code hosting service like GitHub.

Repository –

Repositories in Git is considered as your project folder. A repository has all the project-related data. Distinct projects have
distinct repositories.

Stashing –
Sometimes you want to switch the branches without commit of your current branch, in case Git doesn’t allow to do as
because, without commit your work you cannot switch the branches. To solve this problem git stash command is used. This
command enables you to switch branch without committing the current branch.

Git revert –

This command is used to revert the commit. It is an undo type command.

Git reset –

This command is used to reset the changes. The git reset command has three core forms of invocation. These forms are as
follows –

Soft

Mixed

Hard

Git ignore –

In git, the term ignore used to specify intentionally untracked files that git should ignore. It doesn’t affect the files that already
tracked by git.

Git flow –

It is branching model for Git, developed by Vincent Driessen. It is a collection of git commands. It accomplishes many
repository operations with just single commands.

Git fork –

It is a rough copy of repository. Great use of using forks to propose changes for bug fixes. To resolve an issue for a bug that
you found, you can:

 fork the repository


 make the fix
 Forward a pull request to the project owner.

Following are some important Git commands

1. Git init  this command is used to initialize our project. This will tell git to get ready to start watching your files for
every change that occurs.

$ git init

You might also like