| git_commit | R Documentation |
To commit changes, start by staging the files to be included in the commit
using git_add() or git_rm(). Use git_status() to see an overview of
staged and unstaged changes, and finally git_commit() creates a new commit
with currently staged files.
git_commit_all() is a convenience function that automatically stages and
commits all modified files. Note that git_commit_all() does not add
new, untracked files to the repository. You need to make an explicit call to
git_add() to start tracking new files.
git_add(files, force = FALSE, repo = ".")
git_rm(files, repo = ".")
git_commit(message, author = NULL, committer = NULL, repo = ".")
git_commit_all(message, author = NULL, committer = NULL, repo = ".")
git_status(staged = NULL, pathspec = NULL, repo = ".")
git_ls(repo = ".", ref = NULL)
files |
vector of paths relative to the git root directory.
Use |
force |
add files even if in gitignore |
repo |
The path to the git repository. If the directory is not a
repository, parent directories are considered (see |
message |
a commit message |
author |
A git_signature value, default is |
committer |
A git_signature value, default is same as |
staged |
return only staged (TRUE) or unstaged files (FALSE).
Use |
pathspec |
character vector with paths to match |
ref |
revision string with a branch/tag/commit value |
git_status(), git_ls(): A data frame with one row per file
git_commit(), git_commit_all(): A SHA
Other git:
git_archive,
git_branch(),
git_config(),
git_diff(),
git_fetch(),
git_history,
git_ignore,
git_merge(),
git_rebase(),
git_remote,
git_repo,
git_reset(),
git_restore(),
git_revert(),
git_signature(),
git_stash,
git_tag,
git_worktree
oldwd <- getwd()
repo <- file.path(tempdir(), "myrepo")
git_init(repo)
setwd(repo)
# Set a user if no default
if(!user_is_configured()){
git_config_set("user.name", "Jerry")
git_config_set("user.email", "jerry@gmail.com")
}
writeLines(letters[1:6], "alphabet.txt")
git_status()
git_add("alphabet.txt")
git_status()
git_commit("Start alphabet file")
git_status()
git_ls()
git_log()
cat(letters[7:9], file = "alphabet.txt", sep = "\n", append = TRUE)
git_status()
git_commit_all("Add more letters")
# cleanup
setwd(oldwd)
unlink(repo, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.