Git & GitHub Article

Git & GitHub Article

What Is Git?

First developed back in 2005, Git is an extremely popular version control system that is at the heart of a wide variety of high-profile projects. Git is installed and maintained on your local system (rather than in the cloud) and gives you a self-contained record of your ongoing programming versions. It can be used completely exclusive of any cloud-hosting service — you don’t even need internet access, except to download it. 

Compared to other version control systems, Git is responsive, easy to use, and inexpensive (free, actually). Git is also specially designed to work well with text files — which, if you think about it, is what code actually is. But one thing that really sets Git apart is its branching model. Branching allows you to create independent local branches in your code. This means you can try out new ideas, set aside branches for production work, jump back to earlier branches, and easily delete, merge, and recall branches at the click of a button.

And that’s it. Git is a high-quality version control system. But what about GitHub?

What Is GitHub?

In the discussion of Git vs. GitHub, it’s been said that GitHub is to Git what Facebook is to your actual face. What’s that mean? Well, it means that while Facebook is kind of like an online face database (of sorts). GitHub is designed as a Git repository hosting service. 

And what exactly is a Git repository hosting service? It’s an online database that allows you to keep track of and share your Git version control projects outside of your local computer/server. Unlike Git, GitHub is exclusively cloud-based. Also unlike Git, GitHub is a for-profit service (although basic repository-hosting features are available at no cost to those who are willing to create a user profile, making GitHub a popular choice for open-source projects).

That’s because, in addition to offering all of the features and advantages of Git, GitHub expands upon Git’s basic functionality. It presents an extremely intuitive, graphically represented user interface, and provides programmers with built-in control and task-management tools. Additional features can be implemented via the GitHub Marketplace service. And because GitHub is cloud-based, an individual’s Git repositories can be remotely accessed by any authorized person, from any computer, anywhere in the world (provided it has an internet connection). 

Through GitHub, you can share your code with others, giving them the power to make revisions or edits on your various Git branches. This makes it possible for entire teams to coordinate together on single projects in real-time. As changes are introduced, new branches are created, allowing the team to continue to revise the code without overwriting each other's work. These branches are like copies, and changes made on them do not reflect in the main directories on other users’ machines unless users choose to push/pull the changes to incorporate them. There is also a GitHub desktop application available, which offers some additional functionality for experienced developers.

Other Git repository hosting services also exist; GitLab, BitBucket, and SourceForge are all viable GitHub alternatives, and GitLab even offers a built-in option which allows GitHub users to migrate their projects directly into GitLab.

Git vs. GitHub in Simple Terms

So, taken all together: Git vs. GitHub… what’s the difference? Simply put, Git is a version control system that lets you manage and keep track of your source code history. GitHub is a cloud-based hosting service that lets you manage Git repositories. If you have open-source projects that use Git, then GitHub is designed to help you better manage them. 

After all, in the world of programming, naming conventions aren’t always intuitive. That’s why it’s worth recognizing the connections and the differences in the similarly named Git and GitHub. Both Git and GitHub give programmers valuable version-control functionality so that they can build ongoing coding projects without being afraid of messing everything up. GitHub just takes things a little bit further than Git, offering more functionality and resources, as well as a place online to store and collaborate on projects. 

And that’s essentially it.


Version Control

Development projects don’t come into existence ex nihilo; they’re built code line upon code line from the ground up. And often, there’s a lot of trial, error, and correction that goes into creating something that actually works the way it’s supposed to. That’s where version control comes in. 

Version control is like a savings program for your project. By tracking and logging the changes you make to your file or file sets over time, a version-control system gives you the power to review or even restore earlier versions. Version control takes snapshots of every revision to your project. You can then access these versions to compare or restore them as needed.

For example, let’s say that you’re working on a web development project, and through the course of your revisions, you suddenly notice all of your text has become misaligned. And because the first rule of coding is that it’s always your fault, you can bet that some change you made somewhere along the way is the cause. But not to worry; instead of having to crawl back through every line of code, you can just use your version control system to reload earlier versions, until you pinpoint the offending change and correct it.

GitHub essentials are:

  • Repositories
  • Branches
  • Commits
  • Pull Requests
  • Git (the version control software GitHub is built on)
Example
$ git push origin heroku
$ cd /etc/
$ ls



Repository

A GitHub repository can be used to store a development project.

It can contain folders and any type of files (HTML, CSS, JavaScript, Documents, Data, Images).

A GitHub repository should also include a licence file and a README file about the project.

A GitHub repository can also be used to store ideas, or any resources that you want to share.


Branch

A GitHub branch is used to work with different versions of a repository at the same time.

By default a repository has a master branch (a production branch).

Any other branch is a copy of the master branch (as it was at a point in time).

New Branches are for bug fixes and feature work separate from the master branch. When changes are ready, they can be merged into the master branch. If you make changes to the master branch while working on a new branch, these updates can be pulled in.


Commits

At GitHub, changes are called commits.

Each commit (change) has a description explaining why a change was made.


Pull Requests

Pull Requests are the heart of GitHub collaboration.

With a pull request you are proposing that your changes should be merged (pulled in) with the master.

Pull requests show content differences, changes, additions, and subtractions in colors (green and red).

As soon as you have a commit, you can open a pull request and start a discussion, even before the code is finished.

A a great way to learn GitHub, before working on larger projects, is to open pull requests in your own repository and merge them yourself.

You merge any changes into the master by clicking a "Merge pull request" button.




To view or add a comment, sign in

More articles by Kapil Shav

  • Introduction to K means Clustering

    k-means clustering is a method of vector quantization, originally from signal processing, that aims to partition n…

  • What Is JavaScript

    JavaScript is a scripting or programming language that allows you to implement complex features on web pages — every…

  • Docker App

    A mobile app through which we can do all the things that docker can do, easy to use with good UI. User can create…

  • Article On The Cyber Crime & Confusion Matrix

    What is cybercrime? Cybercrime is criminal activity that either targets or uses a computer, a computer network or a…

  • WHAT IS KUBERNETES?

    Kubernetes, or k8s for short, is a system for automating application deployment. Modern applications are dispersed…

  • RedHat Expert Session on Kubernetes and OpenShift

    What is OpenShift? OpenShift is a family of containerization software products developed by Red Hat. Its flagship…

  • 3 Challenges for Network Engineers Adopting Ansible

    Ansible, ansible, ansible seems to be all we hear these days. There are lots of resources out there all trying to…

    1 Comment
  • Launch Instance with CLI in AWS

    Create a key pair Command for creating key-pair through CLI>>>aws ec2 create-key-pair --key-name kapil02 Create a…

  • The benefits which MNCs are getting from Artificial Intelligence(AI) and Machine learning(ML)

    Have you ever thought how AI/ML helps the top MNCs to achieve there business goals, not only top MNCs but almost all…

    1 Comment
  • What Is Cloud Computing?

    Cloud computing provides a variety of different services via the Internet, which can include storage, networking…

Others also viewed

Explore content categories