git

工具下载

托管平台

配置

  • git config --global user.name "用户名"
  • git config --global user.email "邮箱"
  • git config --global -l: 查看配置

生成密钥

  • ssh-keygen -t rsa -C “邮箱”

添加私钥到gitee

  • cat ~/.ssh/id_rsa.pub(windows:C:\Users\Administrator.ssh\id_rsa.pub)
  • 进入gitee中心,左侧SSH公钥,右侧添加公钥

操作

   ┌────────┐ add  ┌────────┐ commit ┌─────┐
   │ 工作区  ├────►│ 暂存区  ├───────►│仓库 │
   └────────┘      └────────┘        └─────┘
   untacked         unmodified        

git init: 初始化仓库
git add <filename>: 添加文件到暂存区
git commit -m "message": 提交到本地仓库
git status: 查看状态
git reset <filename>: 将暂存区的文件拉回
git diff: 比较文件不同
git log: 查看历史版本
git branch: 查看分支
git branch <filename>: 新建分支
git checkout <分支>: 切换分支
git reset <版本希哈>: 回退版本
git remote <地址>: 连接地址
git push origin <分支名>: 推送

posted @ 2023-02-21 21:36  小尛M0  阅读(22)  评论(0)    收藏  举报