Using Git
1. Download course content
Open VSCode
Windows: Press Ctrl+Shift+P to open Command Palette
Mac: Cmd⌘+Shift+P
Type Git: Clone
Use https://github.com/NumEconCopenhagen/ProgEcon-lectures
Choose where you want to save the repository on your computer.Repeat with https://github.com/NumEconCopenhagen/ProgEcon-exercises
You can update the course content later with Git: Pull
Workflow: Avoid making changes directly in the lecture and exercise repositories. If you want to save work you do in a notebook, first save a copy in another folder.
1.1. Git terminology
When working with Git in VSCode, you will mainly use the following commands:
Git: Clone: Downloads a complete copy of a repository from GitHub to your computer. You normally only need to do this once for each repository.
Git: Pull: Downloads new changes from GitHub and adds them to your local copy. Use this to update the lecture and exercise repositories when new course material has been uploaded.
Git: Commit All: Saves a snapshot of all your local changes in Git. A commit is only stored on your own computer until you push it to GitHub. You should write a short message describing what you changed.
Git: Push: Uploads your local commits to GitHub.
Git: Sync: Synchronizes your local repository with GitHub. In practice, VSCode first pulls changes from GitHub and then pushes your local commits to GitHub.
For the lecture and exercise repositories, you will normally only use Pull, since you only want to download course updates.
For your own group repository, you will normally use Commit All followed by Sync, since you both download changes made by your group members and upload your own changes.
1.2. Source Control in VSCode
The Source Control panel in VSCode gives you an overview of the Git status of your repository.
It shows which files you have changed since your last commit. From the panel, you can:
Review changed files
Stage changes for a commit
Write a commit message
Commit your changes
Pull, push, or sync with GitHub
You can open the Source Control panel by clicking the branch-shaped icon in the left sidebar.
You can also see the Git status directly in the Explorer panel. Small letters next to files indicate their status, for example:
M = Modified
U = Untracked (a new file not yet included in Git)
A = Added
D = Deleted
For most course work, the Source Control panel is the easiest way to see what you have changed and to commit and sync your work with GitHub.
2. Make your own Github repository
Follow the steps below to create your own repository on GitHub, which you can use to organize all group work in this course.
2.1a. If you are the creator of the repository
Go to github.com/new (sign in if needed)
Fill out the required information
Repository name: Your choice!
Visiblity: Private
Add README: Turn on.
Add gitignore: Choose Python
Add license: Choose MIT LicenseClick create repositoy
2.1b. If a group member has already created your repository
Ask the creator to invite you to the repository (see below).
2.2. You can also invite members to your team
Go to your repository page
Go to Settings
Choose Collaborators in the left panel
Click Add people
Search for your group members by GitHub username and invite them.
2.3. Connect to GitHub
Open VSCode
Windows: Pres Ctrl+Shift+P and use Git:Clone with the URL to your repository
Mac: Cmd⌘+Shift+P
Open ReadMe.md
Change e.g. Group name or Group members
Windows: Press Ctrl+Shift+P and use Git: Commit All
Mac: Cmd⌘+Shift+P
Write a short commit message describing what you changed, then confirm the commit.
Windows. Pres Ctrl+Shift+P and use Git: Sync
Mac: Mac: Cmd⌘+Shift+P
Go to your repository on github.com and verify that the changes have been uploaded