5.4. Git Basics#

Version control is a good idea for any software project. For your work in this class, it will be required. The development environment will periodically wipe your directory, so if you haven’t pushed your changes to a remote repository, you will lose all progress. We recommend committing and pushing your code often to avoid losing your work.

If you are completely new to GitHub, we recommend this guide to help get you started. This documentation site will also be helpful.

Since you will not be collaborating on code, much of GitHub’s functionality will be unnecessary. The following five commands should cover everything that you need for making sure you don’t lose your work.

5.4.1. git clone <repourl>#

Clone a remote github repository to your machine.

5.4.2. git status#

See the status of the working directory and the staging area. It will show you which changes are and aren’t being tracked by git and which changes have been staged.

5.4.3. git add <files>#

Stages a given change to go into your next commit.

5.4.4. git commit -m "what you changed"#

Commit any added changes. Once a change is committed it is safely stored in your local database.

5.4.5. git push#

Push your local commits to the remote repository.