git

    清空本地修改, 恢复至服务端最新版本

    1. git checkout . && git clean -xdf
    2. git pull

    设置文件夹内 local git仓库的用户名和邮箱

    git config user.name "Jansora"
    git config user.mail "zhangyue1936@gmail.com"

    git 代理

    git 配置代理

    git config --global http.proxy 'socks5://127.0.0.1:7890'
    git config --global http.proxy 'socks5h://127.0.0.1:7890'
    git config --global https.proxy 'socks5h://127.0.0.1:7890'
    

    git 清除代理

    git config --global --unset http.proxy
    git config --global --unset https.proxy
    

    git 版本回退

    方法1

    git reset --hard dbf5efdb3cd8ea5d576f2e29fe0db1951d0e3e3b
     
    # 强制推送到远程分支, 会抹去远程库的提交信息, 不要这么干
    # git push -f origin master
    

    方法2

    # 回退到指定版本, 需要解决冲突
    git revert e7c8599d29b61579ef31789309b4e691d6d3a83f
     
    # 放弃回退(加--hard会重置已 commit和工作区 的内容)
    # git reset --hard origin/master 
    

    参考资料

    评论栏