threads / discuss / 3069

Recursive remove

Subject: Recursive remove

## tl;dr

5 messages between Jan 13, 2006 and Jan 13, 2006.

replies: 4people: 3as markdown or json

Peter Eriksen· Jan 13, 2006, 13:21 UTC · lore
Hello,
A way to recursively remove a directory /Some/Dir/ is a follows:
   git ls-files -z Some/Dir >rmfiles
   git update-index -z --force-remove --stdin <rmfiles
   git commit -a -m "Remove directory Some/Dir"
   rm -rf Some/Dir
What is a better way to do it?
Regards,
Peter
sean· Jan 13, 2006, 14:03 UTC · re: Peter Eriksen · lore

Re: Recursive remove

On Fri, 13 Jan 2006 14:21:19 +0100 "Peter Eriksen" <s022018@student.dtu.dk> wrote:

Show 11 quoted lines
> Hello,
> 
> A way to recursively remove a directory /Some/Dir/ is a follows:
> 
>    git ls-files -z Some/Dir >rmfiles
>    git update-index -z --force-remove --stdin <rmfiles
>    git commit -a -m "Remove directory Some/Dir"
>    rm -rf Some/Dir
> 
> What is a better way to do it?
> 
Hi Peter,
The following is a bit more concise but not better than your version:

rm -rf Some/Dir git ls-files -z -d Some/Dir | git-update-index -z --remove --stdin git commit -m "Remove directory Some/Dir"

Git could stand to have an "rm" command to make this easier.
Sean
Junio C Hamano· Jan 13, 2006, 17:37 UTC · re: Peter Eriksen · lore

Re: Recursive remove

"Peter Eriksen" <s022018@student.dtu.dk> writes:
Show 8 quoted lines
> A way to recursively remove a directory /Some/Dir/ is a follows:
>
>    git ls-files -z Some/Dir >rmfiles
>    git update-index -z --force-remove --stdin <rmfiles
>    git commit -a -m "Remove directory Some/Dir"
>    rm -rf Some/Dir
>
> What is a better way to do it?
	$ rm -fr Some/Dir; git commit -a -m 'Remove'
perhaps?
sean· Jan 13, 2006, 17:56 UTC · re: Junio C Hamano · lore

Re: Recursive remove

On Fri, 13 Jan 2006 09:37:54 -0800 Junio C Hamano <junkio@cox.net> wrote:

Show 5 quoted lines
> 
> 	$ rm -fr Some/Dir; git commit -a -m 'Remove'
> 
> perhaps?
> 
Sigh, its been a humbling morning all around; can't get easier than that.
Sean
Junio C Hamano· Jan 13, 2006, 19:51 UTC · re: sean · lore

Re: Recursive remove

sean <seanlkml@sympatico.ca> writes:
Show 8 quoted lines
> On Fri, 13 Jan 2006 09:37:54 -0800
> Junio C Hamano <junkio@cox.net> wrote:
>> 
>> 	$ rm -fr Some/Dir; git commit -a -m 'Remove'
>> 
>> perhaps?
>
> Sigh, its been a humbling morning all around; can't get easier than that.

Perhaps this is because I did not do a good job in Documentation/git-commit.txt. Something like this?

-- >8 --
Documentation: git-commit -a
A bit more elaboration on what "update all paths" means.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index e0ff74f..e35984d 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -25,7 +25,9 @@ information.
 OPTIONS
 -------
 -a|--all::
-	Update all paths in the index file.
+	Update all paths in the index file.  The command with this flag
+	notices files that have been modified and deleted, but new files
+	you have not told about git are not affected.
 
 -c or -C <commit>::
 	Take existing commit object, and reuse the log message

← back to recent threads