Re: way to automatically add untracked files?
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Aug 5, 2007, 04:13 UTC
- Message-ID
- <20070805041320.GH9527@spearce.org>
- In-Reply-To
- <fc339e4a0708042100jdf0a0f1jd1fddfb5dc1c1052@mail.gmail.com>
Miles Bader <miles@gnu.org> wrote:
Show 11 quoted lines
> I previously wrote > > One thing I often want to do is git-add all untracked files, and also > > automatically git-rm all "disappeared" files > ... > > One way to do this seems to be just "git add ." > > Oh, also, "git add ." doesn't seem to do the right thing with > "dissapeared" files: If I do: > > mv foo.cc bar.cc > git add .
Right. Who wants "add" to actually mean "add and delete"? Shouldn't that be then called "git-add-and-rm"?
We recently talked about this on the mailing list and decided that git-add shouldn't remove files that have disappeared, as doing so might break most user's expections of what git-add does.
> then git-status will show a new file "bar.cc", but will list "foo.cc" > as "deleted " in the "Changed but not updated" section. Perhaps the > right thing will happen if I do "git-commit -a" (though I don't know, > I don't really want to try it),
"git commit -a" will remove disappeared files. It has for quite some time.
Show 5 quoted lines
> this still results in incorrect > "git-diff --cached" output (it shows bar.cc as a new file, not as a > rename of foo.cc). > > Am I doing something wrong, or is this just missing functionality?
Try adding the -M option to "git-diff". That will enable the rename detection, and show the rename you are looking to see.
-- Shawn.