How do I remove all Java class files from my entire project history in Mercurial?
When I started my Mercurial project I forgot to exclude everything under my target/classes
directory, such as:
target/classes/com/mypackage/MyClass.class
No开发者_开发知识库w these binary files are causing conflicts when I do a hg update
.
Is there a single command that would allow me to delete all of these files from the entire project history?
Or, if not, is there a command that would allow me to remove them one file at a time?
If you just want to remove files from last revision, remove files from disk and use hg addremove
or hg remove --after target/classes/com/mypackage/*.class
to inform Mercurial about your deletion.
If you want to permanently remove all class files from you entire history use hg convert
and --filemap
option to rewrite your repository and get rid of files from all revisions. However this solution alters revision ids. In multi user environment it may cause some problems because it creates a new repository effectively.
If you delete the files in question then do hg addremove
then the files will be removed from the repository. However they will still be in the history though, but is that really a problem?
Use hg remove --after target/classes/com/mypackage/*.class
. (--after
will avoid deleting the on-disk files).
精彩评论