Search code examples
gitmagit

Meaning of "Contained" and "Merged" in Magit


When I look at a commit in magit, I see:

Author:     My Name
AuthorDate: A Date
Commit:     My Name again
CommitDate: A Date

Parent:     20f412c1 Commit message
Merged:     master
Contained:  devel foo

I know that 'parent' is the previous commit in the history, but what is the meaning of merged and contained? I've searched through git & magit docs but they are difficult keywords to search for as they pop up all over the place.


Solution

  • I would assume you are issuing the command magit-show-commit. This function is part of magit-diff.el. In that file, we can see that for the keywords Contained and Merged, they are used as parameters to something called magit--insert-related-refs/magit-buffer-revision.

    The diffing that is happening is described by the magit documentation as:

    User Option: magit-revision-insert-related-refs

    Whether to show related branches in revision buffers.

    • nil Don’t show any related branches.
    • t Show related local branches.
    • all Show related local and remote branches.
    • mixed Show all containing branches and local merged branches.

    If we look at the mixed option, I interpret it in the following:

    For Contained this means that as you pick the commit you want to look at, all branches that follow that commit (are contained after it), shall be placed in that section.

    For Merged this means that it will show all local branches that are merged before this commit.