init: Init a repository

Description Usage Arguments Value See Also Examples

View source: R/repository.R

Description

Init a repository

Usage

1
init(path = ".", bare = FALSE, branch = NULL)

Arguments

path

A path to where to init a git repository

bare

If TRUE, a Git repository without a working directory is created at the pointed path. If FALSE, provided path will be considered as the working directory into which the .git directory will be created.

branch

Use the specified name for the initial branch in the newly created repository. If branch=NULL, fall back to the default name.

Value

A git_repository object

See Also

repository

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
## Initialize a repository
path <- tempfile(pattern="git2r-")
dir.create(path)
repo <- init(path)
is_bare(repo)

## Initialize a bare repository
path_bare <- tempfile(pattern="git2r-")
dir.create(path_bare)
repo_bare <- init(path_bare, bare = TRUE)
is_bare(repo_bare)

## End(Not run)

Example output

[1] FALSE
[1] TRUE

git2r documentation built on Nov. 22, 2021, 9:08 a.m.

Related to init in git2r...