get 命令汇总
git config
配置 Git 的相关参数。
Git 一共有3个配置文件:
\1. 仓库级的配置文件:在仓库的 .git/.gitconfig
,该配置文件只对所在的仓库有效。
\2. 全局配置文件:Mac 系统在 ~/.gitconfig
,Windows 系统在 C:\Users\<用户名>\.gitconfig
。
\3. 系统级的配置文件:在 Git 的安装目录下(Mac 系统下安装目录在 /usr/local/git
)的 etc
文件夹中的 gitconfig
。
$ git config <--local | --global | --system> -l
$ git config -l
$ git config <--local | --global | --system> -e
$ git config <--local | --global | --system> --add <name> <value>
$ git config <--local | --global | --system> --get <name>
$ git config <--local | --global | --system> --unset <name>
$ git config --global user.name <用户名>
$ git config --global user.email <邮箱地址>
$ git config --global http.postBuffer <缓存大小>
$ git config --global color.ui true
$ git config --global credential.helper cache
$ git config --global credential.helper 'cache --timeout=<缓存时间>'
$ git config --global credential.helper store
git clone
从远程仓库克隆一个版本库到本地。
$ git clone <远程仓库的网址>
$ git clone <远程仓库的网址> <本地目录>
$ git clone <远程仓库的网址> -b <分支名称> <本地目录>
git init
初始化项目所在目录,初始化后会在当前目录下出现一个名为 .git 的目录。
$ git init
git status
查看本地仓库的状态。
$ git status
$ git status -s
git remote
操作远程库。
$ git remote
$ git remote -v
$ git remote --verbose
$ git remote add <远程仓库的别名> <远程仓库的URL地址>
$ git remote rename <原远程仓库的别名> <新的别名>
$ git remote remove <远程仓库的别名>
$ git remote set-url <远程仓库的别名> <新的远程仓库URL地址>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)