GitHub is a web-based platform used for version control and simplifies the process of working with other people from anywhere.
If you have ever worked with a team of professionals on a project especially software development then you’d realize the importance of having platform where you all can upload, edit, and manage the code files.
Learning how to use a GitHub is a must for all web or software developers who intend to efficiently and effectively do their work and show results. A team of professionals who also wish to beat their time and ensure effective work on their projects would need to learn how to navigate through the platform.
GitHub allows them to build a repository that is likened to a storage file where they can all upload and view files. In GitHub, you can also build a strong social network, based on your past contributions and projects. A software developer can always make changes to a repository, saves it as a new repo.
If he then wants the original developers of the project to add the update he made to the official repo, he could ask for collaboration in a process known as a pull request and if approved, they can all work together. Whereas before now, this would take a long process of sending emails and determining which of the mails are not fraudsters or incompetent.
Often times people confuse GitHub with Git, but a point to note is that GitHub is a hosting platform for version control or collaboration whereas Git is a command-line tool that allows you to perform all types of operation from the central server.
If you are searching for a guide on how to navigate through the GitHub platform then this content is for you. By the time you are done reading you should have gotten used to the basics of using GitHub.
To learn how to use GitHub follow the following steps:
CREATE AN ACCOUNT ON GITHUB:
Table of Contents
For a start, you’ll need to first create an account using nothing more than your device and an internet connection. Click on GitHub.com and follow the steps.
CREATE A REPOSITORY
A repository (or repo) is a location where all the files for a particular project are stored. It is just like a storage space where your project lives, it can be likened to a folder on your local computer. To create a repository, simply follow the steps;
- After signing up on the GitHub page, click on “Start a Project”.
- Then choose a repository name that should ideally be short and memorable. E.g. Content-Style. You would notice that the default setting for your repository is public which means that anyone can view the contents of your repository and it is a free version. The private setting is paid and you will be the only one that can view its contents.
- You will also have the choice of adding a description to your repository and including a README. The README enables you to clone your repository to your computer which is the same thing as downloading your repository.
- After this, then click on “Create Repository”.Tada! You have just successfully created your repository and ready to perform all other operations.Congratulations! Let’s now go ahead to learn how to branch, commit, merge, and pull requests.
BRANCHING
Branching is a way of creating different versions of a repository at one time. By default, the first repository is the master branch. If you want to make some changes to the repository but not sure how it would turn out, branching is used. Branching is just like when you make another copy of an original project, and saving it differently after making your changes. This would help you decide if that’s something you will like to work with, then proceed to merge it with the master branch.
To create a new branch:
- Go to your new repository which you have earlier created – Content-Style.
2. Click the dropdown at the top of the file that says branch: master.
3. Type a branch name Content-edits, into the new branch text box.
4. Select the blue Create branch or press Enter on your keyboard.
Now you have two branches, the Content-edits, and the master branch, which are exactly the same at the moment but not after you have committed a change.
COMMIT CHANGES
On GitHub, saved changes are referred to as commits. This helps you to save the changes in your file, when you commit a file it is always necessary to include a description message.
This will help you remember why you sought to make the change and also help other contributors better understand what you have done and why.
It will also help you differentiate the various versions of commits you have done easily without getting confused.
To make a commit:
- Click on the new branch; Content-edits
- Click on the edit icon at the right corner of the file.
- After clicking that, an editor will open and you will make your changes.• Write your commit description message.
- Then click on Commit changes in the end.
That’s it! This new branch is different from our master branch, which you can now choose to pull a request or merge with the master branch.
PULL REQUEST
Pull request is a very important operation in GitHub. It is the heart of collaboration. Once you have made your changes, you can open a pull request and by this, you are asking that someone else looks over your changes and pull in your contribution and merge them into their branch.
Pull requests show the differences in the contents of both branches you have selected. The differences are shown in green and red.
To pull request:
- First, open the pull request tab, and from the page, click the green New pull request button.
- In the Example Comparison box, select the file you have changed – Content-edits, to compare with “master” which is the original branch.
- Review the changes on the compare page, and if you are satisfied that these are what you want to submit, then click on the big green Create Pull Request button.
- Give your pull request a title and write a short description of your changes.
- After this then click on Create Pull Request, and that is it!
MERGING
Merging your pull request is the final step, that is bringing your changes together by merging your content-edit with the master branch.
To do this, you first click the Merge pull request button, then click on Confirm Merge.
This merges the changes into the master branch.
After this, you can delete the branch since the changes have been merged with the master branch by clicking on the Delete branch button in the purple box.
Other operations include cloning and forking. Cloning is a really simple operation to perform on the platform. Suppose you want to use the contents of a public repository, you can copy the contents by cloning or downloading it.
Forking is when you create a new project off another project that already exists. If you find a project that you would like to contribute to, you can fork the repo and make the changes you would like then release the new repo.
To fork a repository, go to explore and search for public repositories, click on “fork”. After this, it will take some time for the operation to be successful after which you will notice that the repository name is under your account.
With this, you’ve learned how to perform basic operations in GitHub
.Note that when you take a look at your profile, you’ll see the number of your contribution squares which shows your level of activeness on the platform.
Yes! Finally someone writes about acne and dry skin. Guillema Lindsay Simmonds
Great article! We will be linking to this great content on our site. Keep up the great writing. Harli Fleming Raphael