为什么没有git submodule init和git submodule更新一个命令?

时间:2014-04-15 16:32:12

标签: git git-submodules

每当我在git中使用子模块时,发现自己在做

git submodule init
git submodule update

每次基本执行这些命令时,两个命令中的逻辑是什么?

3 个答案:

答案 0 :(得分:1)

不确定分离,但一个简单的解决方法是使用别名。

alias gitrox="git submodule init && git submodule update"

答案 1 :(得分:1)

git submodule init初始化机器,而git submodule update为子模块引入新的更改。如果您要添加子模块,则无需更新任何内容,因此您只需运行git submodule init即可初始化回购。 (它会创建一个.gitmodules文件,以及.git/中用于跟踪子模块的一些内容。)

答案 2 :(得分:0)

他们确实有办法在一次通话中完成:




-/+ resource "aws_ecs_task_definition" "this_task" {
              ~ arn                      = "arn:aws:ecs:ca-central-1:AWS_ACCOUNT_ID:task-definition/this:4" -> (known after apply)
              ~ container_definitions    = jsonencode(
                  ~ [ # forces replacement
                      ~ {
                          - cpu              = 0 -> null
                            environment      = [
                                {
                                    name  = "BASE_S3"
                                    value = "thisisthevalue"
                                },
                                {
                                    name  = "THIS_PLATFORM_API"
                                    value = "thisisthevlaue"
                                },
                                {
                                    name  = "SECRET"
                                    value = "thisisthesecret"
                                },
                                {
                                    name  = "ID"
                                    value = "thisistheid"
                                },
                                {
                                    name  = "THIS_SOCKET_URL"
                                    value = "thisisthevalue"
                                },
                                {
                                    name  = "REDISURL"
                                    value = "thisisthevalue"
                                },
                            ]
                            essential        = true
                            image            = "AWS_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com/this:v1.0.0-develop.6"
                            logConfiguration = {
                                logDriver = "awsfirelens"
                                options   = {
                                    Host           = "http-intake.logs.datadoghq.com"
                                    Name           = "datadog"
                                    TLS            = "on"
                                    apikey         = "thisisthekey"
                                    dd_message_key = "log"
                                    dd_service     = "this"
                                    dd_source      = "this"
                                    dd_tags        = "thisisthetags"
                                    provider       = "ecs"
                                }
                            }
                          - mountPoints      = [] -> null
                            name             = "ec2-vp"
                          ~ portMappings     = [
                              ~ {
                                    containerPort = 443
                                    hostPort      = 443
                                  - protocol      = "tcp" -> null
                                },
                            ]
                          - volumesFrom      = [] -> null
                        } # forces replacement,
                      ~ {
                          - cpu                   = 0 -> null
                          - environment           = [] -> null
                            essential             = true
                            firelensConfiguration = {
                                options = {
                                    enable-ecs-log-metadata = "true"
                                }
                                type    = "fluentbit"
                            }
                            image                 = "amazon/aws-for-fluent-bit:latest"
                          - mountPoints           = [] -> null
                            name                  = "log_router"
                          - portMappings          = [] -> null
                          - user                  = "0" -> null
                          - volumesFrom           = [] -> null
                        } # forces replacement,
                    ]
                )
                cpu                      = "256"
                execution_role_arn       = "arn:aws:iam::AWS_ACCOUNTID:role/thisistherole"
                family                   = "this"
              ~ id                       = "this-service" -> (known after apply)
                memory                   = "512"
                network_mode             = "awsvpc"
                requires_compatibilities = [
                    "FARGATE",
                ]
              ~ revision                 = 4 -> (known after apply)
                tags                     = {
                    "Cluster"      = "this"
                    "Env"          = "this"
                    "Name"         = "this"
                    "Owner"        = "this"
                    "Proj"         = "this"
                    "SuperCluster" = "this"
                    "Terraform"    = "true"
                }
                task_role_arn            = "arn:aws:iam::AWS_ACCOUNT+ID:role/thisistherole"
            }

来源: https://git-scm.com/docs/git-submodule#Documentation/git-submodule.txt-init--ltpathgt82308203