如何自动删除Mercurial工作树中的所有.orig文件? [英] How to automatically remove all .orig files in Mercurial working tree?

查看:71
本文介绍了如何自动删除Mercurial工作树中的所有.orig文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

期间,合并任何未解决的文件.但是,在手动解决问题并标记文件正确之后,它不会删除.orig文件.可以通过某些命令将其自动删除吗?

During merges mercurial leaves .orig file for any unresolved file. But after manually resolving problems and marking a file correct it does not delete the .orig file. Can it be automatically removed by some command?

我在Mac上工作,因此可以使用类似的内容:

I work on a Mac so I can use something like:

find . -iname '*.orig' -exec rm '{}' ';'

并为其加上别名,但我宁愿使用hg cleanup ...

and alias it or something, but I'd rather use something like hg cleanup...

更新:

从现在开始,清除扩展与Mercurial捆绑在一起并解决了此问题.很好.

Since some time now, Purge extension is bundled with Mercurial and solves this problem nicely.

推荐答案

我个人使用

$ rm **/*.orig

如果我厌倦了.orig文件.在运行shopt -s globstar之后,此方法将在Zsh和Bash 4中起作用.

if I get tired of the .orig files. This works in Zsh and in Bash 4 after you run shopt -s globstar.

但是,如果您使用其他外壳或需要内置解决方案,那么您可能会喜欢清除扩展名(链接于2016-08-25更新).这样您就可以使用

But if you use another shell or want a built-in solution, then maybe you'll like the purge extension (link updated 2016-08-25). That lets you remove all untracked files with

$ hg purge

您可以使用以下方法删除所有未跟踪和忽略的文件

You can remove all untracked and ignored files with

$ hg purge --all

使用hg purge的一个优点是,这还将清除删除文件后变为空的目录. rm命令行将只留下空白目录.

An advantage of using hg purge is that this will also cleanup directories that become empty after removing the files. The rm command line will just leave the empty directories behind.

这篇关于如何自动删除Mercurial工作树中的所有.orig文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆