Description Usage Arguments Details Examples
Delete an existing local branch. You won't be allowed to delete the branch you're on. Switch to another branch, then delete.
1 | git_branch_delete(name, repo = ".")
|
name |
Name of 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. |
Convenience wrapper around
git2r::branch_delete()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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.")
## create a branch off of master
git_branch_create("doomed")
git_branch_list()
## switch to doomed branch
git_switch("doomed")
git_branch()
## Not run:
## try -- and fail -- to delete doomed branch
git_branch_delete("doomed")
## End(Not run)
## switch back to master
git_switch()
## delete the new branch
git_branch_delete("doomed")
git_branch_list()
setwd(owd)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.