Before starting with GitHub, let's check few of the important terminology used in the GitHub. They are as follows Branch, Pull request, Clone, Fork, Remote and Upstream.
Let's understand what the different benefits of the GitHub are as follows:
- Public & Private Repository
- Branches
- Code History
- Pull Request
- CI/CD Pipeline
- Collaboration
- Code safety
Public & Private Repository
One of the most important benefits of GitHub is we can create the private or public Git repository. So what actually the public and private git repository is.
What is GitHub Private Repository?
Here if we are saying a Git repository is Private on that code available in the private repository is not accessible to other users. It can be accessed by only by authorized users. It is created confidential projects or in an internal project where code security is major concern.
What is GitHub Private Repository?
Public git repository is the repository code is accessible by all the users. Here public repository does not require any kind of authentication. All user having the repository URL will be able to download the code. Public repository is meagerly used in the open-source projects.
Branches
Branch in Git repository is used for creating a separated isolated repository of the master repository. Branch will help developer to make change into the code without touching the mail code or the master code.
Branched in git help us to manage the code as per bug, feature or by story. Here to merge the branch with main we need to create the pull request. It helps better code management as per changes. The main feature of Branches in Git is Isolation, lightweight, current development, good for experiments.
Whenever we create a branch at that time Gir will create a new isolated repository same as master. In this branch you can safely and independently commit your code. So here question is coming why we need a branch. We need a branch for feature-based development, Bug fixing and for written code review. It provides better team based development.
Code History
Code history of Git help of the manage the previous change made on a specific piece of code. Whenever any user commit the code Git take the at the time a unique snapshot of current project state gets created. The commit history contains all the detail like author, commit date, user added comment. It helps us to keep the better track of why the specific change have been made and what the change have been made in the code.
Pull Request
Pull request is a request which is designed to "pull" the changes from one branch to another branch. If a user created a branch for and wanted to merge it with main or master branch on that case, he needs to create a pull request.
Pull request help the other team member to review the written code for better collaboration. Through pull request other team member can provide his feedback to improve the code quality. Whenever we create a pull request at that time build validation take place. It makes sure that the current code is breaking the current the build or not.
So how exactly pull request work, so for this first create a branch, commit your changes, push the changes to the repository, after this we will need to create a pull request. In this we need to provide the clear title, detail about the change and the reviewer's names and other necessary detail. After creating the pull request, you need to review the code changes. Merge your changes into the mail branch. On merging the code, you will get option to delete the current branch.
CI/CD Pipeline
Collaboration
Code safety
As all we know GitHub provide a very powerful safe and secure environment for the code and better control on code repository. GitHub allow user to create the public and private repository. Here private repository is accessible for group of people and public repository. On other hand public repository to available all the users.