2024-03-05
Midterm exam
You can get help on the midterm exam in office hours/discussion board etc. please make use of it
Please make sure you are on the latest version: Change log:
2/Mar/24: 1 pm. Updated points to 60 total (previously 55) adding questions 1e2, 1f, 4.d
2/Mar/24: 7 pm. Fixed rendering to generate a standalone html file, clarified format
HW4 rubric is on Canvas/files now!
Why share code with others?
What is version control and why do we need it?
How does git
do version control?
git
vs (github.com
/ gitlab.com
/ ..)Live practice: Setup/use git through the command line and Rstudio interface
Sharing source code is useful
Sharing your data analysis in a paper
Getting someone to look at your code and help
Why not just share on Google drive/dropbox then?
Many many writing drafts
Synchronizing changes in Midterm/assignment/worksheets easily!
Easy to see changes too
git
work?the three main sections of a Git project: the working tree, the staging area, and the Git directory
git init
: initiate a repository
.Rproj
file. check that that the working directory of the console matches before using these commands belowmain
using git branch -m main
(-m
is short for --move
)git config --global init.defaultBranch main
For the first time when using git, you have to introduce your name and email ID using these commands git config –global user.name ".."
and same for user.email ".."
touch example.txt
: make a text file to practice on
git add
: stage files ; git commit -m "message"
: commit files with a short message
add 3 lines of text : purpose: .. ; author: ; date:
git diff
to see what changed
again, do: git add
: stage files ; git commit -m "message"
: commit files with a short message
git commit -am ".."
adds all changed files without needing to mention explicitly (-a
= all)git
with Rstudio for GUI accessgit mv example.txt
example.qmd
: then open in Rstudio and bold the keywords
mv
command stands for move file or directory. When using git mv
, git registers it as “a file renaming change” rather than”an old file deleted and a new one made”git_practice
repo (already put in a simple .qmd
file here)git pull
: to bring fresh changes I madegit push
: where does this push to? Remember, you don’t have edit access to public repositories unless you are added as a collaboratorgit remote set-url origin ..url here..
git push -u origin main
Last class
Why share code with others?
What is version control and why do we need it?
Initializing git and command line
Today’s class
Learnt how to git add
and git commit
from the command line interface (CLI)
Learnt the same with a more intuitive graphical interface (GUI) within Rstudio
Using git pull
to grab public code from github.com