Skip to main content

5.1.2 Status Header Sections

The contents of status buffers is controlled using the hook magit-status-sections-hook (see Status Sections).

By default magit-insert-status-headers is the first member of that hook variable.

function magit-insert-status-headers​

Insert headers sections appropriate for magit-status-mode buffers. The sections are inserted by running the functions on the hook magit-status-headers-hook.

user option magit-status-headers-hook​

Hook run to insert headers sections into the status buffer.

This hook is run by magit-insert-status-headers, which in turn has to be a member of magit-status-sections-hook to be used at all.

By default the following functions are members of the above hook:

function magit-insert-error-header​

Insert a header line showing the message about the Git error that just occurred.

This function is only aware of the last error that occur when Git was run for side-effects. If, for example, an error occurs while generating a diff, then that error won’t be inserted. Refreshing the status buffer causes this section to disappear again.

function magit-insert-diff-filter-header​

Insert a header line showing the effective diff filters.

function magit-insert-head-branch-header​

Insert a header line about the current branch or detached HEAD.

function magit-insert-upstream-branch-header​

Insert a header line about the branch that is usually pulled into the current branch.

function magit-insert-push-branch-header​

Insert a header line about the branch that the current branch is usually pushed to.

function magit-insert-tags-header​

Insert a header line about the current and/or next tag, along with the number of commits between the tag and HEAD.

The following functions can also be added to the above hook:

function magit-insert-repo-header​

Insert a header line showing the path to the repository top-level.

function magit-insert-remote-header​

Insert a header line about the remote of the current branch.

If no remote is configured for the current branch, then fall back showing the "origin" remote, or if that does not exist the first remote in alphabetic order.

function magit-insert-user-header​

Insert a header line about the current user.