Updated March 29, 2023
Introduction to GitHub Basics
GitHub Basics is defined as a collection of elements that contributes to understanding the fundamental functionality and lays the essential foundation and acts as a starting point for users so that one can delve into the concept of GitHub in-depth as per the requirement of the user. GitHub is a widely used tool for version controlling and is a pioneer in being the collaboration platform for software developers. It facilitates the open-source concept or, in other words, the social coding concept among the software developers and provides them a web interface for the Git code repository along with tools that can effectively manage the same.
GitHub Basics Overviews
- By now, we do know that GitHub is very useful for a team that works for a common goal, i.e., completing the features of a project. For example, an analytics team is working on building an end-to-end pipeline of building a data flow, then training the model with a regular cadence and storing the same. Post that, use the stored model to predict the KPI as per the requirement and show the result in a web UI. Here, there will be many teams involved, and each has their ownership of building the features. However, these features collectively achieve the dream of the product.
- One would argue that why not use the regular file sharing ways viz. Dropbox, Google Drive, or any other cloud storage device. But assume that 2 team members are working on the same file, and in a regular file-sharing medium, anyone who saves the files first gets the precedence. With this shortcoming being resolved by GitHub, it has become one of the most popular tools across the software development community, which avoids any confusion or chaos amongst the different files getting uploaded by the method of version control and branching.
Getting Started with GitHub Basics
GitHub as a product has a lot to offer. It provides free and paid ones to the users, and one can decide on which one to use.
- Free Account
- GitHub Pro Account
- Free Account for Organization
- GitHub Team Account
- GitHub Enterprise Account
First of all, the concept is to sign up for GitHub. One can start creating a free account by going on to www.github.com, and on the top-right corner, one can find the sign-up button.
Here, we would be asked for an email that needs to be entered and some subsequent details to build an account for usage. Once the account is created, one would need to install Git on the computer. Git is the backbone of the version controlling methodology of GitHub, and the application helps in putting the required files on to the cloud system of GitHub from the local version on PC.
The next few elements, some of which we will see in detail in the subsequent 3 paragraphs, are:
- Creation of the repository
- Creation of a branch
- Changes commit to the branch
- Opening a Pull request
- Merging a pull request
How to Use GitHub Basics?
- In creating a branch, when a project consists of multiple versions and is multi-faceted, branching enables editing of multiple versions of the repository at once. With having a definitive master branch, other versions can be individually edited before committing to the master branch.
- In the context of committing changes to a branch, one would need to click on the pencil icon and make the necessary edits. Once the edits are complete, the changes need to be described by mentioning them in the commit message and then click on commit changes.
- To merge the changes to another person’s branch, the user has to open a pull request. With the pull request, the relevant parties are notified about the changes that will be incorporated as a part of the branch. Red and green highlights show the differences in the content of both files. For creating the pull request, one would need to go to the pull request tab and hit the “new pull request” button. Then one would need to find the branch where changes are made, look at the differences with the other branch, say master, and then click on “Create pull request.” Next, the pull request needs to be titled, and the changes need to be described. Finally, click on create a pull request to finish the task.
- When on the receiving side of merge request, where one would need to click on the “merge pull request,” click on “confirm the merge.” Once the merge is done, the branch can be deleted.
How to Create a Remote Repository?
In order to create a remote repository, the user would need to run the git remote add command in the original repository directory in windows. This command takes 2 arguments, namely, keyword origin and a remote URL, which can be found in the web version of the repository.
Location of the URL in web version:
Command-line:
Features of GitHub Commits
The command for Git commit is git commit which creates a snapshot of the repository.
The features provided by this functionality are as follows:
- Revert: This feature is like an undo of the last commit that was made. However, it doesn’t delete the existing commit, and hence the repository’s history is not sacrificed.
- Reset: In some cases, the commit might contain sensitive information that can’t be a part of the commit and hence needs to be deleted without having its trace in the history. This is where the rest feature helps the user big time.
- Reflog: This acts like a log file for any commit made as a part of revert or resets, on other words, any commit that HEAD has pointed to.
Conclusion
Post our learning about different facts of GitHub basics, we have now come to an end of this article and would encourage our readers to try out the basics mentioned here and then dive into the advanced part of GitHub to fully leverage the functionality of GitHub.
Recommended Articles
This is a guide to GitHub Basics. Here we discuss introduction, overviews, how to use GitHub basics? how to create a remote repository? & features. You may also have a look at the following articles to learn more –