Slides are here
Make sure that you fork the repo, and then clone the one at your_username/git_adv int your computer. We want to make sure there are no user restrictions.
-- adv.Rproj
-- basic_app
|__app.R
|__tests
-- DESCRIPTION
-- man
|__gal2lit.Rd
-- NAMESPACE
-- R
|__gal2lit.R
-- README.md
-- tests
|__testthat
|__testthat.R
As seen in the repository structure section above, this repo contains an R package and a ShinyApp (basic_app). Each has its own set of tests. The tests for the package are under tests, and the tests for the app are under basic_app/tests.
For the package, we are using a simple testthat workflow. For the ShinyApp, we are using the shinytest package (which is inspired in and uses testthat).
Commands that we'll use:
git statustells the status of our repositorygit log --pretty=onelineshows the commit history (nicely)git bisect [start, good, bad]start bisecting, and tag each commit as good or bad (based on test runs)git bisect resetonce we've identified the "breaking point", come back to the presentgit branchto inspect existing branchesgit ckeckout BRANCH_NAMEswitch branchesgit checkout -b NEW_BRANCH_NAMEto create a new branch and switch into itgit reset HASHto rewrite a filegit committo commit changesgit mergeto bring changes from one branch into anothergit tag -a VERSION -m "TAG MESSAGE"to tag a commitgit push
install.packages("shiny")
install.packages("testthat")
install.packages("shinytest")
Not sure this will work on everyone's computer, but try the following.
- Copy and paste the following code into your prefered terminal:
git config --global alias.logline "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
- Now this:
git config --global alias.logone "log --pretty=oneline"
This will create aliases so that we can call very long commands just using git logline and git logone.
- In your computer, open any Rproject that has a repo. Go to the RStudio terminal (not the Console!) and type:
git logline
It should show a compressed history of all commit messages
- Now type:
git logone
It should show similar info
Let me know if something is not working.