git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git add --patch newfile doesn't add newfile to cache ?

From
MWMarc Weber <marco-oweber@gmx.de>
Date
Oct 20, 2008, 14:36 UTC
Message-ID
<20081020143636.GB3988@gmx.de>
Is this desired behaviour?
Testcase:
        #!/bin/sh
        # this script creates testGitAddPatch and will run the testcase there
         
        rm -fr testGitAddPatch
        mkdir testGitAddPatch
        cd testGitAddPatch
         
        git init
        echo test > test
        git add --patch test
        echo "running status, nothing has been added"
        git status
        git --version
 
My output
 
        marc@mail: /tmp/git ]$ sh test.sh
        Initialized empty Git repository in /tmp/git/testGitAddPatch/.git/
        No changes.
        running status, nothing has been added
        # On branch master
        #
        # Initial commit
        #
        # Untracked files:
        #   (use "git add <file>..." to include in what will be committed)
        #
        #       test
        nothing added to commit but untracked files present (use "git add" to
        track)
        git version 1.6.0.2.GIT
Marc Weber
Next: Jeff King
Message 1 of 4 in “git add --patch newfile doesn't add newfile to cache ?”
  1. Marc WeberOct 20, 2008
  2. Jeff KingOct 20, 2008
  3. Marc WeberOct 22, 2008
  4. Jeff KingOct 22, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.