28
Git and Github
Github launched in 2008, and became very popular because of its saas (software as a service ), providing a cloud based hosting service. But it is in fact git, that powers it. Below I'll explain Git and Github.
Git is a version control system. What that means is that it tracks and manages changes to the software code.
There are a few version control systems out there, and an advantage that git has over them is that it is a newer, more modern implementation of version control. It is fast, because it is lightweight, so it runs quick.
Another advantage that git has is that it provides a history of content changes that happen, and it allows for team based collaborative development to take place. So all the people collaborating have access to not only the code that is being shared, but a history of changes that have been made, or will be made.
The way in which git helps collaborative development is by taking a trunk based approach to development. So what happens is that a developer gets a copy of code, makes changes, and then merges it back into the main file. I'll explain this while defining terms below:
Repository: Your project folder. This would contain all your project files.
Branch: A version of the repository that diverges from the main project repository.
Clone: Make a copy of the repository.
Fork: Make a copy of the repository on Github.
Commit: We open code from our copy of the repository, and if we like changes to our code, we commit the changes to our copy of the repository.
Push: Transfer code from our copy of the repository to the original project folder.
Pull and merge: Since multiple users are working on the repository, another user might have pushed code into the main repository, and the code might have updated in the main repository. So once a developer completes their changes, they get the code or pull it from the main project repository, and merges it with their own code.
Merge conflict: The developer has modified the same code as another developer who has already pushed their code into the main repository. So the developer works with the code, and makes changes accordingly.
Pull request: Once conflicts are resolved. The developer puts a pull request that notifies every member that changes need to be reviewed.
Approve pull request: The main repository owner approves the pull request.
Merge: The main repository owner now merges the code into the main branch.
So a developer clones the main repository. A branch gets created where the developer works on their copy of the repository. Edits are made by the developer and they commit the changes to their copy of the repository. They pull, and merge the code from the main repository to their own repository. If there is a merge conflict, these are resolved. A pull request is sent to notify members that changes need to be reviewed. Once everything looks good. These changes are approved and merged with the original project folder.
While using git, the main repository files of a project are stored on a local or a cloud network, and files are accessed and modified using command line on a computer.
Github took this implementation of git, and provided a cloud service, where the files were stored, and the files could be accessed and modified. This would mean that people could see, access and make changes to files using GitHub. Since command line is not required, this also made it very easy for people not that familiar with coding to have access to the progress of a project. GitHub provides open source projects, which also made people have access to a huge directory of projects to clone or as GitHub calls it fork them.
The following actions can be done in GitHub to create, clone, commit, pull, merge, and push a repository:
Below we used the account boywithabeard(the one in dark theme) to create the main repository, and bigdig to clone the repository (the one in light theme).
Go to the home page, and then click on the green new button on the top left side:
Enter a repository name, in this tutorial we have named it: Tutorial, and then click on create repository:
Go to a repository. On the top left side you would find the word fork. Click on it, and you would get your own copy:!
You can click on your pull request in your repository. Now you and the main repository owner, can add comments and discuss the issue:
Check out the video where I go over the concepts mentioned above:
Youtube Video
28