Mac生成密钥
- 使用钥匙串生成密钥,会生成公钥和私钥
- 密钥存放位置:
~/.ssh/id_rsa.pub
- 使用终端查看公钥:
cat ~/.ssh/id_rsa.pub
全局配置git账号
git config --global user.name "Your Name"
git config --global user.email your@example.com
开始使用
1.初始化
git init
2.提交
git add -A
3.查看状态
git status
4.提交暂存
git commit -m "说明"
5.查看历史记录
git log
6.创建分支
git checkout master
git checkout -b "分支名"
7.合并分支
git checkout master
git merge 分支名
8.推送
git push
9.如果不小心删除文件,可以使用以下命令进行恢复
git checkout -f
10.还原修改文件到原始状态
git checkout .
git clean -f -d
网友评论