常用 git 命令使用说明(-help)汇总


1、克隆远程代码库 git clone

qiaozhiguang@XSLUser[master*]$git clone -help
usage: git clone [] [--]  []

    -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
    --no-hardlinks        don't use local hardlinks, always copy
    -s, --shared          setup as shared repository
    --recursive           initialize submodules in the clone
    --recurse-submodules  initialize submodules in the clone
    --template 
                          directory from which templates will be used
    --reference     reference repository
    --dissociate          use --reference only while cloning
    -o, --origin    use  instead of 'origin' to track upstream
    -b, --branch 
                          checkout  instead of the remote's HEAD
    -u, --upload-pack 
                          path to git-upload-pack on the remote
    --depth        create a shallow clone of that depth
    --single-branch       clone only one branch, HEAD or --branch
    --separate-git-dir 
                          separate git dir from working tree
    -c, --config 
                          set config inside the new repository



2、创建本地代码仓库 git init

qiaozhiguang@XSLUser[master*]$git init -help
usage: git init [-q | --quiet] [--bare] [--template=] [--shared[=]] []

    --template 
                          directory from which templates will be used
    --bare                create a bare repository
    --shared[=]
                          specify that the git repository is to be shared amongst several users
    -q, --quiet           be quiet
    --separate-git-dir 
                          separate git dir from working tree

3、添加命令 git add

qiaozhiguang@XSLUser[master*]$git add -help
usage: git add [] [--] ...

    -n, --dry-run         dry run
    -v, --verbose         be verbose

    -i, --interactive     interactive picking
    -p, --patch           select hunks interactively
    -e, --edit            edit current diff and apply
    -f, --force           allow adding otherwise ignored files
    -u, --update          update tracked files
    -N, --intent-to-add   record only the fact that the path will be added later
    -A, --all             add changes from all tracked and untracked files
    --ignore-removal      ignore paths removed in the working tree (same as --no-all)
    --refresh             don't add, only refresh the index
    --ignore-errors       just skip files which cannot be added because of errors
    --ignore-missing      check if - even missing - files are ignored in dry run

4, git tag 标签命令

qiaozhiguang@XSLUser[master*]$git tag -help
usage: git tag [-a | -s | -u ] [-f] [-m  | -F ]  []
   or: git tag -d ...
   or: git tag -l [-n[]] [--contains ] [--points-at ]
		[...]
   or: git tag -v ...

    -l, --list            list tag names
    -n[]               print  lines of each tag message
    -d, --delete          delete tags
    -v, --verify          verify tags

Tag creation options
    -a, --annotate        annotated tag, needs a message
    -m, --message 
                          tag message
    -F, --file      read message from file
    -s, --sign            annotated and GPG-signed tag
    --cleanup       how to strip spaces and #comments from message
    -u, --local-user 
                          use another key to sign the tag
    -f, --force           replace the tag if exists

Tag listing options
    --column[=