Skip to content

API Reference

Welcome to the Gitmars API reference documentation.

Category Overview

Smart Navigation

Complete all operations with one command

Configuration

Initialization and configuration management

Workflow

Core workflow for branch creation, merging, and updating

Efficiency Tools

Productivity tools for copying, building, and staging

Administrator

Administrator-only commands

Command Index

CommandDescription
gitm goSmart navigation command
gitm initInitialize configuration
gitm configConfiguration query and settings
gitm startCreate branch
gitm combineBranch testing stage
gitm endFinish development
gitm updateUpdate branch
gitm continueContinue unfinished operations
gitm copyCherry-pick simplified
gitm buildBuild Jenkins
gitm build-mpBuild miniprogram Jenkins
gitm miniprogramMiniprogram commands
gitm branchBranch operations
gitm revertRevert commit
gitm undoUndo commit records
gitm redoRedo commit records
gitm saveStage files
gitm getRestore staged files
gitm cleanbranchClean branches
gitm logQuery logs
gitm hookGit hook commands
gitm runGit hook runner
gitm upgradeUpgrade gitmars
gitm cleanClear cache
gitm suggestGit operation suggestions
gitm approveHandle remote merge requests
gitm reviewRemote code review
gitm statusView branch status
gitm linkCreate symlink
gitm unlinkRemove symlink
gitm postmsgPush message
gitm aliasInstall and remove shortcuts
gitm admin createAdmin creates main branches
gitm admin publishPublish branch
gitm admin updateUpdate main branch code
gitm admin cleanClean branches
gitm permissionSubmit permission
gitm versionView version

Smart Navigation

gitm go

Smart navigation command - remember one command to access all features

  • Usage: gitm go
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
commandCommand nameStringcombine, end, update, build, build-mp, miniprogram, start, undo, redo, suggest, approve, review, admin.publish, admin.update, admin.create, admin.clean, admin.approve, branch, copy, get, save, cleanbranch, clean, revert, link, unlink, postmsgNo-
  • Example:
shell
gitm go build
  • Demo:

    gitmars-go.gif

Configuration

gitm init

Initialize configuration, follow the prompts to enter settings

gitm config

Configuration query and settings

Set Single Configuration

  • Usage: gitm config <option> [value]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
optionConfiguration nameString-Yes-
valueConfiguration valueString-No-
  • Example:
  1. Set master branch name to main
shell
gitm config master main
  1. Set apollo configuration (json)
shell
gitm config apolloConfig "{ ... }"

Query Configuration

  • Usage: gitm config list [option]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
optionConfiguration nameString-No-
  • Example:
  1. Query all configurations
shell
gitm config list
  1. Query apollo configuration
shell
gitm config list apolloConfig

Workflow

TIP

Create Thursday task branches (release), daily bug fix branches (bugfix), and project framework-related support branches

gitm start

Short command: gitm st

Start task, create branch

  • Usage: gitm start <type> <name> [-t --tag <tag>]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
typeBranch typeStringfeature/bugfix/supportYes-
nameBranch nameString-Yes-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--tag-tCreate branch from tagString-true''
  • Example:
  1. Create main workflow branch
shell
# start bugfix branch
gitm start bugfix 20001
# start feature branch
gitm start feature 1001
  1. Create bugfix branch from tag
shell
# tag 20211010
gitm start bugfix 1001 --tag 20211010

gitm combine

Short command: gitm cb

v2.11.0 added --description parameter
v5.3.0 added data parameter, supports passing extra parameters
v7.0.0 supports batch merging

Use combine command to automatically merge bugfix and feature branches to dev or pre-release environment

  • Usage: gitm combine [type] [name] [-a --add] [-m --commit [message]] [-d --dev] [-p --prod] [-b --build [build]] [--data <data>] [--description [description]] [--no-bugfix] [--as-feature] [-f --force]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
typeBranch typeStringfeature/bugfix/supportNoCurrent branch type
nameBranch nameString-NoCurrent branch name
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--add-aWhether to execute addBoolean--false
--commit-mWhether to execute commit, message requiredString-Yes''
--descriptionDescription of this commitString-No''
--dev-dSync to dev, required with --prodBoolean--false
--prod-pSync to prod, required with --devBoolean--false
--build-bApplication to buildStringall/...Noall
--no-bugfixDon't sync to bug branch (support only)Boolean--false
--as-featureMerge bugfix to releaseBoolean--false
--force-fForce merge requestBoolean--false
--dataExtra data to pass, JSON stringString-No'{}'
  • Example:
  1. Merge current branch to alpha
shell
gitm combine -d
# or
gitm cb -d
  1. Merge current branch to alpha and build
shell
gitm combine -d -b
# or
gitm combine -d --build all
# or
gitm cb -d -b gitmars
  1. Merge bugfix/20001 branch to alpha and prod
shell
gitm combine bugfix 20001 -pd
# or
gitm cb bugfix 20001 -pd
# or
gitm cb 20001 -d
  1. Merge bugfix branch to release with --as-feature
shell
gitm combine bugfix 20001 -p --as-feature
# or
gitm cb -p --as-feature
  1. Support branch prod merge syncs to bugfix and release, use --no-bugfix to skip bugfix
shell
gitm combine support 20001 -pd --no-bugfix
# or
gitm cb -pd --no-bugfix
  1. Pass extra build parameters
shell
gitm combine -b --data '{"app_id":"xxxxxx"}'
  1. Batch select feature branches for merging
shell
# Enter command and select branches to merge as prompted
gitm cb feature -d

gitm end

Short command: gitm ed

v2.9.6 end command intelligently determines whether to merge code
v2.11.0 added --description parameter
v7.0.0 supports batch branch ending

Task complete, merge and delete branch. This operation merges 20001 branch code to bug branch and deletes 20001 branch (remote 20001 branch will also be deleted)

  • Usage: gitm end [type] [name] [--description [description]] [--no-combine] [--as-feature]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
typeBranch typeStringfeature/bugfix/supportNoCurrent branch type
nameBranch nameString-NoCurrent branch name
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--no-combineDon't merge to main branch (ensure branch is released)Boolean--false
--as-featureMerge bugfix type branch to releaseBoolean--false
--descriptionDescription of this commitString-No''
  • Example:
  1. End bugfix/20001 branch
shell
gitm end bugfix 20001
# or
gitm ed bugfix 20001
  1. End current branch
shell
gitm end
# or
gitm ed
# End without merging code
gitm end --no-combine
# Merge as feature
gitm end --as-feature
  1. Batch select feature branches for cleanup
shell
# Enter command and select branches to clean as prompted
gitm end feature

gitm update

Short command: gitm up

Sync latest code from bug branch to 20001 branch (--use-rebase uses rebase method, default false)

  • Usage: gitm update [type] [name] [--use-merge] [--use-rebase] [-a --all] [-f --force]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
typeBranch typeStringfeature/bugfix/supportNoCurrent branch type
nameBranch nameString-NoCurrent branch name
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--use-mergeUse merge to update code (deprecated)Boolean--true
--use-rebaseUse rebase to update codeBoolean--false
--all-aUpdate all local development branchesBoolean--false
--force-fForce merge requestBoolean--false
  • Example:
  1. Update bugfix/20001 branch
shell
gitm update bugfix 20001
# or
gitm up bugfix 20001
  1. Use rebase to update current branch
shell
gitm update --use-rebase
# or
gitm up --use-rebase
  1. Update all local development branches
shell
gitm update --all
# or
gitm up -a
  1. Update all local feature branches
shell
gitm update feature --all
# or
gitm up feature -a

gitm continue

Short command: gitm ct

Continue unfinished operations

  • Usage: gitm continue
  • Example:
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--list-lView list of unfinished commandsBoolean-No-
  1. Continue unfinished operations
shell
gitm continue
# or
gitm ct
  1. View list of unfinished commands
shell
gitm continue --list
# or
gitm ct -l

Efficiency

gitm copy

Short command: gitm cp

v4.0.0 Refactored to self-select commit records
v7.1.0 Added --push parameter to push target branch to remote after copy

Copy commit records from current branch to target branch

  • Usage: gitm copy [commitid...] or gitm copy [--lastet [lastet]] [--limit [limit]] [--no-merges] [-p -push]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
commitidCommit IDs to copy, multiple IDs separated by spacesString-No-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--no-mergeExclude merge recordsBoolean-Nofalse
--lastetQuery logs after a certain time, format: 10s/2m/2h/3d/4M/5yString-No'7d'
--limitMaximum number of logs to queryNumber-No20
--push-pPush target branch to remoteboolean-Nofalse
  • Example:
  1. No commitid, filter logs to display (default 20)
shell
gitm copy --lastet 7d --limit 100
# or
gitm cp --lastet 7d --limit 100
  1. Pass single or multiple commitIDs
shell
# Format: gitm copy [commitid...]
gitm copy xxxxxx xxxxxx
# or
gitm cp xxxxxx

gitm build

Short command: gitm bd

v5.3.0 Added data parameter, supports passing extra parameters
v6.2.0 Added --confirm parameter
v7.0.0 Adjusted to support parameter selection, project parameter no longer required

This command initiates Jenkins build, project required, app name can be all

  • Usage: gitm build [project] [-e --env [env]] [-a --app [app]] [-d --data <data>] [-c --confirm]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
projectProject to build, if not passed, uses project name from git addressString-No-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--env-eEnvironment to buildStringdev/prod/bugNo-
--app-aSub-project to buildString-No-
--data-dExtra data to pass, JSON stringString-No'{}'
--confirm-cConfirm start, skip confirmation if trueBoolean-Nofalse
  • Example:
  1. Build gitmars app application
shell
gitm build gitmars --env dev --app app
  1. Self-select parameters
shell
gitm build

gitm build-mp

Short command: gitm bdm

v7.0.0 Added
v7.4.0 Added version type selection, added baseInfo input

This command initiates Jenkins miniprogram build

  • Usage: gitm build-mp [project] [-e --env [env]] [--api-env [apiEnv]] [-mp --miniprogram [miniprogram]] [-des --description [description]] [-a --app [app]] [-d --data <data>] [-c --confirm]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
projectProject to build, if not passed, uses project name from git addressString-No-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--env-eEnvironment to buildStringdev/prod/bugNo-
--api-envAPI environment to buildStringalpha/tag/release/productionNo-
--miniprogram-mpGenerate experience version miniprogramString-No-
--description-desVersion descriptionString-No-
--app-aSub-project to buildStringweapp/alipay/tt/dd/swanNo-
--data-dExtra data to pass, JSON stringString-No'{}'
--confirm-cConfirm start, skip confirmation if trueBoolean-Nofalse
  • Example:
  1. Build gitmars app application
shell
gitm build-mp gitmars --env dev --app weapp
  1. Self-select parameters
shell
gitm build-mp

gitm miniprogram

Short command: gitm mp

v7.0.0 Added

This command operates customized miniprograms

  • Usage: gitm miniprogram [miniprogram] [-k --keyword [keyword]]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
miniprogramMiniprogram AppID, or enter auth to get authorization codeString-auth | String-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--keyword-kMiniprogram name for fuzzy searchString-No-
  • Example:
  1. Get authorization code
shell
gitm miniprogram auth
# or
gitm mp
  1. Select miniprogram to operate
shell
gitm miniprogram
# or
gitm miniprogram --keyword test
  1. Enter miniprogram AppID to operate
shell
gitm miniprogram xxxxxx

gitm branch

Short command: gitm bh

v2.14.2 Added --exclude and --include options

Provides branch search and delete functionality

  • Usage: gitm branch [-k --key] [-t --type] [--exclude [exclude]] [--include [include]] [-r --remote] or gitm branch [-d --delete [name]] [-D --forcedelete [name]] or gitm branch [-u --upstream [upstream]]
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--key-kFuzzy match keywordString-No-
--excludeBranch names to exclude, supports regex or stringString/RegExp-No-
--includeFilter branches matching condition, supports regex or stringString/RegExp-No-
--type-tBranch type, default allStringbugfix/feature/supportNo-
--remote-rQuery remote branchesBoolean-Nofalse
--delete-dDelete local branchString-Yes-
--forcedelete-DForce delete local branchString-Yes-
--upstream-uPass branch name to bind, empty to unbindString-No''
  • Example:
  1. Query local feature branches
shell
# Format: gitm branch [-k --key] [-t --type] [--exclude [exclude]] [--include [include]] [-r --remote]
gitm branch --key bug001 --exclude="saqqdy$" --include="wu$" --remote --type feature
# or
gitm bh -k bug001 --exclude="saqqdy$" --include="wu$" -r -t feature
  1. Delete local branch
shell
# Format: gitm branch [-d --delete] [-D --forcedelete]
gitm branch -D bugfix/bug001
# or
gitm bh -D bugfix/bug001
  1. Delete local and remote branches
shell
# Format: gitm branch [-d --delete] [-D --forcedelete] [-r --remote]
gitm branch -D bugfix/bug001 --remote
# or
gitm bh -D bugfix/bug001 -r
  1. Set current branch to track remote feature/1000 branch
shell
# Format: gitm branch [-u --upstream [upstream]]
gitm branch -u feature/1000
  1. Unbind current branch from remote
shell
gitm branch -u

gitm revert

Short command: gitm rt

Revert a commit record on current branch. If reverting a merge record, need to pass revert method, 1 = keep current branch code; 2 = keep incoming code

  • Usage: gitm revert [commitid] [-m --mode [mode]] or gitm revert [-n --number] [-m --mode [mode]]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
commitidID to revertString-No-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--number-nRevert last N records, don't pass commitID when usingNumber-Nofalse
--mode-mWhich code to keep when reverting merge, 1=keep current, 2=keep incomingNumber-No-
  • Example:
  1. Revert last commit (or revert nth last commit)
shell
# Format: gitm revert [-n --number] [-m --mode [mode]]
gitm revert -n 3
# or
gitm rt -n 3
  1. Revert specific commit ID
shell
# Format: gitm revert [commitid] [-m --mode [mode]]
gitm revert xxxxxx --mode 1
# or
gitm rt xxxxxx -m 1

gitm undo

Short command: gitm ud

v2.15.0 Added command. Added --no-merges --limit --lastet --calc --calcAll parameters, removed --branch parameter

Undo commit record on current branch, or undo multiple merge records of a branch. If undoing a merge record, need to pass undo method, 1 = keep current branch code; 2 = keep incoming code

  • Usage: gitm undo [commitid...] [-m --mode [mode]] or gitm undo [--lastet [lastet]] [--limit [limit]] [-m --mode [mode]] [--no-merges] or gitm undo [--calc] [--calcAll]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
commitidIDs to undo, multiple IDs separated by spacesString-No-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--mode-mWhich code to keep when undoing merge, 1=keep current, 2=keep incomingNumber-No-
--no-mergeExclude merge recordsBoolean-Nofalse
--lastetQuery logs after a certain time, format: 10s/2m/2h/3d/4M/5yString-No'7d'
--limitMaximum number of logs to queryNumber-No20
--calcClean failed undo records of current branchBoolean-Nofalse
--calcAllClean failed undo records of all branchesBoolean-Nofalse
  • Example:
  1. No commitid, show log list to select commits to undo, if merge record, keep current branch code
shell
# Format: gitm undo [-m --mode [mode]]
gitm undo -m 1
# or
gitm ud -m 1
  1. No commitid, filter logs to display (default 20)
shell
gitm undo --lastet 7d --limit 100 --mode 1
# or
gitm ud --lastet 7d --limit 100 --mode 1
  1. Pass single or multiple commitIDs
shell
# Format: gitm undo [commitid...] [-m --mode [mode]]
gitm undo xxxxxx xxxxxx --mode 1
# or
gitm ud xxxxxx -m 1
  1. Clean failed undo records of current branch
shell
# Format: gitm undo [--calc] [--calcAll]
gitm undo --calc
# or
gitm ud --calc

gitm redo

Short command: gitm rd

v2.15.0 Added command

Redo commit record on current branch, or redo multiple merge records of a branch. If redoing a merge record, need to pass redo method, 1 = keep current branch code; 2 = keep incoming code

  • Usage: gitm redo [commitid...] [-m --mode [mode]] or gitm redo [-m --mode [mode]]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
commitidIDs to redo, multiple IDs separated by spacesString-No-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--mode-mWhich code to keep when redoing merge, 1=keep current, 2=keep incomingNumber-No-
  • Example:
  1. Pass branch name
shell
# Format: gitm redo [commitid...] [-m --mode [mode]]
gitm redo xxxxxx xxxxxx --mode 1
# or
gitm rd xxxxxx xxxxxx -m 1
  1. Pass single or multiple commitIDs
shell
# Format: gitm redo [-m --mode [mode]]
gitm redo --mode 1
# or
gitm rd -m 1

gitm save

Short command: gitm sv

Stage current branch code

  • Usage: gitm save [message] [-f --force]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
messageStash marker info, defaults to current branch nameString-NoCurrent branch name
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--force-fAdd untracked files before stagingBoolean-Nofalse
  • Example:
  1. Simple usage
shell
gitm save
# or
gitm sv
  1. Stage untracked files
shell
gitm save --force
# or
gitm save -f
  1. Set custom stash message for easy retrieval
shell
gitm save feature/1000
# or
gitm save "test login"

gitm get

Short command: gitm gt

Restore staged code

  • Usage: gitm get [message] [index] [-k --keep]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
messageStash marker info, defaults to current branch nameString-NoCurrent branch name
indexIndex to restore, restores most recent record by defaultNumber-No0
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--keep-kKeep staged recordsBoolean-Nofalse
  • Example:
  1. Simple usage
shell
gitm get
# or
gitm gt
  1. Restore feature/1000 branch stash to current branch, take 2nd record (index defaults to 1st: 0)
shell
gitm get feature/1000 1
  1. Keep stash data when restoring
shell
gitm get --keep
# or
gitm get -k
  1. Restore stash with message "test login"
shell
gitm get "test login"

gitm cleanbranch

Short command: gitm clb

v2.13.0 Added
v2.13.1 Added --list parameter
v2.13.4 Added --confirm parameter
v2.13.6 Added branches, added --target
v2.13.9 Changed --except to --exclude; added --include; added --key
v4.0.0 Added --strictly parameter

Clean merged feature branches

  • Usage: gitm cleanbranch [branches...] [-l --list [list]] [-k --key [keyword]] [--exclude [exclude]] [--include [include]] [-t --type [type]] [--target [target]] [-r --remote] [-c --confirm] [-s --strictly]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
branchesSpecify branches to cleanString-No-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--list-lShow list of matching branchesBoolean-Nofalse
--key-kKeyword to search branchesString-No-
--excludeBranch names to exclude, supports regex or stringString/RegExp-No-
--includeFilter branches matching condition, supports regex or stringString/RegExp-No-
--type-tBranch type, supports: feature/bugfix/supportString-No-
--targetTarget branch to check for merge, defaults to develop and releaseString-No-
--remote-rClean remote branches, defaults to localBoolean-Nofalse
--strictly-sEnable strict modeBoolean-Nofalse
--confirm-cConfirm start, skip confirmation if trueBoolean-Nofalse
  • Example:
  1. View matching branches before cleaning
shell
gitm cleanbranch --remote --exclude "saqqdy$" --include "[a-z]+$" --key "wu" --list
# or
gitm cleanbranch -r --exclude "saqqdy$" --include "[a-z]+$" -k "wu" -l
  1. Clean all remote feature branches
shell
gitm cleanbranch --remote
# or
gitm cleanbranch -r
  1. Clean all remote feature branches, excluding exclude-matched branches
shell
gitm cleanbranch --remote --exclude "saqqdy$"
# or
gitm cleanbranch -r --exclude "saqqdy$"
  1. Clean all local feature branches
shell
gitm cleanbranch --type feature
# or
gitm cleanbranch -t feature
  1. Clean specified branches: feature/10000 and feature/10001
shell
gitm cleanbranch feature/10000 feature/10001
  1. Change target branch to check to only need merged to release
shell
gitm cleanbranch --target release
  1. Use strict mode for checking
shell
gitm cleanbranch --target release --strictly

gitm log

v1.4.0 Added
v2.15.0 Added --no-merges parameter
v2.15.3 Added --json parameter for JSON output, defaults to table

Query logs

  • Usage: gitm log [branch] [--lastet [lastet]] [--limit [limit]] [--no-merges] [--json]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
branchBranch nameString-No-
- Options:
NameShortDescriptionTypeOptionsRequiredDefault
--lastetQuery logs after a certain time, format: 10s/2m/2h/3d/4M/5yString-No'7d'
--limitMaximum number of logs to queryNumber-No20
--no-mergeExclude merge recordsBoolean-Nofalse
--jsonOutput logs in JSON format, defaults to tableBoolean-Nofalse
  • Example:
  1. Query logs within last 7 days, max 50
shell
gitm log --latest 7d --limit 50
  1. Exclude merge records
shell
gitm log --no-merges --limit 50
  1. View dev branch log
shell
gitm log dev
  1. View logs in JSON format
shell
gitm log --json

gitm hook

1.4.0 Added

Publish operation

  • Usage: gitm hook [command] [args...] [--no-verify] [--lastet [lastet]] [--limit [limit]] [-t --type <type>] [--branch [branch]]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
commandCommand nameString-Yes-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--no-verifySkip permission verificationBoolean-Nofalse
--lastetQuery logs after a certain time, format: 10s/2m/2h/3d/4M/5yBoolean-No-
--limitMaximum number of logs to queryNumber-No20
--type-tCheck typeNumber-Yes''
--branchBranch to queryString-No''

gitm run

1.4.0 Added

TIP

Internal method, only for internal program use

Run command is an internal command executed in gitmars hook to run hook methods

  • Usage: gitm run <command> [args...]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
commandHook nameStringYes-
argsArgument listStringNo-

gitm upgrade

Short command: gitm ug

Upgrade gitmars version. Can specify version, optional, defaults to latest

  • Usage: gitm upgrade [version] [-m --mirror] [-c --client [client]] [-r --registry <registry>]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
versionVersion to upgrade toStringalpha, beta, release, lite, latest, next, x.x.xNolatest
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--mirror-mUse Taobao mirror for upgradeBoolean-Nofalse
--registry-rUse mirror addressString-Yesfalse
--mirror-mUse Taobao mirror for upgradeBoolean-Nofalse
  • Example:
  1. Simple usage
shell
gitm upgrade --mirror
# or
gitm ug -m

gitm clean

Clean gitmars cache and local configuration. Use --force to also clean local config files (use with caution)

shell
Format: gitm clean [-f --force]
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--force-fClean gitmars execution cacheBoolean-Nofalse
  • Example:
shell
gitm clean

gitm approve

Short command: gitm ap

v2.16.0 Added
v2.16.4 Removed --postmsg, added '--quiet'

Handle remote merge requests

  • Usage: gitm approve [--state [state]] [--quiet]
  • Arguments: None
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--stateFilter merge request statusStringopened closed merged allNoopened
--quietDon't push messageBooleanNofalse
  • Example:
shell
# Enter command and follow prompts
gitm approve --quiet

gitm review

Short command: gitm rv

v2.16.0 Added
v2.16.4 Removed --postmsg, added '--quiet'

Remote code review

  • Usage: gitm review [--state [state]] [--quiet]
  • Arguments: None
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--stateFilter merge request statusStringopened closed merged allNoopened
--quietDon't push messageBooleanNofalse
  • Example:
shell
# Enter command and follow prompts
gitm review --state merged

gitm status

View current branch status

  • Usage: gitm status

  • Arguments: None

  • Options: None

  • Example:

shell
gitm status

Create local package symlink. When name is passed, symlink dependency package to local; when name is not passed, create public symlink for current package

  • Usage: gitm link [name]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
namePackage nameString-No-
  • Example 1: Link local tool package
shell
gitm link tool
  • Example 2: Create public symlink for current package
shell
gitm link

When name is passed, remove dependency package symlink; when name is not passed, delete public symlink for current package

  • Usage: gitm unlink [name]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
namePackage nameString-Yes-
  • Example 1: Remove dependency package symlink
shell
gitm unlink tool
  • Example 2: Delete public symlink for current package
shell
gitm unlink

gitm postmsg

Push message

  • Usage: gitm postmsg <message> [-u --url [url]]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
messageMessage contentString-Yes-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--url-uCustom message push URLString-No-
  • Example:
  1. Simple usage
shell
gitm postmsg "test message"
  1. Custom push URL
shell
gitm postmsg "test message" --url "https://github.com/"

gitm alias

Short command: None

v2.18.0 Added

Install and remove shortcuts

  • Usage: gitm alias init or gitm alias remove
  • Arguments: None
  • Options: None
  • Example:
shell
# Install
gitm alias init
# Remove
gitm alias remove
  • Usage:
  1. gitm alias usage
shell
# Create branch
gitm start feature 100001
# or
git mars start feature 100001
# or
git flow start feature 100001
  1. Git shortcuts
NameCommandUsageDescription
unstagereset HEAD --git unstage file1.jsRemove from staging area
lastlog -1 HEADgit lastShow last log
ststatusgit stGit status
cmcommitgit cm -m "xxxx"Commit version
brbranchgit brBranch management
bhbranchgit bhBranch management
ckcheckoutgit ck devSwitch to branch
ckbcheckout -bgit ckb dev masterCreate branch
cpcherry-pickgit cp xxxxxxCopy commit record
pspushgit psPush code to remote
plpullgit plPull remote code
plmpull --mergegit plmPull code via merge
plrpull --rebasegit plrPull code via rebase
fhfetchgit fhFetch remote version
shstashgit shSave to stash
shpstash popgit shpPop from stash
shastash applygit shaApply from stash
mgmergegit mg feature/testMerge branch
mgnmerge --no-ffgit mgn feature/testMerge via --no-ff
rsresetgit rs xxxxxxReset
rshreset --hardgit rsh xxxxxxHard reset
rssreset --softgit rss xxxxxxSoft reset
rbrebasegit rbRebase

Administrator

gitm admin create

Create release, bugfix, support, and develop branches

  • Usage: gitm admin create <type>
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
typeBranch typeStringbugfix/release/developYes-
  • Example:

Create release branch

shell
gitm admin create release

gitm admin publish

v2.11.0 Added --description parameter
v5.3.0 publish added data parameter, supports passing extra parameters

Publish operation

  • Usage: gitm admin publish <type> [--description [description]] [-c --combine] [--use-rebase] [-p --prod] [-b --build [build]] [-d --data <data>] [-p --postmsg] [-f --force]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
typeBranch typeStringbugfix/release/supportYes-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--combine-cSync release to bugfix after merging release (only when merging release)Boolean-Nofalse
--prod-pWhen publishing bugfix, whether to merge bugfix to masterBoolean-Nofalse
--build-bWhether to use Taobao mirror for upgradeBoolean-Nofalse
--use-rebaseUse rebase for mergingBoolean-Nofalse
--postmsg-pWhether to send group messageBoolean-Nofalse
--descriptionDescription of this commitString-No''
--force-fForce merge requestBoolean--false
--data-dExtra data to pass, JSON stringString-No'{}'
  • Example:
  1. Merge release code to pre-release environment
shell
gitm admin publish release
  1. Publish and execute build
shell
# Build all
gitm admin publish release --build
# or
gitm admin publish release -b
# Build app only
gitm admin publish release --build app
# or
gitm admin publish release -b app
  1. Publish and execute build, pass extra build parameters
shell
# Build all
gitm admin publish release --build --data '{"app_id":"xxxxxx"}'
# or
gitm admin publish release -b -d '{"app_id":"xxxxxx"}'

gitm admin update

v2.11.0 Added --description parameter

Update release, bugfix, support branch code, defaults to merge method

  • Usage: gitm admin update <type> [--description [description]] [--use-rebase] [-m --mode [mode]] [-p --postmsg] [-f --force]
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
typeBranch typeStringbugfix/release/supportYes-
  • Options:
NameShortDescriptionTypeOptionsRequiredDefault
--mode-mOn conflict, which code to keep; 1=keep current 2=keep incoming; default 0=manual. Cannot use with --use-rebaseNumber0/1/2No0
--use-rebaseUse rebase for syncBoolean-Nofalse
--postmsg-pWhether to send group messageBoolean-Nofalse
--descriptionDescription of this commitString-No''
--force-fForce merge requestBoolean--false
  • Example:
  1. Update bug branch code
shell
gitm admin update bugfix -m 2
# or
gitm admin up bugfix -m 2

gitm admin clean

Jenkins build cleanup for git branches, can pass release, bugfix, develop branch code

  • Usage: gitm admin clean <type>
  • Arguments:
ParameterDescriptionTypeOptionsRequiredDefault
typeBranch typeStringbugfix/release/support/masterYes-
  • Example:

Clean branches

shell
gitm admin clean bugfix

Other

gitm permission

Check for unauthorized operations

  • Usage: gitm permission
  • Example:

gitm version

View gitmars version number

  • Usage: gitm --version
  • Example:
shell
gitm --version
# or
gitm -v

Released under the GPL-3.0 License.