Skip to content

User: Introduce to git options

cadappl edited this page Sep 1, 2018 · 1 revision

Both sub-command git-p (git-b) and repo (repo-mirror) shared some of the same options from git. It's good here to explain the usage of the options as the only references.

With the option --help, the options mainly belong to two option groups: Remote options and Import options. Below options are from krep with v0.3. Other options in the groups have been removed.

  Remote options:
    -r REF, --refs=REF  the reference prefix of the remote server
    --branch-refs=HEAD_REF, --head-refs=HEAD_REF
                        the reference prefix of the heads. it will override
                        the one of "refs"
    --tag-refs=TAG_REF  the reference prefix of the tags. it will override the
                        one of "refs"
    --remote=REMOTE, --server=REMOTE, --gerrit-server=REMOTE
                        Set gerrit url for the repository management

  Import options:
    -k, --keep-name     keep current head or tag name without new refs as the
                        last part
    -a, --all           Take all operations except to suppress with opposite
                        option like "--no-tags". The action is merged by the
                        sub-command
    --branches, --heads
                        push all branches to the remote. Once option "--all"
                        is set, it is enabled except "--no-branches" or "--no-
                        heads" is set explicitly
    --tags              push all tags to the remote. Once option "--all" is
                        set, it is enabled except "--no-tags" is set
                        explicitly
    --branch-pattern=HEAD_PATTERN, --head-pattern=HEAD_PATTERN
                        push the matched heads with regex patterns. The
                        replacement rules could be used to update the remote
                        head name
    --tag-pattern=TAG_PATTERN
                        push the matched tags with regex patterns. The
                        replacement rule could be used to update the remote
                        tag names

The options can be categorized into two purposes:

  • Importing behaviours like how to import
  • Importing naming like what to import

Thus, it can be easily to understand how to use the options:

  • remote It's the option to indicate the remote name like ssh://cadappl@github.com and similar alternative, which can be customized in user .gitconfig file. The option will be used by both Gerrit and git_cmd.

  • keep-name It's the one to handle the pushing head and tag, which prevents to cut the name to leave the last segment. The original full name will be used for push. For example, aosp/android-8.0.1_r1 will be kept if option is provide, otherwise android-8.0.1_r1 will be pushed instead.

  • refs It will be treated as the prefix to insert before the pushing head and tag as it's useful in some case not to break local SCM policy to leave the default master branch.

  • head-refs It's the option like refs, which would override the settings of refs if existed. Generally, it's good use aosp as the refs for Andorid Open Source Project (AOSP).

  • tag-refs It's the option like refs, which would override the settings of refs if existed. For AOSP, it's better not to use tag-refs to use its original manifest.

  • all The option decides which to push. With the option, both heads and tags would be push the remote. If the option provided, option heads and tags will have no effect any more except --no-heads or --no-tags is used to suppress the behaviour explicitly.

  • heads The option decides to push head but can be overrided by all. --no-heads would be used to suppress the behaviour.

  • tags The option decides to push tag but can also be overrided by all. --no-tags could be used to suppress the behaviour.

  • head-pattern The option supports the pattern to match the existent local heads for push. If dismissed, all heads will be pushed.

  • tag-pattern The option supports the pattern to match the existent local tags for push. If dismissed, all tags will be pushed.