What does diff.mnemonicprefix do?

I’ve noticed that SourceTree performs git commands with this configuration option:

git -c diff.mnemonicprefix=false 

This is what the git docs say about this option:

  • Git - Preserve Work Without Commit
  • git stash and pop shows file no longer marked as moved?
  • Git repository with multiple users on Ubuntu
  • GIT commit from memory, not file
  • Doxygen for a project managed with git?
  • Able to push to all git remotes with the one command?
  • diff.mnemonicprefix

    If set, git diff uses a prefix pair that is different from the standard “a/” and “b/” depending on what is being compared. When this configuration is in effect, reverse diff output also swaps the order of the prefixes:

    git diff compares the (i)ndex and the (w)ork tree;

    git diff HEAD compares a (c)ommit and the (w)ork tree;

    git diff --cached compares a (c)ommit and the (i)ndex;

    git diff HEAD:file1 file2 compares an (o)bject and a (w)ork tree entity;

    git diff --no-index a b compares two non-git things (1) and (2).

    I still don’t understand what this means. Can someone explain?

  • Git Credential Helper on Windows without asking for credentials
  • Is there anything for subversion as gerrit for git?
  • git init will not create git directories for me
  • How do you get a lost “autostash” commit from `git rebase --autostash`
  • how do i identify files/directories that were added or removed in a git commit?
  • SourceTree GUI can't push, terminal can push
  • One Solution collect form web for “What does diff.mnemonicprefix do?”

    git diff shows some metadata about the files it is comparing. Ordinarily you might see something like this:

    diff --git a/foo/bar.txt b/foo/bar.txt        <--
    index abcd123..1234abc 100644
    --- a/foo/bar.txt                             <--
    +++ b/foo/bar.txt                             <--
    

    Note how the files are differentiated using a/ and b/ on the three lines I have indicated with arrows. This is non-mnemonic; the characters a and b have no real significance.

    With diff.mnemonicprefix enabled, these characters are chosen as described in the documentation you quoted. For example, if you have changes to your local copy and are comparing against the index (e.g. with git diff) you would see something like

    diff --git i/foo/bar.txt w/foo/bar.txt
    index abcd123..1234abc 100644
    --- i/foo/bar.txt
    +++ w/foo/bar.txt
    

    instead. The characters i and w are used to indicate your index and working copy respectively.

    The other cases listed in the documentation work similarly.

    Git Baby is a git and github fan, let's start git clone.