Git 优化

Git 优化

Gelomen Lv2

优化 Git 的命令和设置, 方便使用

命令别名

1
vi ~/.gitconfig

添加命令别名

.gitconfig
1
2
3
4
5
6
7
8
[alias]
st = status
co = checkout
ci = commit
br = branch
sub = submodule
cp = cherry-pick
tail = log -3

去掉 (END) 提示

有可能会出现输入 git brgit log 后, 列表会出现 (END) 且需要手动输入 q 退出, 执行以下代码即可

1
2
git config --global pager.branch false
git config --global pager.log false

记住用户名和密码

1
git config --global credential.helper store

git diff 去掉 ^M

1
git config --global core.whitespace cr-at-eol

忽略文件权限变化

1
git config --global core.filemode false

git shell 中文文件显示

1
git config --global core.quotepath false

添加代理

http代理

1
2
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080

socks5代理

1
2
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080

取消代理

1
2
git config --global --unset http.proxy
git config --global --unset https.proxy
  • 标题: Git 优化
  • 作者: Gelomen
  • 创建于 : 2024-08-10 18:30:21
  • 更新于 : 2024-08-10 18:30:21
  • 链接: https://gelomen.github.io/posts/git-opt/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论