Re: way to automatically add untracked files?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Miles Bader <miles@xxxxxxx> wrote:
> 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.

> 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.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux