Chapters 1–6 should be review
Most of your work in the class will be centered around a project developing a new software package for your research.
important_code.py
important_code-2.py
important_code-fix.py
important_code-final.py
important_code-final-4apr.py
important_code.py
important_code.py
important_code.py
important_code.py
important_code.py
Git is a knife whose handle is also a knife. – Philip Guo
$ git --help
$ git config --global user.name "Kyle Niemeyer"
$ git config --global user.email "kyle.niemeyer@oregonstate.edu"
$ git config --global core.editor "vim"
~ $ mkdir analysis_code
~ $ cd analysis_code
~/analysis_code $ git init
Initialized empty Git repository in ~/analysis_code/.git/
~/analysis_code $ ls
~/analysis_code $ ls -A
.git
~/analysis_code $ cd .git && ls -A
HEAD config description hooks index info logs objects packed-refs refs
Try this yourself.
~/analysis_code $ touch README.md
~/analysis_code $ git add README.md
~/analysis_code $ git status
Try this yourself.
Snapshot of repository = revision
Committing a revision:
~/analysis_code $ git commit
Try this yourself.
~/analysis_code $ git commit -m "This is my message"
~/analysis_code $ git commit -am "This is my message
committing all changes"
Bad commit message:
Fixed bug
Good commit message:
Fixed bug in mass calculation
Due to incorrect density value, mass was being calculated
orders of magnitude larger than it should. The correct value
of density fixed this problem.
~/analysis_code $ git log
~/analysis_code $ git diff
Un-add a file:
~/analysis_code $ git reset new-file.txt
Reset repository to previous commit:
~/analysis_code $ git reset [mode] [commit]
Remove uncommitted changes:
~/analysis_code $ git checkout -- README.md
~/analysis_code $ git branch
* master
~/analysis_code $ git branch experimental
~/analysis_code $ git branch
experimental
* master
~/analysis_code $ git branch new
~/analysis_code $ git branch -d new
~/analysis_code $ git checkout experimental
~/analysis_code $ git branch
* experimental
master
~/analysis_code $ git checkout master
~/analysis_code $ git merge experimental
~/analysis_code $ git log
Assignment for next week: project proposal