Github is a website that provides a cloud service for developers to store and manage their code. It also provides monitoring and control of the changes made to it. Today, it is one of the most popular ways to host open source projects and share content. Retrieving source code from the website, transferring it to a local machine or developing your own Android application, many projects are supported by the site. Github presents several features that could interest many people.
This article gives you an overview of what Github really is, but also shows how to use it. By the end of this tutorial you will be able to create your own repository, both local and remote, and transfer files from a local repository to a public one. In addition, we will also show you how to create multiple branches within a single repository, in order to contribute to any project hosted on Github.
What exactly is Github?
As quoted above, Github hosts and shares projectsand allows you to contribute to other people’s projects. The site also supports all programming languages and file types. These can be images, videos, spreadsheets, or even text files. While the trend suggests that Github specializes in software development, the platform also hosts projects that don’t necessarily contain code. For example, Microsoft uses the site to store all its documentation on Azure.
On the other hand, the watchword of the website is “collaboration”. It puts developers in charge of collaborate on a projectWhether it’s working as a group or with other members. Alternatively, they can just as easily collaborate with people who want to work on a particular project and want to help. The platform remains open to suggestions and anyone can raise issues. Some manage to provide new ideas on how the site works or contribute code to someone else’s project. Github, by hosting your project, puts at your disposal a whole new team of contributors.
By encouraging this type of collaboration, Github weaves close ties between members of the open source community. Not only does this method allow the software development in an efficient wayBut in addition, it allows free access to the source code of each project. Thus, every contributor can fix bugs or add new features. Sometimes, projects drift into a basis for commercial products and distribution techniques.
Differentiating Git and Github
The two terms are often used next to each other, and sometimes even confused, although they are different. This is because, Git refers to a distributed version control tool which can work equally well on a computer. It is used to manage the source history of your project. Concerning Github, it is the cloud platform built around the Git tool. Otherwise, Git is used to connect to Github, to perform tasks like pushing or pulling code.
Note that cloud hosting services, such as Github, are used with Git, while Git can work without Github. You don’t need to create an account to do version control and work collaboratively.
Github: How to use it
There are several ways to interact with Github, some of which do not require any Git commands. First, you need to do theinstalling Git and issuing commands from your computer’s terminal (command prompt for Windows users). Alternatively, you can go directly to the “GitHub.com” site and navigate through the various menus until you find the “test” tab. Finally, it is possible to use the GitHub Desktop application for more convenience.
Once installed, you can start by creating a Github account and installing the tool Git version control tool. To do this, open your web browser, on the Github site, select “Sign up”. You will be given instructions on how to create your account.
Version control system configuration
Still on the Github website, download the latest version available for your operating system. You are given a specific command and you should copy it into the terminal window, making sure to replace “Name” with your username and ” [email protected] “with your email. Press the “Enter” key to validate this action.
Understanding Github Projects
Each project is stored in its own repository, which is itself divided into several files and folders. Although some files must be embedded in each project, it is up to the user to structure the whole according to his desire.
The README.md and LICENSE.md files
If you browse through most of the repositories, you will find almost always one of these two files. README.md contains information about the project, including the build method. LICENSE.md discloses licensing information for the project, including the developer’s wishes.
Creating a repository in Github
There are two types of repositories for hosting a project on Github: local and remote. They essentially have a folder that contains all the files you want to push to Github.
Creating a remote repository is done as follows:
On the GitHub.com sitea toolbar displays a “+” icon, followed by “New Repository”. This is simply the remote repository you are going to make. Rename it and provide a description of the project. From here you can decide whether it will be public or private. From here, you have the option to automatically generate a README.md file by checking the “Initialize this repository” box. Then enter the information you want to submit to the description.
Regarding the establishment of a local depotGit commands are required. From your computer, create a folder on your desktop. Start the command prompt and point it to the repository you just created. Then type “cd” followed by the full path to your local repository. At this point, your folder is an initial repository that can communicate with your remote repository. However, you’ll need to specify the URL of your remote repository, followed by the .git suffix. Once you’ve confirmed the command, you can commit it by pressing the “Enter” key.
Uploading a file to a Github repository
Once the remote and local repositories are connected to each otheryou can use this connection to upload files to the Github servers. You can use any file to do this, but the most common is the README.md text file. At the end of the upload, your file will be publicly available on GitHub.com, so make sure it does not contain any personal information.
The file in question will drag and drop into the local repository, i.e. the folder created earlier for this purpose. Then you can choose which items to add to the Git staging area by preparing a commit. Type “git add”, followed by the name and extension of each item you want to add to the zone. You can finally validate your changes by pressing the “Enter” key.
Branches and merging
The connection, a fundamental concept of Github, allows multiple versions of the same project to be maintained simultaneously. It is used to experiment with new features before moving on to work on the main branch.
In addition, you will find dev” and “beta” branches which contain code, but are not considered “stable”. However, they may, at some point, be integrated into the master branch over time.
By posting to the experimental code on Github, you will have access to all user reviews and comments and developers working on the project. Also, no code you are working on or have worked on is lost.
Branches are also used to develop customer-specific versions of a project. This could be a group of users or even a specific operating system. Finally, you can add a branch to your repository by pressing the “Branch: Master” button.