Getting Started with GitHub in 7 Minutes
From our Robotics Leader: Abhinav Gandhi
Hey y’all! How’s it going? It’s been a while since I thought of doing a quick and easy tutorial for getting started with GitHub, but it’s finally here! I hope you like it.
“GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.” – as stated on their website. It’s a great service for collaborating on open source projects and documenting your own projects, plus it’s FREE! (as long as you agree to make your work accessible to everyone on the internet). As the name suggests, it is built on Git which is a Version Control System for computer software i.e, it tracks changes made to software throughout its living history. So basically, you can see what the original version of the code/document looked like or what it looked like a few months before.
GitHub’s website and desktop software make it fancy and easy to use without a command line. However, if you are one of those geniuses who think it’s faster and easier to use a command line, you can do that as well. I’ll you how to create a new account on GitHub. I will create a temporary account in the name of “blah09” with my secondary email address. I hHope you’re ready to get started with Github!
Disclaimer: I getting started on Github takes 7 minutes, but this depends on your internet speed, how fast you read, type, and a number of other factors. The post has about 800 words. This means you would have to average about 3.5 words/sec to give yourself enough time to setup your account.
STEP 1 – Navigate to Their Beautiful Website!
Go to the GitHub Website. Make sure to open it in a new tab, unless you want to find yourself clicking the back button to look at step 2!
STEP 2 – Create an Account for Github
To do this, you must enter a username, an email address, and a password into the field in the right corner. Fairly Simple? Avoid using a common username like ‘blah’ unless you want to waste another minute trying to manipulate it into various ways to find some form of ‘blah’ that has not been used.
STEP 3 – Choose an Account Type
I would recommend choosing the free account (it comes with unlimited public repositories), unless of-course you are designing plans for the next million dollar product! In that case you should definitely shell out the 7$ a month for a private repository.
STEP 4 – Fill in your Preferences
Not snipping this one, it’s kind of repetitive.
STEP 5 – Celebrate!
You have successfully created a GitHub Account. Read on to learn how to get started with Github to control and document your projects!
Using the Web Interface
Creating a new Repository –
“A repository is basically a folder for a project, you can share the repository with people and add contributors for the project into the repository. You can add different files to the repository along with a README.md file which has a description for the project and talks about the different files in the repository.” -Github User Guide
Click on the “+” sign next to your profile picture and then click on “New Repository” on the drop-down menu.
That should direct you to a page where you are asked to name and describe the repository. Check the “Initialize this repository with a README” option. This creates a README.md file where you can describe your project and instruct users on how to download and use code/designs from your repository. This is also helpful for providing links to other useful resources and talking about issues you might have faced while implementing the projects.
Once you have clicked on the ‘Create Repository’ button you will be directed to the repository you just created.
Editing the README –
You can double click on the README.md by clicking on the edit icon on the top right to open and edit it (the one that looks like a pencil).
Commits and Branching –
“A commit is like a change that you make and save to your repository. Commits are only saved if you remember to push them to GitHub’s servers after making the changes to your folder. It is useful to have meaningful descriptions and names for commits so as to make it easier for the rest of your team to understand what they are.”-Github User Guide
Once you are satisfied with your edited document, scroll down below to commit changes. But wait, before you commit changes, add a title and/or a description to the commit. This will help you and/or others in your team to understand the changes made in every commit. Also, before you commit, select whether you want to commit the changes to the master branch or if you want to create a new branch.
“A branch is a copy of the original repository. You can branch a repository to work on a time-consuming section of the code or to test a new feature without affecting the original stuff. Branches can be merged with the original repository by creating a pull request once you are done updating the sections of the branch.” -Github User Guide
Creating a new branch helps you and your team evaluate your new code before it is committed to the master code. This is a good thing to do if you don’t want your master file to crash due to a bug in the new commit. Once you are done inspecting/testing the new branch, you can merge it to the master branch.
To create a new branch, click on the branch menu on the left side, type in the name for a new branch that you want to create, and click on the “create branch” option that’s shown in the screenshot below.
This is more than enough for you to get started with GitHub. Once you feel comfortable with this, try to find out more about pull requests. And stay tuned for my next post about GitHub Desktop!
Abhinav Gandhi is the Leader in Robotics at DIY Hacking. He is passionate about democratizing Robotics and assistive technologies. And is currently pursuing studies and research as a visiting student at Massachusetts Institute of Technology. He is a full-time undergraduate student at SRM University, India.
Contact: [email protected]