A simple guide to using GitHub to host your complex code. Sam Liebman. Toward Data Science, 2018.
GitHub is an essential tool for programmers around the globe, allowing users to host and share code, manage projects, and build software alongside a growing base of almost 30 million developers. GitHub makes collaborating on code much easier by tracking revisions and modifications, allowing for anyone to contribute to a repository. As someone who only recently started programming, there have been countless times where GitHub has been a literal lifesaver, helping me learn new skills, techniques, and libraries. Yet, sometimes a simple task on GitHub such as creating a new repository or pushing new changes is more daunting than training a multi-layer neural network.
- Creating a Repository
A GitHub repository (“repo”) is a virtual location on GitHub where a user can store code, datasets, and related files for a project. How to create your repo:
Clicking on the new repository button on the homepage will bring you to a page where you can create a repo and add a name and brief description of the project. There is an option to make your repository public or private, but the private feature is only available to paying users/companies.
You can also initialize the repository with a README, which provides an overview and description of the project. Adding a README to your repository is highly recommended.
- Initialize your Git
The next step involves using your terminal to initialize your Git and push your first commit. Git is not the same thing as GitHub, although they are related. Git is a revision control system that helps manage source code history and edits, while GitHub is a website that hosts Git repositories. In layman’s terms, Git takes a picture of your project at the time of each commit and stores a reference to that exact state.
- Adding Files to Repository
The process for adding changes to your GitHub repo is similar to the initialization process. You can choose to add all the files in your project directory in one fell swoop, or add each file individually as edits are made. For a multitude of reasons, discovered through trial and error, I highly recommend pushing each file individually.