DEV Community

Cover image for Day 8 : Basic Git & GitHub for DevOps Engineers.
On-cloud7
On-cloud7

Posted on

Day 8 : Basic Git & GitHub for DevOps Engineers.

What is Git?
Git is a free open source distributed version control system you can use to track changes in your files. You can work on all types of projects in Git, from small to large.

With Git, you can add changes to your code and then commit them (or save them) when you're ready. This means you can also go back to changes you made before.

What is Github?
GitHub is a web interface where you store your Git repositories and track and manage your changes effectively. It gives access to the code to various developers working on the same project. You can make your own changes to a project at the same time as other developers are making theirs.

If you accidentally mess up some code in your project while making changes, you can easily go back to the previous stage where the mess has not occurred yet.

What is Version Control? How many types of version controls we have?
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 versions later. It also allows you to work together with other programmers.

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 versions of the code with an older version to fix the mistakes.

Two Types of Version Control System-

1.Centralized Version Control System.

2.Distributed Version Control System.

Centralized Version Control System-

The developers needed to collaborate with other developers on other systems.To deal with this Centralized Version Control System were developed.

Image description
Centralized Version Control System uses a central server to store all the database and team collaboration. But due to single point failure, which means the failure of the central server, developers do not prefer it.

Distributed Version Control System-

The user has a local copy of a repository. So, the clients don't just check out the latest snapshot of the files even they can fully mirror the repository. The local repository contains all the files and metadata present in the main repository.

Image description

DVCS allows automatic management branching and merging. It speeds up of most operations except pushing and pulling. DVCS enhances the ability to work offline and does not rely on a single location
for backups. If any server stops and other systems were collaborating via it, then any of the client repositories could be restored by that server. Every checkout is a full backup of all the data.

Why we use distributed version control over centralized version control?

In centralized version control, the versions are saved in the remote repository, while in distributed version control, versions can be saved in the remote repository as well as in local repositories of the local machines.so we prefer DVCS over CVCS.

Task:

1.Create a new repository on GitHub and clone it to your local machine

Image description

Image description
Image description
Image description

2.Make some changes to a file in the repository and commit them to the repository using Git

made changes to "fromgithub"

git init=To make new git repo/git-init - Create an empty Git repository or reinitialize an existing one.

git add fromgithub==Ready to be staged

git commit -m "Added changes"==To save changes.

3.Push the changes back to the repository on GitHub.

git push origin master ===To push from Local to remote.

Image description

Thank you for reading!! Hope you find this helpful.Thank you for reading!! Hope you find this helpful.

Top comments (4)

Collapse
 
linuxsuze profile image
Leonardo Zuñiga

Thank you for sharing

Collapse
 
oncloud7 profile image
On-cloud7

You're welcome! I'm glad I could help@linuxsuze

Collapse
 
litlyx profile image
Antonio | CEO at Litlyx.com

Thanks for sharing this knowledge. A lot of people will benefit from this!

Collapse
 
oncloud7 profile image
On-cloud7

Thank you @litlyx