class: center, middle, inverse, title-slide # Data Visualization I --- ## Outline of steps - **repository (repo)**: contains files associated with a particular project and each file's version history - **pull**: update a local repository from a remote repo (GitHub) - **stage**: prepare file for commit - **commit**: save changes to local repository - **push**: upload files to remote repository (gitHub) --- ### Step #1. Create a repository on GitHub .vocab[repository]: contains files associated with a particular project and each file's version history (a) Click the link below to create the repository for lecture notes #02. - https://classroom.github.com/a/20txDUHn -- (b) When prompted, select "Accept this assignment". -- (c) Refresh the page. -- (d) Click the link following "Your assignment repository has been created:". **A private repository was just created for you.** --- ### Step #2. Clone a GitHub repo & Make a new RStudio project (a) In the repository that was just created, click the green "CODE" button, select "Use HTTPS" and click the clipboard icon to copy the repo URL. -- (b) In RStudio, click "File" `\(\rightarrow\)` "New Project" `\(\rightarrow\)` "Version Control" `\(\rightarrow\)` "Git". -- (c) Copy and paste the URL of your assignment repo in the dialog box "Repository URL:". -- (d) Click "Create Project" and enter your GitHub username and password when prompted. -- (e) The files from your GitHub repo should now be displayed in the "Files" pane in RStudio. --- ### Step #3. Configure Git We need to make sure RStudio can communicate with GitHub. (a) Type or paste the code below into the **console**. ```r library(usethis) use_git_config( user.name = "GitHub username", user.email="your email" ) ``` But fill in your GitHub username and the email associated with GitHub (mine is below). Click **ENTER** to run the code in the console. ```r library(usethis) use_git_config( user.name = "rdeisinger", user.email="robert.eisinger@duke.edu" ) ``` --- ### Step #3. Configure Git If if worked, your console should look like the screenshot below. <img src="img/01/config.png" width="70%" style="display: block; margin: auto;" /> --- ### Step #4. Change a file locally (a) Click the R Markdown file named lecture02.Rmd in the lower-right pane. (b) Change the author name to your name. (c) Knit the document. --- ### Step #5. Stage and Commit .vocab[stage]: prepare file for commit .vocab[commit]: save changes to local repository (a) Open the "Git" pane in the top-right panel. -- (b) Click on the .Rmd file -- (c) Click "Diff" to see the difference between the last commit and the current state -- (d) If you're happy with the changes, stage them by checking the box next to the file. -- (e) Write a meaningful commit message "changed author" in the commit message box. -- (f) Click commit. --- ### Step #6. Push these changes to the repo on GitHub. - .vocab[push]: upload files to remote repository (gitHub) (a) Click "Push".