Table of contents
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.gitYou 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.
- pull latest changes from PHY432-resources
- copy the new directories and files into your workspace PHY432
- work in your workspace
- commit changes in your workspace
- (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 pullCheck 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_setupWork, 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 pushFootnotes
If you happen to have accidentally edited files inside
~/PHY432-resourcesyou might run into merge conflicts when you rungit pullthe next time. If that happens, copy all files that you edited (usegit statusto see which ones are modified) to a safe directory and then reset with the commandcd ~/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 HEADWARNING
This will undo all your changes but will allow you to just run the next
git pullcommand again without problems. ↩