4.2 Github
4.2.1 Introduction
GitHub is a platform for hosting, storing, and editing code. It facilitates projects organization and team collaboration. The platform is built around “Repositories” used to organize code for projects.
Here is the official website: https://github.com/.
MBAn students will use Github for team projects in MBAn501 Team and software management in the summer term. And students can also find many resources about programming on the platform.
4.2.2 Main Features
Hold Code in Repositories
Users use Github to hold and organize projects. All the code and documentation are stored in “Repositories”. There are many tools and features for users to customize their repositories and manage their projects.
Tools | Details |
---|---|
Add Collaborators | Developers and project managers can work on projects together in Github using the “Add collaborators” tool. |
Issue | Developers and project managers can collect user feedbacks and organize tasks using the “issue” feature. They can also use it to priorize issues. |
Branch | Developers can create a “branch” to work on their changes. Once they’ve finished, they can merge the branch back into the master branch. |
Version Control of Github
Version control of Github tracks what and when each developer changes, and allows users to roll back individual changes without affecting other changes down the timeline.
Open-source Projects Resources
GitHub is one of the largest communities for the world’s top developers, where you can find almost anything you want. There are many great, famous open source projects shared on it, and you can use and download them for free while abiding by their Licenses.
Get Help from Other Developers
Developers can ask and answer questions, share codes using the “discussion” feature. As you share your codes, other developers can participate to help you fix bugs, improve project features and quality.
Use Github Pages to Build Your Websites
GitHub Pages provides a static web hosting service that fetches HTML, CSS, and JavaScript files directly from repositories on GitHub, then builds and publishes the site [GitHub (2022)](Gaba 2022)
4.2.3 Tutorial
Step 1: Installation
The first step is to install Git. You can install Git-Downloads.
You can also refer to the Installation Options to install Git.
Step 2: Start a Repository
After you sign in your GitHub account, you can see the “Create a new repository” button in the middle of the home page. Click it, then you can fill up your “Repository name”, description, and complete other settings.
Although “Add a README file” is optional, we recommend you to create one that describes your project briefly to the GitHub users.
Step 3: Add New Collaborators
After you create your repository, you can view your repository by clicking the right upper corner of the page to enter “Your repositories”, or to enter “ Your profile” and then “Repositories”.
Then, you can click “Setting” to manage your repository. We recommend you to add all your team members by going to “Collaborators”.
Step 4: Create an R Project
Then, open your RStudio. Click “File” on the left upper corner of RStudio, then “New Project”.
Choose “Version Control”, then choose “Git”. The next step is to copy the URL link of your repository, and choose the directory of your project.
Then, everything is done! Now, you can see current files in your repository on the right side of your RStudio. You can also add new files, edit current files in your repository.
Step 5: Commit, Push and Pull
After you add or edit files, you have to commit and push your changes to repository. Go to the right upper side of your RStudio and enter “Git”. Then, select files and click “Commit”, and you will need to select files again, input commit messages before you confirm your “Commit”.
Then, click “push” on the right upper corner to push your changes to the repository.
In addition to commit and push, you also need to update changes to your local files by using “Pull”.
A kind reminder: you may need to wait for several minutes between pushing and pulling for the first time.
4.2.4 More Resources
For more tutorials about GIT Push and Pull, please refer to Git Guides
For more advanced tutorials about Github, you can refer to GitHub Tutorials, Happy Git
If you want to build your own book using GitHub, here is a useful tutorial for you. Bookdown Tutorials