Working with git and GitHub

Cloning

Using git for version control, most of our repositories will be hosted on GitHub. To clone an existing repository into your machine, run:

git clone https://github.com/<repo_addres>

If the repository is private, you will have to enter your credentials next.


Updating your local repo with pull

To update your code with changes from the remote repository, run:

git pull

This will pull the changes from remote to your local codebase.


Commiting and pushing changes

Once you have changes to push to the remote server, you must add the files with:

git add my_file.py

Note that you can add multiple files this way.

Then, you have to commit your changes and include a message (make it descriptive):

git commit -m "Fix invalid index bugs on lines 10-14"

Finally, push your changes to the remote repo:

git push