Table of contents
  1. PHY432 Workflow: Resources and Workspace
    1. Overview
    2. Update resources (“pull resources”)
    3. Copy new files and directories to workspace (“copy resources”)
    4. Work, commit, push
  2. Footnotes

PHY432 Workflow: Resources and Workspace

Code, notebooks, and files are being made available on GitHub in the resources repository Py4Phy/PHY432-resources. For the rest of the semester it will be assumed that you have a ~/PHY432-resources repository that you can update with a simple git pull as soon as new material is posted.

If you have not done so already, clone ~/PHY432-resources:

cd ~
git clone https://github.com/Py4Phy/PHY432-resources.git

You should also have your own workspace repository ~/PHY432 set up.

Overview

When we start a new lesson you will typically go through the following steps to get code and data files.

  1. pull latest changes from PHY432-resources
  2. copy the new directories and files into your workspace PHY432
  3. work in your workspace
  4. commit changes in your workspace
  5. (optional) push changes in your workspace your GitHub repository

Update resources (“pull resources”)

Update when your instructor changed anything on the remote:

cd ~/PHY432-resources
git pull

Check what’s new

ls -lt

(newest at top)

Copy new files and directories to workspace (“copy resources”)

You should not be changing anything inside ~/PHY432-resources (because the next git pull might try to change something that you did 1) but instead copy whatever you want to change to your own work directory.

For example:

cp -r ~/PHY432-resources/00_setup ~/PHY432
cd ~/PHY432/00_setup

Work, commit, push

Then work on the files in the workspace.

When you have changes that you want to track, git add / commit / push:

git add .
git commit -m 'updated 00 setup files'
git push

Footnotes

  1. If you happen to have accidentally edited files inside ~/PHY432-resources you might run into merge conflicts when you run git pull the next time. If that happens, copy all files that you edited (use git status to see which ones are modified) to a safe directory and then reset with the command

    cd ~/PHY432-resources
    # Next command only if you ran into a merge conflict
    # during a 'git pull'
    git merge --abort
    
    # undo ALL of YOUR changes
    git reset --hard HEAD
    

    WARNING

    This will undo all your changes but will allow you to just run the next git pull command again without problems.