prompt_git | R Documentation |
An example 'git' prompt
prompt_git(...)
is_git_dir()
git_branch()
git_arrows()
git_remote_status()
git_dirty()
... |
Unused. |
prompt_git()
is a prompt with information about the git repository
in the current working directory. It shows the current branch, whether
there are commits to push or pull to the default remote, and whether
the working directory is dirty.
is_git_dir()
checks whether the working directory is in a git tree.
If git is not installed, then it always returns FALSE
.
git_branch()
returns the name of the current branch.
git_arrows()
checks the status of the local tree compared to the
configured remote.
git_remote_status()
checks the status of the local tree, compared to
a configured remote.
git_dirty()
checks if the local tree has uncommitted changes.
If there are, it returns "*"
. Note that it also returns "*"
on a
git error, so you might want to use is_git_dir()
as well.
prompt_git()
returns the prompt as a string.
is_git_dir()
returns a logical scalar.
git_branch()
returns a string. If the repository has no commits, then
it returns "main"
. Note that if git is not available, or fails for
any reason, it will also return "main"
, so you might want to call
is_git_dir()
as well.
git_arrows()
returns a string that has a down arrow if the remote
has extra commits, and a down arrow if the local tree has extra commits
compared to the remote. Or both arrows for diverged branches. If it is
not the empty string then it adds a leading space character.
git_remote_status()
returns a numeric vector of length two. The first
number is the number of extra commits in the local tree. The second
number is the number of extra commits in the remote. If there is no
remote, or git errors, it returns a vector of two NA
s.
git_dirty()
returns a character string, "*"
or ""
.
Other example prompts:
new_prompt_powerline()
,
prompt_devtools()
,
prompt_fancy()
,
prompt_mem()
,
prompt_runtime()
,
prompt_status()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.