Git development
 help / color / mirror / Atom feed
From: "Stefan Näwe" <stefan.naewe@atlas-elektronik.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: git commit --only -- $path when $path already has staged content
Date: Fri, 7 Nov 2014 11:38:16 +0100	[thread overview]
Message-ID: <545CA118.6040500@atlas-elektronik.com> (raw)

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

             reply	other threads:[~2014-11-07 10:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07 10:38 Stefan Näwe [this message]
2014-11-07 16:57 ` git commit --only -- $path when $path already has staged content 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=545CA118.6040500@atlas-elektronik.com \
    --to=stefan.naewe@atlas-elektronik.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox