Git相关的配置文件有三个:
1. /etc/gitconfig:包含了适用于系统所有用户和所有项目的值。# --system 系统级
2. ~/.gitconfig:只适用于当前登录用户的配置。 # --global 全局
3. .git/config:适用于特定git项目的配置。 # --local 项目级
4. 注意:对于同一配置项,三个配置文件的优先级是1<2<3
$ git config --global core.editor emacs # 选择文本编辑器
$ git config --list # 检查配置信息
$ git config --system -l # 查看系统级的配置信息
$ git config [--local|--global|--system] section.key value # 添加配置项
# student区域下添加一个名称为height值为198的配置项
$ git config --system student.heght 198
# 删除配置项
git fconfig --system --unset student.height
$ cd # 返回默认路径
$ cd .. # 回退到上一个目录,直接cd进入默认目录
$ pwd # 显示当前所在的目录路径。
$ ls(ll) # 都是列出当前目录中的所有文件,只不过ll(两个ll)列出的内容更为详细。
$ reset #重新初始化终端/清屏。
$ clear # 清屏。
$ history # 查看命令历史。
$ exit # exit 退出。
$ help # 帮助。
$ # #跟python注释符一样
$ git config -l #可以查看现在的git环境详细配置
$ git config --system --list #查看系统config
$ git config --global --list #查看当前用户(global)配置
$ git config --local --list #查看当前仓库配置信息
$ touch index.js # 新建一个文件 如 touch index.js 就会在当前目录下新建一个index.js文件。
$ rm index.js# 删除一个文件, rm index.js 就会把index.js文件删除。
$ rm index -r # 删除index目录
$ mkdir index # 新建一个目录,就是新建一个文件夹。
$ cat index.txt # 查看文件
git基础命令
最新推荐文章于 2025-03-17 14:13:38 发布
21万+

被折叠的 条评论
为什么被折叠?



