public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* git commit --only -- $path when $path already has staged content
@ 2014-11-07 10:38 Stefan Näwe
  2014-11-07 16:57 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Näwe @ 2014-11-07 10:38 UTC (permalink / raw)
  To: git@vger•kernel.org

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-10  7:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-07 10:38 git commit --only -- $path when $path already has staged content Stefan Näwe
2014-11-07 16:57 ` Junio C Hamano
2014-11-07 16:57   ` Junio C Hamano
2014-11-07 19:54   ` Junio C Hamano
2014-11-10  7:18     ` Stefan Näwe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox