richardmyu / blog

个人(issues)博客
https://github.com/richardmyu/blog/issues
MIT License
0 stars 0 forks source link

Git 不常用但有用的一些命令 #12

Open richardmyu opened 3 years ago

richardmyu commented 3 years ago

1.撤回跟踪

有些时候项目没来得及先建 .gitignore 文件,可能就上传了一些不需要上传的文件,这是需要撤回对这些文件的跟踪,重新提交:

# 针对文件夹,且不删除本地文件的情况
git rm -r --cache document

# 针对文档,且删除本地文件的情况
git rm --f file
richardmyu commented 2 years ago

2.git 配置

全局配制

# 查看
git config --global --list

# 添加
git config --global core.autocrlf=false

# 编辑
git config --global --edit

# 删除
git config --global --unset core.autocrlf

其他

# 查看所有的配置以及它们所在的文件
git config --list --show-origin