Git常用设置

设置姓名和邮箱

git config --global user.name “”
git config --global user.email “@163.com”

设置代理

国内Git虽然没有屏蔽,但用 git clone 时,网速大部分都在20KiB/s以下,可以设置代理方式加速

命令行执行:

git config --global http.proxy socks5://127.0.0.1:2066

git config --global https.proxy socks5://127.0.0.1:2066

git config --global http.proxy http://127.0.0.1:2067

git config --global https.proxy https://127.0.0.1:2067

设置被写入用户家目录中的.gitconfig文件里

取消代理

git config --global --unset http.proxy

git config --global --unset https.proxy

回滚到之前版本

git log # 查看日志,找到想要回滚的ID
git reset xxx
git stash
git push -f  # 需要加 -f 参数强制push

猜你喜欢

转载自blog.csdn.net/weixin_44064649/article/details/103547670