【Git 入门系列】FAQ
配置问题
Git Bash 不能显示中文
假设目录里面新增了一个中文名称的 txt, 使用 git status 查看有改动但未提交的文件时总只显示数字串,显示不出中文文件名。 这是因为在 默认设置下,Git 显示为八进制字符编码
解决方案
首先 将 Git 配置文件 core.quotepath 项设置为 false(不会对 0x80 以上的字符进行 quote)
git bash 终端输入命令:git config --global core.quotepath false
quotepath
表示引用路径--global
表示全局配置
这样设置后如果无效,那么 git bash 终端也需要设置成中文和 utf-8 编码。
在 git bash 的界面中右击空白处,弹出菜单, 选择 选项 (Options) -> 文本 (Text),本地 (Local) 设置为zh_CN,字符集选框选为 UTF-8
Git 管理中,文件大小写问题
如果修改了一个文件或目录的大小写,status 查看一下,是看不到更改的 原因是: Git 默认不区分大小写 所以最好把 Git 的大小写敏感开启,否则可能有坑
解决方案
git config --get core.ignorecase
查看默认配置 然后把这项设置成 false 表示区分大小写 git config core.ignorecas false
Git 操作问题
help
Git 命令虽然不难,但有时候容易记混,在基本 Git 关键字后面使用-h
选项可获得相关使用方法 比如 查看 config
都有哪些选项,使用 git config -h
$ git config -h
usage: git config [<options>]
Config file location
--global use global config file
--system use system config file
--local use repository config file
-f, --file <file> use given config file
--blob <blob-id> read config from given blob object
Action
--get get value: name [value-regex]
--get-all get all values: key [value-regex]
--get-regexp get values for regexp: name-regex [value-regex]
--get-urlmatch get value specific for the URL: section[.var] URL
--replace-all replace all matching variables: name value [value_regex]
--add add a new variable: name value
--unset remove a variable: name [value-regex]
--unset-all remove all matches: name [value-regex]
--rename-section rename section: old-name new-name
--remove-section remove a section: name
-l, --list list all
-e, --edit open an editor
--get-color find the color configured: slot [default]
--get-colorbool find the color setting: slot [stdout-is-tty]
Type
-t, --type <> value is given this type
--bool value is "true" or "false"
--int value is decimal number
--bool-or-int value is --bool or --int
--path value is a path (file or directory name)
--expiry-date value is an expiry date
Other
-z, --null terminate values with NUL byte
--name-only show variable names only
--includes respect include directives on lookup
--show-origin show origin of config (file, standard input, blob, command line)
--default <value> with --get, use default value when missing entry
到底什么是 commitid ?
在保存到 Git 之前,所有数据都要进行内容的校验和(checksum)计算,并将此结果作为数据的唯一标识和索引,这也就是我们所说的 commitid。
Git 使用 SHA-1 算法计算数据的校验和,通过对文件的内容或目录的结构计算出一个 SHA-1 哈希值,作为标识字符串。该字符串由40个十六进制字符(0-9 以及 a-f)组成,看起来就是
0782cd519162a6e8c9679b79b61b836fa790d947
所以我们前面提到的 commitid 就是 SHA-1 hash值,反之如果说 Git 中的 SHA 就是 commitid 了, 这个值通过 git log
是可以查看,可视化工具也可查看 SHA
每次操作都需要输入用户名和密码
在~/.gitconfig目录下多出一个文件,用来记录你的密码和帐号
git config --global credential.helper store
再进行一次操作,就可以把用户名密码记录下来啦
入门系列到此收官,希望对阅读者有帮助哦,如果有什么疑问可以进行讨论,共同学习进步
本篇文章来至:学新通
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通
- 本文地址: https://www.swvq.com/boutique/detail/tanejjj
- 联系方式: luke.wu#vfv.cc
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
photoshop默认安装在c盘怎么移动
PHP中文网 03-29 -
word表格分成了上下两块怎么办
PHP中文网 06-17 -
剪切蒙版和图层蒙版的区别是什么意思
PHP中文网 06-17 -
怎么文档的文字转换成4行5列的表格
PHP中文网 06-21 -
表格输入身份证号码后三位显示0怎么办
PHP中文网 06-21 -
photoshop怎么把印章抠出并放在另一张图上
PHP中文网 06-15 -
excel实现一列数据上下翻转
PHP中文网 06-24 -
微信小程序没声音怎么办
PHP中文网 06-15 -
小程序账号密码忘记了怎么
PHP中文网 06-18