git使用说明
参考官网文档:https://github.com/progit/progit2-zh/releases/download/2.1.62/progit.pdf
# 初始化git项目
$ git init
# 添加文件追踪
$ git add *
# 提交本次更改到本地分支,可以使用 -a 标志来跳过 git add 操作
$ git commit -m 'initial project version'
#配置代理
git config --global -l # 查看git所有配置
git config --global http.proxy 127.0.0.1:7890 # 设置代理
git config --global https.proxy 127.0.0.1:7890 # 设置代理
git config --global --unset http.proxy # 重置代理
git config --global --unset https.proxy # 重置代理
# 查看远程地址配置
git remote -v
#账号配置
git config user.name [name]
git config user.email [email]
git config user.password [password]
# 分支命令
git branch # 查看所有分支,-d 删除分支,-r 查询远程分支
$ git log --oneline # 查看分支当前所指对象
$ git branch testing # 新建 testing 分支
$ git checkout testing # 切换 testing 分支,可以使用 -b 快速新建并跳转分支
$ git log --oneline --decorate --graph --all # 查看分支分叉历史
$ git merge testing # 在当前分支上合并 testing 分支
# 分支合并冲突,冲突文件需要修改冲突代码后,重新add、commit提交,形成新的合并节点
# 回退版本、并提交远程
$ git reset --hard [version SHA]
$ git push -f
# ssh使用 [牛客网ssh配置](https://www.nowcoder.com/discuss/35)
# 检查是否已经有SSH Key
$ cd ~/.ssh
接着输入ls,查看
$ ls
# 生成密钥, 这里的邮箱 gdutxiaoxu@163.com 替换成自己的邮箱
$ ssh-keygen -t rsa -C "gdutxiaoxu@163.com"
# 生成的秘钥默认的存储路径是:C:\Users\Administrator\.ssh
# 添加密钥到ssh-agent
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa
# 把秘钥文本拷贝添加到git网站;