Git系列:常用命令
一.背景
作为一名程序员,怎么能不懂Git那些常用命令呢?于是花费一点时间来总结Git命令。关于安装的话,就不讲了。
二.常用命令
1.配置全局的用户名称和用户邮箱
git config –global user.name “用户名” && git config –global user.email “邮箱账号”
git config —list
git config user.name
[root@centos-master ~]# git config --global user.name "robin" && git config --global user.email "[email protected]" [root@centos-master ~]# git config --list user.name=robin user.email=[email protected] [root@centos-master ~]# git config user.name robin [root@centos-master ~]#
2.查看帮助
git help -a
git help <command>
[root@centos-master ~]# git help -a usage: git [--version] [--help] [-c name=value] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] <command> [<args>] available git commands in '/usr/libexec/git-core' add clean fast-import init merge-tree receive-pack revert tar-tree add--interactive clone fetch init-db mergetool reflog rm unpack-file am column fetch-pack log mktag relink send-pack unpack-objects annotate commit filter-branch lost-found mktree remote sh-i18n--envsubst update-index apply commit-tree fmt-merge-msg ls-files mv remote-ext shell update-ref archive config for-each-ref ls-remote name-rev remote-fd shortlog update-server-info bisect count-objects format-patch ls-tree notes remote-ftp show upload-archive bisect--helper credential fsck mailinfo pack-objects remote-ftps show-branch upload-pack blame credential-cache fsck-objects mailsplit pack-redundant remote-http show-index var branch credential-cache--daemon gc merge pack-refs remote-https show-ref verify-pack bundle credential-store get-tar-commit-id merge-base patch-id remote-testpy stage verify-tag cat-file describe grep merge-file peek-remote repack stash web--browse check-attr diff hash-object merge-index prune replace status whatchanged check-ignore diff-files help merge-octopus prune-packed repo-config stripspace write-tree check-ref-format diff-index http-backend merge-one-file pull request-pull submodule checkout diff-tree http-fetch merge-ours push rerere submodule--helper checkout-index difftool http-push merge-recursive quiltimport reset subtree cherry difftool--helper imap-send merge-resolve read-tree rev-list symbolic-ref cherry-pick fast-export index-pack merge-subtree rebase rev-parse tag 'git help -a' and 'git help -g' lists available subcommands and some concept guides. See 'git help <command>' or 'git help <concept>' to read about a specific subcommand or concept.
3.克隆远程仓库
git -b dev git仓库
4.初始化git
git init
[root@centos-master git]# mkdir my-project [root@centos-master git]# cd my-project/ [root@centos-master my-project]# git init Initialized empty Git repository in /opt/git/my-project/.git/ [root@centos-master my-project]# ls -a . .. .git [root@centos-master my-project]#
暂时不写了!感觉没啥好写的,拿着就能用那种