git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Can not 'git add file'
@ 2016-01-03 14:53 KES
  2016-01-03 16:20 ` Dennis Kaarsemaker
  0 siblings, 1 reply; 2+ messages in thread
From: KES @ 2016-01-03 14:53 UTC (permalink / raw)
  To: git

Hi.

How to reproduce

$ git-number
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

1	modified:   ../lib/Devel/DebugHooks.pm
2	modified:   ../lib/Devel/KillPrint.pm
3	modified:   00-simple.t

Untracked files:
  (use "git add <file>..." to include in what will be committed)

4	../lib/Devel/DebugHooks/
5	../lib/Devel/ImportArgs.pm
6	../lib/Devel/KillPrintTest.pm
7	../lib/Devel/KillPrint_scope.pm
8	../lib/Devel/PkgAtCompileTime.pm
9	../lib/Devel/t.pl
10	lib/Devel/AutoInit.pm
11	lib/Devel/DZVii.pm

no changes added to commit (use "git add" and/or "git commit -a")
$ 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.

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

* Re: Can not 'git add file'
  2016-01-03 14:53 Can not 'git add file' KES
@ 2016-01-03 16:20 ` Dennis Kaarsemaker
  0 siblings, 0 replies; 2+ messages in thread
From: Dennis Kaarsemaker @ 2016-01-03 16:20 UTC (permalink / raw)
  To: KES, git

On zo, 2016-01-03 at 16:53 +0200, KES wrote:
> 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

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

end of thread, other threads:[~2016-01-03 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-03 14:53 Can not 'git add file' KES
2016-01-03 16:20 ` Dennis Kaarsemaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).