Hello.

The manpage of git commit reads:

  --only

      Make a commit only from the paths specified on the command line,
      disregarding any contents that have been staged so far. This is
      the default mode of operation of git commit if any paths are given
      on the command line, in which case this option can be omitted. [...]

But that seems to be only true for other content (i.e. other files not
specified in the command line).

If I do:

    # some repo with a file in it
    git init
    echo content >foo && git add foo && git commit -m foo

    # modify and stage a file
    echo other >> foo && git add foo

    # modify the same file even further but don't stage
    echo bar >> foo

    # commit with path specified on command line with explicit '--only'
    git commit --only -m'.' -- foo

    # but everything was commited
    git status -s
    <empty>

I would expect to only get the unstaged changes in the commit.
Could anyone shed some light, please?

Thanks,
  Stefan
-- 
----------------------------------------------------------------
/dev/random says: Useless Invention: Camcorder with braile-encoded buttons.
python -c "print 
'73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')"
 
GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9  9666 829B 49C5 9221 27AF
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to