An Introduction to GitHub
By: Rakhi Ghangas
Tags: Github, Git, Github Actions

GitHub is a code hosting platform for version control and collaboration. It hosts millions of lines of code, and millions of developers use it to collaborate and to report issues with open source software. It lets you and others work together on projects from anywhere.

Ah! Version control! Quite a heavy word yeah ??

Let me help you to understand it.

Version control basically means that it is a tracker for what you have done so far on it, say your code. So, the code which is stored in GitHub keeps changing as more code is added. Also, many developers can add code in parallel. So Version Control System helps in handling this by maintaining a history of what changes have happened. Also, Git provides features like branches and merges, that shows the actual tree-like structure.

Though anyone can use GitHub to keep track of the changes they are making in their files, but most developers use it either to host their code or to collaborate with other developers.

Here, you will get to know about some of the key features of GitHub.

Some important terms you will learn later in this article are:

Repository Commit Branches Master Merge Pull Request Fork GitHub Issues

Let’s study these in more detail here:

Repository: A directory or storage space where your projects can live. Sometimes GitHub users shorten this to “repo.” It is like a folder for your project. IT contains all the files for your project and stores each file’s revision history.

You can own repositories individually, or you can share ownership of repositories with other people in an organization.

What does that mean? This basically means that a repo can be public or private. You all know what public and private is. but let us revise it again.

Public repo is visible to everyone. The private repository can be viewed and contributed by the owner only. Also, one can have an unlimited number of repositories.

Commit: In normal language, you can say commit is just like the save button. you save what you have done. It is an individual change to a file (or set of files). Every time you commit, it creates a unique ID (a.k.a. “hash”) that allows you to keep a record of what changes were made when and by who. Commits usually contain a commit message which is a brief description of what changes were made.

Branches: Till now you know that multiple people work on a project at the same time. But you must be thinking about why they are not confused? This is where branches came to the role. Usually, they “branch off” of the main project with their own versions full of changes they themselves have made. A branch is a parallel version of a repository. It is contained within the repository but does not affect the primary or master branch allowing you to work freely without disrupting the rest of the branches or master. When you've made the changes you want to make, you can merge your branch back into the master branch to publish your changes. You will learn about merge later. You can use branches to:

Develop features

Fix bugs

Safely experiment with new ideas

Master: By default, your repository has one branch named master which is considered to be the definitive branch. When you create a branch off the master branch, you’re making a copy of master as it was at that point in time. We use branches to experiment and make edits before committing them to master .

If someone else made changes to the master branch while you were working on your branch, you could pull in those updates.

Merge: To take the changes done on one branch to the master, we use merge. Merging takes the changes from one branch (in the same repository or from a fork) and applies them into another. This often happens as a pull request (which can be thought of as a request to merge). A merge can be done automatically via a pull request if there are no conflicting changes.

Fork: fork is just a copy of the original repo. Just like in your computers, you make a copy of something so that the changes you make into that copy will not affect the original file. The concept is same in GitHub just a different name — Fork. Forking a repository allows you to freely experiment with changes without affecting the original project.

Most commonly, forks are used to either propose changes to someone else’s project or to use someone else’s project as a starting point for your own idea.

GitHub Issues: Issues can act as more than just a place to report software bugs. These can be feedbacks or some required changes or issues with your code..like anything. You can collect user feedback, report software bugs, and organize tasks you’d like to accomplish with issues in a repository. They’re kind of like email — except they can be shared and discussed with the rest of your team. The dashboard works very similar to the issues section, but collects issues differently:

All issues in repositories you own and collaborate on

Issues assigned to you

Issues you’ve created

In the end, I hope this tutorial will help you get started with GitHub but go on further to get some real experience of working on GitHub.

Good Luck!