Github is a code hosting platform that lets you and others work on the same project simultaneously. Github is the largest community of Developers where anyone can contribute to the project.
By making a separate branch of the code a dedicated area is assigned to the developer so that there won’t be any clash between the production-ready code and the code in review.
It keeps checks and flags that keep records of Who has done or written which line of code. It also helps to review each other’s code and others can suggest which is a better approach for solving the same problem. Not only developers but users of the product can also suggest what are other features that can be added to it. Github can be used for any language of Computer Programming.
Explanation with an example.
Suppose a person is a Java Developer and he has a team of 3 People working with him.
All three of them live in different countries.
Rahul, Mike, and Jane
They together made a video game which is played by many players around the world. One player suggests that it would be better if they could chat during the game with their friends.
- Rahul is the first to see the issue that has been raised by a player and he thinks that Jane is the best person for this problem.
- Now Jane sees this and makes a separate branch from the master branch and starts to work on the problem after writing hundreds of lines of code. She publishes the code for the others to review.
- Mike sees the code and thinks what if we use a simpler approach for the same and delete 10 lines and add 12 new lines.
Now Rahul sees the code, reviews it, and publishes it to the production code and the issue is resolved. Now the code is production-ready and he merges the code with the main branch and closes the issue.
And now all the players can chat during the game and all this is done without actually developing in the game but changes are made via updates and versions.
What is a Repository in Github?
- It contains all the files and folders of the project for easy setup of the code.
- The repository stores the ReadME file and all the licenses of the code.
- It can also be used to store ideas for the project.
What are Branches?
There are many types of branches. Like there is a master branch. This is the default branch made by Github itself and is the main branch.
There is an Integration branch that is made available for the different team members of the project and all the code is written here and later merged into the Master branch. It is just a copy of the master branch
What is the Issue with Github?
An issue in Github is used to mention team members, assign tasks, request new features, and reporting of bugs in the product on Github.
What is Commit?
Changes in the code in GitHub are called Commit. Each of the changes or commits in the code is tracked by Github for future use.
What is Pull Request in GitHub?
Pull Requests are the heart of GitHub collaboration. With pull requests, developers can merge the sub-branch to the master branch. If there are no conflicts Github will automatically perform the merging with just a click of a button.