## conventional git add, status, commit
repo <- git_init(tempfile("githug-"))
owd <- setwd(repo)
writeLines("Are these girls real smart or real real lucky?", "max.txt")
git_add("max.txt")
git_status()
git_commit("Brains'll only get you so far and luck always runs out.")
git_status()
setwd(owd)
if (require(dplyr)) {
## are pipes silly here? perhaps ...
repo <- tempfile("githug-") %>%
git_init()
owd <- setwd(repo)
writeLines("Are these girls real smart or real real lucky?", "max.txt")
"max.txt" %>%
git_add() %>%
git_status()
git_commit("Brains'll only get you so far and luck always runs out.") %>%
git_status()
setwd(owd)
}
## THE SHOUTY COMMANDS
repo <- git_init(tempfile("GITHUG-"))
owd <- setwd(repo)
writeLines("Change me", "change-me")
writeLines("Delete me", "delete-me")
git_status()
git_add(c("change-me", "delete-me"))
git_status()
git_commit("initial")
write("OK", "change-me", append = TRUE)
file.remove("delete-me")
writeLines("Add me", "add-me")
git_status()
git_ADD()
git_status()
## TO DO: return here when commits and reset are wrapped
ccc <- git2r::commits()[[1]]
git2r::reset(ccc, "mixed")
git_status()
git_COMMIT("JUST DO IT.")
git_status()
setwd(owd)
Run the code above in your browser using DataCamp Workspace