"git clean" and workspace.xml

Answered

workspace.xml is listed in .gitignore however, this does not prevent "git clean -dxf" from removing it, which is the intended git behavior. I have to completely clean git repository from time to time for reasons specific to our project structure.

The question is if there is a right (recommended) way to preserve workspace.xml from being removed?

Thanks,
Igor

0
5 comments

Why using -x? And if using it, why not specify ignore patterns for the command with -e?

0
Avatar
Permanently deleted user

Thanks for the reply.

-x is for removal of other normally-ignored files, like build directories, auto-generated files, and alike.

-e is a solution unless there is better one. The drawback is that it requires the file path to be added to the command every time. Should be easy to automate with a simple script but then I still need to communicate this workflow to everyone using IntelliJ-based IDEs within the repository. I wish there were some sort of attribute in .gitignore to exclude matching files from clean, even with -x.

0

Well, you explicitly tell git to drop ignore rules, so AFAIk there is no any .gitingore syntax that could help.

Seems the -e is the only pattern that can help - https://git-scm.com/docs/git-clean#git-clean--x

0
Avatar
Permanently deleted user

It makes sense, thank you.

0
Avatar
Permanently deleted user

Yup, just wiped my workspace file too.. damn it...

0

Please sign in to leave a comment.