"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
Please sign in to leave a comment.
Why using -x? And if using it, why not specify ignore patterns for the command with -e?
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.
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
It makes sense, thank you.
Yup, just wiped my workspace file too.. damn it...