git常用命令
小于 1 分钟
新换了电脑,重新配置了下git,顺便把常用的命令记录一下
鉴权相关
# 邮箱
git config user.email "your_email"
# 用户
git config user.name "your_username"
# 密码存储1: 永久,设置之后,第一次输入,后续自动保存
git config --global credential.helper store
# 密码存储2: 临时,可自定义设置有效期(秒)
git config --global credential.helper 'cache --timeout=31536000'
代理相关
# 代理
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
# 清空代理
git config --global --unset http.proxy
git config --global --unset https.proxy
使用命令
# 清空add
git restore --staged .
# 清空cherry-pick
git cherry-pick --abort