source("R/utils.R") library(DiagrammeR)
r format_date(params$datetime)
r params$instructor
r params$level
But! No expectation to actually start using it... :) It took me months after I learned it before I started actually using it.
At the end of this session you will be able:
For Git within RStudio:
For Git in general:
[^uoftcoders]: Many parts of this were taken from my lessons given while with the UofTCoders. Material here.
Version control is a system that manages changes to a file or files. These changes are kept as logs in a history, with detailed information on what file(s) was changed, what was changed within the file, who changed it, and a message on why the change was made. This is extremely useful, especially when working in teams or for yourself 6 months in the future (because you will forget things)!
To understand how incredibly powerful version control is, think about these questions (or refer to the comic above!): How many files of different versions of a manuscript or thesis do you have laying around after getting feedback from your supervisor or co-authors? Have you ever wanted to experiment with your code or your manuscript and need to make a new file so that the original is not touched? Have you ever deleted something and wish you hadn't? Have you ever forgotten what you were doing on a project? All these problems are fixed by using version control (git)!
We are going to go over a typical workflow. This could be either a solo workflow or a collaborative workflow. All of this will be done through RStudio.
```{bash, eval=FALSE} git config --global user.name "Your Name" git config --global user.email "you@some.domain" git config --global core.editor "nano"
### Four (five) concepts in Git (and ~7 commands) - **Start repository**: `git init`, `git clone` (GitHub) - **Check activity**: `git status`, `git log`, `git diff` - **Save to history**: `git add`, `git commit` - **Move through the history**: `git checkout`, `git branch` (may be covered) - (Note discussed) **Using with GitHub**: `git push`, `git pull` Can also all be done through the RStudio Git interface! All the commands and exercises will be done during the code-along. ### Graphic: Git stages overview ```r mermaid(" sequenceDiagram participant U as Untracked participant W as Working participant S as Staged participant H as History U->>S: git add W->>S: git add W->>H: git commit filename S->>H: git commit H->>W: git checkout ")
mermaid(" sequenceDiagram participant W as Working participant S as Staged participant H as History participant R as GitHub W->>S: git add W->>H: git commit filename S->>H: git commit H->>W: git checkout H->>R: git push R->>W: git pull ")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.