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:

  • File ownership/group is changed when users push to a GIT repository
  • Detaching a directory to be modified as a branch elsewere using Git
  • Github all of the sudden says “fatal: Could not read from remote repository.”
  • How do I re-integrate a svn and git repository without a common history?
  • Fixing Git History after Fetching Wrong Repo
  • Getting github project upload error
  • 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?

  • How to reset to any of the previous commit in android studio?
  • Error with renamed repo in github, “remote: This repository moved. Please use the new location”
  • XCode, Git and MediaTemple (gs)
  • How to make a commit, or a change permanently local
  • XCode 7: Can't Push git
  • How does Git push and pull work with a remote repo/local repo?
  • 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.