GitHub Review

Further details on GitHub and Anaconda

Danilo Freire

Department of Quantitative Theory and Methods
Emory University

04 September, 2024

Lecture Overview

Learning Objectives

By the end of this lecture, you will be able to:


  1. Understand the difference between cloning and forking a repository​
  2. Learn how to remove cloned repos​
  3. Understand the GitHub workflow: change, commit, push, fetch, pull​
  4. Learn how to keep a forked repository updated​
  5. Understand what a virtual environment in Anaconda is and how to create one if needed​

Software Installation

What we will use in this course

GitHub Review

How to access and edit a remote repository


  • Access: download a remote GitHub repository to your local computer to work on it​
  • Edit: make local changes to the repository and update them to the cloud​

There are two ways to access a repository:​

  • Cloning ​
  • Forking - We will use forking in this course​

Cloning

  • Makes a local copy of a repository
  • Think of it as downloading a repository onto your local computer
  • Unlike forks, clones reference the original repository: you cannot push changes to it unless you have permissions from the owner
  • If you do have permissions, you can overwrite the content of the remote repository

Cloning example

  • Example repo: https://github.com/danilofreire/qtm151-example-repository

  • We can clone the repo using GitHub desktop

    • It does not create a remote copy of the repo in my GitHub page​
  • If the users cloning the repo have write access they can replace files and folders in the remote GitHub repo​

  • The purpose of cloning is often to contribute directly to the original repo​ or work offline

Cloning example

Cloning example

Cloning example: GitHub Desktop

Questions about cloning?

Forking


  • Creates your own copy of a repository in your remote GitHub page​

  • Your own copy means that you will be able to contribute changes to your copy of the repository without affecting the original repository!​

  • Often used to create a personal version of a project for custom modifications

    • You can then submit a pull request to the original repository to suggest changes​

Forking

Forking example

In our course

In our course

In our course

Comparing cloning and forking


Feature Cloning Forking
Local Copy Yes No (initially only on GitHub)
Direct Collaboration Yes (if permissions allow) No (requires pull requests)
Synchronisation Yes (with the original repository) Yes (can fetch updates from the original)
Control Limited (depends on permissions) Full (over the forked copy)
Use Case Contributing directly, local development Independent development, contributing via PRs
Includes All files, branches, commit history All files, commit history, but no issues or PRs

Removing cloned and forked repositories


  • If you cloned or forked a repository and no longer need it, you can delete the local copy​
  • Deleting the local copy does not affect the remote repository​
  • You can also delete the remote repository if you have write access to it​ (be careful!)

Questions about forking?

Great! Now let us see what Jupyter Notebooks are!