gitline is a heads up display for git. It shows all relevant status information for a git repository in a compact and customizable way. It can be used by shell prompts to display git information (eg. slimfish and slimline).
Screenshot of gitline with a few changes to a git repository:
Screenshot of gitline with a lot of changes (work on a feature branch, changes on origin/master
,
staged and unstaged modified files, untracked files, stashes, etc.):
- python 2.6+
Clone the repository and run the gitline script. It is convenient to include it as a submodule eg. in a prompt theme.
gitline can be customized using a variety of environment variables.
These environment variable contain strings which contain placeholders
of the form ${...}
. These are replaced by gitline to display the git info.
Available colors are: gray
, red
, green
, yellow
, blue
,
magenta
, cyan
and white
. reset
is used to reset the color to the default value.
Placeholder | Description |
---|---|
action |
the current action (eg. bisect or cherry-pick) |
action_step |
the current step of the action (eg. commit 3 of 5 which are rebased) |
action_total |
the total count of steps of the current action |
branch |
the current branch |
commit_hash |
the shortform hash of HEAD |
commit_tag |
the tag for the current commit |
local_commits_to_pull |
commits available to pull from the remote tracking branch |
local_commits_to_push |
commits available to push from the remote tracking branch |
remote_commits_to_pull |
commits available to pull from origin/master to the remote tracking branch |
remote_commits_to_push |
commits available to push from origin/master to the remote tracking branch |
remote_tracking_branch |
the remote tracking branch |
remote |
the remote with the tracking branch |
staged_added |
number of staged added files |
staged_copied |
number of staged copied files |
staged_deleted |
number of staged deleted files |
staged_modified |
number of staged modified files |
staged_renamed |
number of staged renamed files |
stashes |
number of stashes |
unmerged |
number of unmerged files |
unstaged_deleted |
number of unstaged deleted files |
unstaged_modified |
number of unstaged modified files |
untracked |
number of untracked files |
Defines the git repository indicator text. Default is:
${reset}แด
Defines the format used to display if a git action without step counts like eg. cherry-pick is currently performed. Default is:
${yellow}${action}${reset}
Defines the format used to display if a git action with step counts like eg. interactive rebase is currently performed. Default is:
${yellow}${action}${reset} ${blue}${action_step}${reset}/${green}${action_total}${reset}
Defines the text which is displayed if the branch has no remote tracking branch. Default is:
upstream ${red}โก${reset}
Defines the format used to display commits which can be pushed and pulled to/from origin/master
.
Default is:
๐ฎ ${remote_commits_to_pull} ${yellow}โ${reset} ${remote_commits_to_push}
Defines the format used to display commits which can be pulled from origin/master
.
Default is:
๐ฎ ${red}โ${reset}${remote_commits_to_pull}
Defines the format used to display commits which can be pushed to origin/master
.
Default is:
๐ฎ ${green}โ${reset}${remote_commits_to_push}
Defines the format for the local branch. Default is:
${branch}
Defines the format if a tag is checked out. Default is:
${commit_tag}
Defines the format if the repository is not on a branch. Default is:
${red}detached@${commit_hash}${reset}
Defines the format used to display commits which can be pushed and pulled to/from the remote tracking branch. Default is:
${local_commits_to_pull} ${yellow}โฅฏ${reset} ${local_commits_to_push}
Defines the format used to display commits which can be pulled from the remote tracking branch. Default is:
${local_commits_to_pull}${red}โ${reset}
Defines the format used to display commits which can be pushed to the remote tracking branch. Default is:
${local_commits_to_push}${green}โ${reset}
Defines the format used to display staged added files. Default is:
${staged_added}${green}A${reset}
Defines the format used to display staged modified files. Default is:
${staged_modified}${green}M${reset}
Defines the format used to display staged deleted files. Default is:
${staged_deleted}${green}D${reset}
Defines the format used to display staged renamed files. Default is:
${staged_renamed}${green}R${reset}
Defines the format used to display staged copied files. Default is:
${staged_copied}${green}C${reset}
Defines the format used to display unstaged modified files. Default is:
${unstaged_modified}${red}M${reset}
Defines the format used to display unstaged deleted files. Default is:
${unstaged_deleted}${red}D${reset}
Defines the format used to display untracked files. Default is:
${untracked}${white}A${reset}
Defines the format used to display unmerged files. Default is:
${unmerged}${yellow}U${reset}
Defines the format used to display the number of stashes. Default is:
${stashes}${yellow}โก${reset}
Here is an example for customizing the git repository indicator and branch format.
If you have a powerline compatible font you can also use the alternative repo indicator ๎
.
When using bash/zsh:
export GITLINE_REPO_INDICATOR='${reset}git'
export GITLINE_BRANCH='[${blue}${branch}${reset}]'
When using fish:
set -x GITLINE_REPO_INDICATOR '${reset}git'
set -x GITLINE_BRANCH '[${blue}${branch}${reset}]'
Screenshot:
Released under the MIT License