我发现hg status未跟踪目录的输出太冗长了.假设我有多数民众赞成双方管理的空库git和hg.所以会有两个目录,.git和.hg.
输出git status是:
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .hg/
Run Code Online (Sandbox Code Playgroud)
输出hg status是:
? .git/HEAD
? .git/config
? .git/description
? .git/hooks/applypatch-msg.sample
? .git/hooks/commit-msg.sample
? .git/hooks/post-commit.sample
? .git/hooks/post-receive.sample
? .git/hooks/post-update.sample
? .git/hooks/pre-applypatch.sample
? .git/hooks/pre-commit.sample
? .git/hooks/pre-rebase.sample
? .git/hooks/prepare-commit-msg.sample
? .git/hooks/update.sample
? .git/info/exclude
Run Code Online (Sandbox Code Playgroud)
有没有办法将其输出减少到类似下面的行?
? .git/
Run Code Online (Sandbox Code Playgroud)
won*_*ng2 23
这对我有用:
hg status -q
Run Code Online (Sandbox Code Playgroud)
选项
-q/--quiet隐藏未跟踪(未知和已忽略)文件,除非使用-u/--unknown或-i/ 明确请求--ignored.
Von*_*onC 11
您只需添加.hgignore文件即可
syntax:glob
.git
.gitattributes
.gitignore
Run Code Online (Sandbox Code Playgroud)
.git完全忽略和其他与git相关的文件.
如果目标只是限制目录,那么.hgignore如果在该目录中添加隐藏文件(在此答案之后),您仍然可以使用:
syntax:regexp
^.git/(?!\.hidden).+$
Run Code Online (Sandbox Code Playgroud)
由于Mercurial根本不跟踪目录,因此将忽略.git除隐藏目录之外的所有文件,实际上只在状态中显示一行.
您还可以使用选项-q/--quiet(to hg status),它隐藏未跟踪(未知和忽略)的文件,除非使用-u/--unknown或明确请求-i/--ignored.
但这意味着.git在这种情况下甚至不会出现.
但如果目标是限制在一般的汞状态输出到唯一的目录,而不是他们对未经跟踪文件的内容,那么我认为这是不可能的:
| 归档时间: |
|
| 查看次数: |
7414 次 |
| 最近记录: |