常用配置
常用命令
设定一个配置
# 让Git显示颜色,会让命令输出看起来更醒目
git config --global color.ui true
查看一个配置
git config core.autocrl
区分大小写
项目内设置
- 进入项目文件夹输入
git config core.ignorecase false
命令即可 - 直接修改项目中的
.git/config
文件的ignorecase
也是同样的效果。 - 全局设置
git config --config core.ignorecase false
,全局配置高于项目的配置在当前问题中
修改文件
- 修改完文件名称后需要将该文件的git信息进行更新使用git mv
- 必须讲所有变动的文件都要运行该命令
// 改操作是修改List文件夹名称为list,需要讲文件夹中的所有文件都要运行改命令
// git mv [file] [newfile] // 文件移动和重命名
// git mv -f [file] [newfile] // 文件重命名,且新文件已经存在
git mv -f src/views/List/Home.vue src/views/list/Home.vue
git mv -f src/views/List/About.vue src/views/list/About.vue
常用模板
常见路径:
{用户名}/.gitconfig
[user]
name = CPS
email = holy.dandelion@139.com
[alias]
br = branch
com = commit
ch = checkout
st = status
last = log -1
lg = log -6 --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
germ = merge --no-ff -m
sw = checkout
cm = commit -m
cl = clone --depth=1
load =
[core]
autocrlf = false
quotepath = false
pager = more
compression = -1
# 拒绝/允许/警告 - 提交混合换行符号的文件
safecrlf = true
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
ignorecase = false # 文件名区分大小写
[i18n]
commitencoding = utf-8
[http]
postBuffer = 1048576000
[difftool "sourcetree"]
cmd = '' \"$LOCAL\" \"$REMOTE\"
[mergetool "sourcetree"]
cmd = "'' "
trustExitCode = true