Description Usage Arguments Value Examples
githug
uses the git2r
package, under the hood, to
perform local Git operations. git2r
handles Git repos as
objects of class git_repository
. Use this function to
convert a path (or other way of referring to a Git repo) to the right sort of
input. You might need this for more exotic Git operations, i.e. to call
git2r
functions that aren't exposed via githug
.
1 | as_git_repository(x = ".")
|
x |
Git repository specified as a path. Or as an object of class
|
An S4 git_repository
object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | repo <- git_init(tempfile("githug-to-git2r-example-"))
owd <- setwd(repo)
git_config(user.name = "jd", user.email = "jd@example.org")
writeLines(paste("Well, I've always believed that if done properly, armed",
"robbery doesn't have to be an unpleasant experience."),
"jd.txt")
git_add("jd.txt")
git_commit("jd is a smooth talker")
## here's a rather exotic Git operation that githug is unlikely to expose:
## odb_blobs() lists "all blobs reachable from the commits in the object database"
## pre-process the repo with as_git_repository() to prepare for git2r
git2r::odb_blobs(as_git_repository())
setwd(owd)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.