## see git config currently in effect, based on working directory
git_config() # local > global, same as git_config(where = "de_facto")
git_config_local() # same as git_config(where = "local")
git_config_global() # same as git_config(where = "global")
## set and get global config
## Not run:
# ## set and list global config
# git_config_global(user.name = "thelma", user.email = "thelma@example.org")
# git_config_global("user.name", "user.email")
# ## End(Not run)
## specify a Git repo
repo <- git_init(tempfile("githug-config-example-"))
git_config_local(repo = repo)
## switch working directory to the repo
owd <- setwd(repo)
## set local variables for current repo
git_config_local(user.name = "louise", user.email = "louise@example.org")
## get specific local variables, including a non-existent one
git_config_local("user.name", "color.branch", "user.email")
## set local variables, then restore
ocfg <- git_config_local(user.name = "oops", user.email = "oops@example.org")
git_config_local("user.name", "user.email")
git_config_local(ocfg)
git_config_local("user.name", "user.email")
## set a custom variable
ocfg <- git_config_local(githug.lol = "wut")
git_config_local("githug.lol")
setwd(owd)
Run the code above in your browser using DataLab