knitr::opts_chunk$set( collapse = TRUE, comment = "#>", warning = FALSE )
library(glitter)
path <- path.expand("~/GitHub/packages/glitter")
My long lost file from the working directory is R/destroy.R
. I then get the commit history of that file using the full path.
list_file_commits(file = "R/destroy.R", path = path)
By default, this file is recovered using the most recent commit automatically.
# QA for vignette to run correctly path_to_file <- file.path(path, "R/destroy.R") if (file.exists(path_to_file)) { file.remove(path_to_file) }
I first check to make sure this file does not already exist.
file.exists(path_to_file)
I recover the lost file:
recover_lost_file(file = path_to_file)
QA to make sure that the file now is present:
file.exists(path_to_file)
However, a version of the file from a commit before the most recent one is desired, the SHA can be entered to retrieve that version instead.
file.remove(path_to_file)
recover_lost_file(file = path_to_file, sha = "aa448c7de4ead65905dfb3133ec42ac8a6f332fc")
file.exists(path_to_file)
file.remove(path_to_file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.