githug (version 0.0.0.9000)

git_branch_rename: Rename a branch

Description

Rename an existing local branch. It's fine to rename the branch you're on.

Usage

git_branch_rename(from, to, repo = ".")

Arguments

from
Name of the existing branch
to
New name for the branch
repo
Path to a Git repo. If unspecified, current working directory is checked to see if it is or is inside a Git repo.

Details

Convenience wrapper around git2r::branch_rename().

Examples

Run this code
repo <- git_init(tempfile("githug-branches-"))
owd <- setwd(repo)

## commit so that master branch exists
writeLines("Well, we're not in the middle of nowhere...", "nowhere.txt")
git_commit("nowhere.txt", message = "... but we can see it from here.")
git_branch_list()

## rename master
git_branch_rename("master", "louise")
git_branch_list()

setwd(owd)

Run the code above in your browser using DataLab