git_status: Get status of a Git repo

Description Usage Arguments Value Examples

Description

The status of a Git repo is a set of paths, typically broken down like so:

Staged changes

Paths with modifications that are staged for inclusion in the next commit.

Unstaged changes

Paths that are tracked by Git but that have unstaged modifications.

Untracked files

Paths that are not yet tracked by Git but that are also not gitignored.

What does that leave? Two kinds of paths

Use ls = TRUE to request a status that includes these paths as well, i.e. a complete census of all the files in the repo.

Usage

1
git_status(repo = ".", ls = FALSE)

Arguments

repo

Path to a Git repo. If unspecified, current working directory is checked to see if it is or is inside a Git repo.

ls

Logical, indicating whether to include unchanged, tracked files and gitignored files. Default is FALSE.

Value

a data frame where each row describes changes to a path, invisibly

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
repo <- git_init(tempfile("githug-"))
owd <- setwd(repo)
write("Add me", "add-me")
write("Don't add me", "dont-add-me")
git_status()
git_add("add-me")
git_status()
git_commit(message = "first commit")
git_status()
git_status(ls = TRUE)
setwd(owd)

jennybc/githug documentation built on May 19, 2019, 5:05 a.m.