How does one configure mercurial hg to not retain backups by default?

人走茶凉 提交于 2019-12-08 15:53:23

问题


I never use those .orig files, and I hate cleaning them up manually. Is there a way to configure hg revert to use the --no-backups option by default? I can't find it in the Mercurial manual

Using a shell alias is possible but isn't desirable.


回答1:


You can create an alias in your config file.

More details on the config file at http://www.selenic.com/mercurial/hgrc.5.html

Read the manual myself, and it looks like its changed somewhat since the last time I read it. I was going to suggest using defaults, but it appears that has been deprecated. The recommendation is to use aliases.

It appears an alias CAN override a built-in command, but obviously they don't recommend it.

So, you could do

[alias]
revert = revert --no-backup

but the recommendation would be to create a new command for yourself




回答2:


Actually, the best way is to include the following two lines in your .hgrc file:

[defaults]
revert = --no-backup


来源:https://stackoverflow.com/questions/5159577/how-does-one-configure-mercurial-hg-to-not-retain-backups-by-default

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!