Fundamentals of HPC

Why?

analysis.R
analysis-vers3.R
analysis2.R
analysis_redo.R
thesis-vers1.docx
thesis-vers2_CD+GM+SW_edits.docx
thesis-vers3_CD_edits.docx

outline

mkdir example
cd example
git init .
echo "# My Project" >> README.md
git add README.md
git commit -m "Add README"

mkdir src/example
touch src/example/__init__.py
git add src/example/__init__.py
git commit -m "Initialize example package"

touch src/01-fetch-data.sh
chmod +x src/01-fetch-data.sh
touch src/02-verify-data.sh
chmod +x src/02-verify-data.sh
git add src/
git commit -m "Add scripts to fetch and verify source data"

git log

mkdir data
touch data/.gitkeep
git add data/.gitkeep
git commit -m "Keep data directory"

echo "*.csv" >> .gitignore
git add .gitignore
git commit -m "Ignore *.csv files"

echo "Source data from SOURCE" >> README.md

git status
git diff

git commit --all -m 'Update README'

git log
git log --patch

echo "mkdir data/derived" >> src/03-proc-data.sh
echo "cp data/raw/*.csv data/derived/" >> src/03-proc-data.sh
chmod +x src/03-proc-data.sh
git add src
git commit --all -m 'Add process script'

./src/03-proc-data.sh
ls data
ls -R data

git status
# Notice that csv files do not show up

Finding stuff

git log
# opens in your pager (less), you can search etc.

git log | grep
# also works

git grep
# how is this different?

Recovering

git checkout <commit>
# ... now what???

# Find the version you want first (see above), then ...
git checkout <commit> <filename>

# others ???

GitHub

You've already got a repo, let's put that on GitHub.

  1. Go to github.com or github.utk.edu (???)
  2. Create a new repository
  3. Follow the instructions ....
  4. Do some work ...
  5. Then git push
  6. Make another copy of that repo somewhere else ...
  7. Make changes in that copy ...
  8. git push
  9. Go back to original ...
  10. git pull

You want to create a new repository starting from GitHub

  1. Go to github.com or github.utk.edu (???)
  2. Create a new repository
  3. Follow the instructions ....
  4. Then, git clone

You want to work on a shared respository

  1. git clone
  2. work
  3. First, git pull --rebase, then git push

Or, if you're using the typical GitHub workflow (aka, "GitHub Flow")

  1. fork the repo
  2. git clone from your fork
  3. work ...
  4. git push
  5. Open a pull request

Remotes (optional)

  1. Go to your shared ISAAC project directory (optionally, create a dummy project dir)
  2. git clone --bare <original> repos/example.git your original to the shared dir
  3. Go back to the original
  4. git remote add proj <url>
  5. make changes ...
  6. git push