Git常用命令.md

Git常用命令

git 提交

1
2
3
4
5
git clone https://gitee.com/idse666666/bbs.git
git remote -v
git remote rename origin hbq
git commit -m "less test" -a
git push origin hbq_dev:hbq_dev

清除git缓存

1
2
git rm -r --cached .
git add .

Git设置代理

1
2
3
4
5
git config --global http.proxy 'socks://127.0.0.1:1080'
git config --global https.proxy 'socks://127.0.0.1:1080'
git config -l
git config --global --unset http.proxy

Git SSH方式clone

  1. 生成证书,邮箱随意ssh-keygen -t rsa -C "baoqi.hui@qq.com"

  2. 查看公钥cat ~/.ssh/id_rsa.pub

  3. Git平台配置

    image-20221115174736923

git回滚

1
2
3
4
git log
git reset --hard <commit-hash>
#回滚最近
git reset --soft HEAD^