开发者

How do I remove all Java class files from my entire project history in Mercurial?

开发者 https://www.devze.com 2023-01-14 08:51 出处:网络
When I started my Mercurial project I forgot to exclude everything under my target/classes directory, such as:

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号