Re: Removing files
- From
Junio C Hamano <junkio@cox.net>
- Date
- Jan 11, 2007, 22:41 UTC
- Message-ID
- <7vejq12nlu.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <87bql5cok3.fsf@morpheus.local>
David Kågedal <davidk@lysator.liu.se> writes:
> I'm wondering what the best way to commit the removal of a file is.
$ rm -f foo $ git-commit -a
Show 8 quoted lines
> git status shows: > > $ git status > # On branch refs/heads/messages > # Changed but not added: > # (use "git add <file>..." to incrementally add content to commit) > # > # deleted: foo
Suggesting "git add" to record the deletion feels insane. Is this what we still do? I think there have been much work in this area recently so the wordings might have already fixed.
Show 5 quoted lines
> Ok, so that didn't work. Let's try rm instead: > > $ git rm foo > fatal: pathspec 'foo' did not match any files >
The above message is from an older version of git-rm, but the one that will be in v1.5.0 is not any better. It errs out with "No such file or directory". A workaround using today's tool is to do "git rm --cached fo"
I think the right fix is to suggest "git add/rm" in status output and make "git rm" not barf if the user has already removed the file from the working tree.