git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Add git-clean command

From
Junio C Hamano <junkio@cox.net>
Date
Apr 4, 2006, 09:08 UTC
Message-ID
<7vfykt908g.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20060404082002.GJ4663@admingilde.org>
Martin Waitz <tali@admingilde.org> writes:
Show 9 quoted lines
>> +-x::
>> +	Don't use the ignore rules.  This allows removing all untracked
>> +	files, including build products.  This can be used (possibly in
>> +	conjunction with gitlink:git-reset[1]) to create a pristine
>> +	working directory to test a clean build.
>
> as ignored files are generally generated files, doesn't it make sense
> to clean up the "ignored" files, and leave other untracked files
> alone?  That way you don't loose files which you forgot to add to git.

Sounds like a sane suggestion, but my previous comment about "make clean" broken for people who want this "git clean" feature applies here as well.

One justification I can think of for "git clean" without -x flag is to make a clean tree that has only the source and build products, removing editor backup files, throwaway test output files and friends, but as you pointed out, this risks losing newly created source files that you forgot to add, so I would need a bit of convincing before I use such a command myself.

Compared to that, removing only ignored files sounds like a much safer operation -- they are explicitly listed as expendable, so it is a lot less likely to lose anything important. But again, that is what "make clean" is there for...

Previous: Martin WaitzNext: Alex Riesen
Message 9 of 11 in “Add git-clean command”
  1. Add git-clean commandPavel Roskin, Apr 3, 2006
  2. Junio C HamanoApr 4, 2006
  3. Sam RavnborgApr 4, 2006
  4. Pavel RoskinApr 4, 2006
  5. unchecked uses of strdupJim Meyering, Apr 5, 2006
  6. Alex RiesenApr 6, 2006
  7. Pavel RoskinApr 5, 2006
  8. Martin WaitzApr 4, 2006
  9. Junio C HamanoApr 4, 2006
  10. Alex RiesenApr 4, 2006
  11. Pavel RoskinApr 4, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.