gpt4 book ai didi

bash - "correct"的最简单方法是意外使用 mv 而不是 hg mv?

转载 作者:行者123 更新时间:2023-11-29 09:50:36 25 4
gpt4 key购买 nike

我有一个跟踪的foo。现在,因为我心不在焉,所以我跑了:

mv foo bar

现在,当我执行 hg st 时,我得到:

! foo
? bar

我想追溯修复这个问题——就好像我做了一个hg mv foo bar

现在,我可以编写一个 bash 脚本来为我完成这些工作 - 但我可以做一些更好/更简单/更智能的事情吗?

最佳答案

使用 --after 选项:hg mv --after foo bar

$ hg mv --help
hg rename [OPTION]... SOURCE... DEST

aliases: move, mv

rename files; equivalent of copy + remove

Mark dest as copies of sources; mark sources for deletion. If dest is a
directory, copies are put in that directory. If dest is a file, there can
only be one source.

By default, this command copies the contents of files as they exist in the
working directory. If invoked with -A/--after, the operation is recorded,
but no copying is performed.

This command takes effect at the next commit. To undo a rename before
that, see 'hg revert'.

Returns 0 on success, 1 if errors are encountered.

options ([+] can be repeated):

-A --after record a rename that has already occurred
-f --force forcibly copy over an existing managed file
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
-n --dry-run do not perform actions, just print output
--mq operate on patch repository

(some details hidden, use --verbose to show complete help)

关于bash - "correct"的最简单方法是意外使用 mv 而不是 hg mv?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48014583/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com