Git使用方法
| 注释 | |
|---|---|
| git init | 初始化 |
| git config --global user.name "姓名" | 配置姓名 |
| git config --global user.email "邮箱" | 配置邮箱 |
| git add ./ | 添加到待提交 |
| git commit -m "注释" | 提交修改 |
| git reset --hard head~0 | 回退 |
| git reset --hard 版本号 | 回退到指定版本号 |
| git log | 查看日志 |
| git log --oneline | 查看精简日志 |
| git reflog | 查看以前的所有分支、[版本号] |
| git branch 分支名 | 新建分支 |
| git branch | 查看分支 |
| git checkout 分支名 | 切换分支 |
| git merge 分支名 | 合并分支 |
| git push [地址] 分支名 | 上传到git服务器 |
| git pull [地址] 分支名 | 从git服务器下载 |
| git clone [地址] | 从git服务器克隆所有,会新建文件夹覆盖 |
| git branch -d 分支名 | 删除分支 |
| git status | 查看当前文件状态 |
| git remote add [变量名] [远程地址] | 将远程地址添加到变量 |
| git push/pull -u 分支名 | 和远程服务器分支关联 |
| ssh-keygen -t rsa -C "邮箱" | 生成ssh公钥和私钥 |
git remote -v 查看所有变量
git remote remove origin 删除指定变量
git fetch --prune 删除远端不存在的本地分支
git cherry-pick <hash> <hash> 复制其他分支提交
git cherry-pick <startHash>^..<endHash> 复制其他分支提交

浙公网安备 33010602011771号