repo <- git_init(tempfile("githug-revisions-"))
owd <- setwd(repo)
## no commits --> HEAD cannot be resolved
git_revision_exists("HEAD")
## Not run:
# git_revision()
# ## End(Not run)
## commit and ... now HEAD exists
write("Well, we're not in the middle of nowhere,", "nowhere.txt")
git_commit(all = TRUE, message = "1ouise: not in the middle of nowhere")
git_revision()
git_revision_exists("HEAD")
## make a new commit then ask for parent of HEAD
write("but we can see it from here.", "nowhere.txt", append = TRUE)
git_commit(all = TRUE, message = "louise: but can see it")
git_revision("HEAD^")
## create a new branch and find out what it points at
git_switch("newbranch", create = TRUE)
git_revision("newbranch")
setwd(owd)
Run the code above in your browser using DataLab