Skip to main content

5.1.1 Status Sections

The contents of status buffers is controlled using the hook magit-status-sections-hook. See Section Hooks to learn about such hooks and how to customize them.

user option magit-status-sections-hook​

Hook run to insert sections into a status buffer.

The first function on that hook by default is magit-insert-status-headers; it is described in the next section. By default the following functions are also members of that hook:

function magit-insert-merge-log​

Insert section for the on-going merge. Display the heads that are being merged. If no merge is in progress, do nothing.

function magit-insert-rebase-sequence​

Insert section for the on-going rebase sequence. If no such sequence is in progress, do nothing.

function magit-insert-am-sequence​

Insert section for the on-going patch applying sequence. If no such sequence is in progress, do nothing.

function magit-insert-sequencer-sequence​

Insert section for the on-going cherry-pick or revert sequence. If no such sequence is in progress, do nothing.

function magit-insert-bisect-output​

While bisecting, insert section with output from git bisect.

function magit-insert-bisect-rest​

While bisecting, insert section visualizing the bisect state.

function magit-insert-bisect-log​

While bisecting, insert section logging bisect progress.

function magit-insert-untracked-files​

Maybe insert a list or tree of untracked files.

Do so depending on the value of status.showUntrackedFiles. Note that even if the value is all, Magit still initially only shows directories. But the directory sections can then be expanded using TAB.

function magit-insert-unstaged-changes​

Insert section showing unstaged changes.

function magit-insert-staged-changes​

Insert section showing staged changes.

function magit-insert-stashes \&optional ref heading​

Insert the stashes section showing reflog for "refs/stash". If optional REF is non-nil show reflog for that instead. If optional HEADING is non-nil use that as section heading instead of "Stashes:".

function magit-insert-unpulled-from-upstream​

Insert section showing commits that haven’t been pulled from the upstream branch yet.

function magit-insert-unpulled-from-pushremote​

Insert section showing commits that haven’t been pulled from the push-remote branch yet.

function magit-insert-unpushed-to-upstream​

Insert section showing commits that haven’t been pushed to the upstream yet.

function magit-insert-unpushed-to-pushremote​

Insert section showing commits that haven’t been pushed to the push-remote yet.

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

function magit-insert-tracked-files​

Insert a tree of tracked files.

function magit-insert-ignored-files​

Insert a tree of ignored files. Its possible to limit the logs in the current buffer to a certain directory using D = f <DIRECTORY> RET g. If you do that, then that that also affects this command.

The log filter can be used to limit to multiple files. In that case this function only respects the first of the files and only if it is a directory.

function magit-insert-skip-worktree-files​

Insert a tree of skip-worktree files. If the first element of magit-buffer-diff-files is a directory, then limit the list to files below that. The value of that variable can be set using D -- DIRECTORY RET g.

function magit-insert-assumed-unchanged-files​

Insert a tree of files that are assumed to be unchanged. If the first element of magit-buffer-diff-files is a directory, then limit the list to files below that. The value of that variable can be set using D -- DIRECTORY RET g.

function magit-insert-unpulled-or-recent-commits​

Insert section showing unpulled or recent commits. If an upstream is configured for the current branch and it is ahead of the current branch, then show the missing commits. Otherwise, show the last magit-log-section-commit-count commits.

function magit-insert-recent-commits​

Insert section showing the last magit-log-section-commit-count commits.

user option magit-log-section-commit-count​

How many recent commits magit-insert-recent-commits and magit-insert-unpulled-or-recent-commits (provided there are no unpulled commits) show.

function magit-insert-unpulled-cherries​

Insert section showing unpulled commits. Like magit-insert-unpulled-commits but prefix each commit that has not been applied yet (i.e. a commit with a patch-id not shared with any local commit) with "+", and all others with "-".

function magit-insert-unpushed-cherries​

Insert section showing unpushed commits. Like magit-insert-unpushed-commits but prefix each commit which has not been applied to upstream yet (i.e. a commit with a patch-id not shared with any upstream commit) with "+" and all others with "-".

See References Buffer for some more section inserters, which could be used here.