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

Re: Can not 'git add file'

From
Dennis Kaarsemaker <dennis@kaarsemaker.net>
Date
Jan 3, 2016, 16:20 UTC
Message-ID
<1451838002.3109.2.camel@kaarsemaker.net>
In-Reply-To
<1500251451832791@web17m.yandex.ru>
On zo, 2016-01-03 at 16:53 +0200, KES wrote:
Show 13 quoted lines
> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
> 
> 4       ../lib/Devel/DebugHooks/
> 
> $ git add -p ../lib/Devel/DebugHooks/Commands.pm
> No changes.
> 
> I want to start track file here, but I do not want to stage while
> file.
> 
> It seems the git can not process this case and do not allow me to
> complete that.

Correct, add -p for a new file is not supported, as it doesn't really make sense. There's no patch, it's a whole new file.

What you can do instead is first 
git add -N ../lib/Devel/DebugHooks/Commands.pm

to mark the file as tracked without adding content. Then git add -p will allow you to add the contents partially.-- Dennis Kaarsemaker www.kaarsemaker.net

Previous: KES
Message 2 of 2 in “Can not 'git add file'”
  1. KESJan 3, 2016
  2. Dennis KaarsemakerJan 3, 2016

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.