【问题标题】:What does the option " -q" in git cli and this command do?git cli 和这个命令中的选项“-q”有什么作用?
【发布时间】:2020-06-22 00:55:27
【问题描述】:

我正在学习机器学习,我正在分析 google colab 中的暹罗面具教程。

看到代码“-q”,不知道代码是什么意思。

我查了一下,没找到。

如果您能帮助我,我将不胜感激。

我认为代码是 Linux 命令选项之一

!git clone -q --depth 1 {git_repo_url}
!sed -i "/torch/d" {project_name}/requirements.txt
!cd {project_name} && pip install -q -r requirements.txt
!cd {project_name} && bash make.sh
!pip install -q youtube-dl

【问题讨论】:

    标签: linux git command-line


    【解决方案1】:

    代码不是关于机器学习,而是克隆由版本控制系统 git 管理的存储库。

    Git clone 的帮助页面告诉你 -q 选项切换到安静,就像在非详细的命令行输出中一样。

      git clone -?                                                                                                                                                                                
      usage: git clone [<options>] [--] <repo> [<dir>]                                                                                                                                                                                                    
      -v, --verbose         be more verbose                                                                                   
      -q, --quiet           be more quiet                                                                                     
      --progress            force progress reporting                                                                          
      -n, --no-checkout     don't create a checkout                                                                           
      --bare                create a bare repository                                                                          
      --mirror              create a mirror repository (implies bare)                                                         
      -l, --local           to clone from a local repository                                                                                                                                                                                        
      [...]
    

    您的示例中的第二个-q 选项指的是pip 成为退出(er),就像不那么冗长,通过降低日志级别,每个q 作为参数添加(最多3 个是可能的)。这可以通过在控制台上调用 `pip install --help``` 找到。摘录:

    -q, --quiet       Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).
    

    因此,您的 bash 命令逐行执行以下操作:

    1. {git_repo_url}克隆存储库到当前提示符
    2. requirements.txt 中的字符串操作以进行依赖性校正
    3. 将提示更改为项目目录并安装项目的所有python依赖项
    4. 将提示更改为项目目录并运行 make 脚本
    5. 悄悄安装python包

    一般供将来参考:如果您不确定命令的作用,请尝试仅使用不带参数的命令以及 -?-h--help 的任何变体。在大多数 unixoide shell 上,这为您提供了一个非常有用的页面,其中介绍了命令的用途及其所有(或大部分)可能的参数。养成始终首先提及这一点的习惯,这实际上是开发人员自己教你如何使用他们的软件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-05
      • 2021-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-19
      • 2013-11-19
      • 2018-05-15
      相关资源
      最近更新 更多