Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338717 - Can't seem to 'clean' my working directory
Summary: Can't seem to 'clean' my working directory
Status: CLOSED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 3 votes (vote)
Target Milestone: 2.3   Edit
Assignee: Markus Duft CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 347159 356546 361696 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-02 13:48 EST by Ian Bull CLA
Modified: 2013-09-27 13:52 EDT (History)
12 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Bull CLA 2011-03-02 13:48:17 EST
I noticed when switching branches (and applying different patches), that untracked files remained in my working directory.  From my Eclipse CVS background, I expect a 'replace with latest from head' to clean my working directory (removing any untracked files).  While this behaviour might not be desirable in EGit, having the option to 'clean' your directory seems valuable.

I learned today about `git clean -d -f`, but I don't see a way to do this from the Eclipse UI.  Maybe I'm just missing something (if so, feel free to close this as invalid). Otherwise, I think we should add an option (either to the branch checkout workflow, or to the team menu somewhere).
Comment 1 Matthias Sohn CLA 2011-03-03 10:13:21 EST
git checkout doesn't ever touch untracked files

what you want is git clean but this is not yet implemented
Comment 2 Remy Suen CLA 2011-08-29 12:07:34 EDT
*** Bug 347159 has been marked as a duplicate of this bug. ***
Comment 3 Remy Suen CLA 2011-09-02 06:33:30 EDT
*** Bug 356546 has been marked as a duplicate of this bug. ***
Comment 4 Remy Suen CLA 2011-10-21 19:05:44 EDT
*** Bug 361696 has been marked as a duplicate of this bug. ***
Comment 5 Markus Keller CLA 2011-10-23 10:50:47 EDT
Cleaning and reverting to a well-defined state is an important functionality.

"git clean" alone could be a "Team > Advanced" command as suggested in bug 347159.

Even more important are:
- "Replace With > Clean HEAD Revision..." and
- a checkbox to clean in the "Replace With > Branch, Tag or Reference..." dialog (with persisted state)
As an added benefit, these 2 options also make it easier to understand that git reset/checkout without a clean doesn't touch untracked files.
Comment 6 Matthias Sohn CLA 2011-10-24 09:49:07 EDT
There is a draft from Chris http://egit.eclipse.org/r/#change,3528 but it needs more work.

This is an enhancement request.
Comment 7 Markus Duft CLA 2012-01-19 08:51:41 EST
i have done some work on that and implemented a working Clean... command (which might not be perfect just yet ;)). You can find it here:

 * egit: http://egit.eclipse.org/r/3528
 * jgit: http://egit.eclipse.org/r/4972

(i dared to take over chris' review item for egit ;) hope that doesn't make you mad at me!)
Comment 8 Chris Aniszczyk CLA 2012-11-16 15:31:38 EST
The jgit changes were merged: f64237d5ff240cd62179f25fac7c40a9ffd5b2b8

Rebase the egit changes if you're interested in having it merged :)
Comment 9 Andrew Pitt CLA 2012-11-28 16:37:18 EST
Any chance this will be added to the EGit nightly soon?  We are finding it a bit frustrating to have to switch back to the command line every time we switch branches just to run get clean -df.

Thanks.
Comment 10 Robin Rosenberg CLA 2013-01-25 20:02:18 EST
https://git.eclipse.org/r/#/c/5345/ is merged.

I5136afd3333c6710b0c67c49618df6217e0d1fcf
Comment 11 Dani Megert CLA 2013-02-01 02:38:34 EST
I verified in 2.3.0.201302010015 that 'Clean...' is now there but it is not very handy yet:

- it is only in the 'Git Repositories' view
- I can't apply it on a project (or folder)
- the UI shows the untracked files as list which makes it hard to quickly
  clean a concrete project (or folder)


Minor details:
- the icon with the no entry sign looks a bit strange. I would use an eraser as
  overly
- the mnemonic is missing
Comment 12 Robin Stocker CLA 2013-09-27 13:52:48 EDT
(In reply to Dani Megert from comment #11)
> I verified in 2.3.0.201302010015 that 'Clean...' is now there but it is not
> very handy yet:

I moved these to a new bug for better overview, see bug 418210.