git基础知识
git整体操作流程
[1] 本地仓库

[2] 远程仓库

本地仓库操作流程
-
初始化本地仓库:
git init -
设置签名
git config --global user.namegit config --global user.email -
查看文件的状态:
git status -
工作区文件添加到暂存区:
git add -
暂存区文件提交到本地仓库:
git commit -m -
查看提交日志:
git log --pretty=oneline --abbrev-commit --all --graph查看所有的提交记录(包含已经删除的版本号):
git reflog -
版本回退
回退到上一个版本:
git reset --hard HEAD^回退到指定的版本:
git reset --hard 版本号
![]()
远程仓库操作流程
- 查看远程仓库的别名:
git remote -v - 绑定远程仓库:
git remote add origin https://gitee.com/远程仓库的地址 - 克隆整个项目:
git clone https://gitee.com/远程仓库的地址 - 推送代码到远程仓库:
git push origin master - 拉取最新的代码:
git pull origin master
- 删除已经关联的远程仓库:
git remote rm origin远程仓库的别名 - 配置公钥,免密登录
分支操作
- 查看当前所有的分支:
git branch -v - 新建分支:
git branch 分支的名字 - 切换分支:
git checkout 分支的名字 - 合并分支:
git merge 分支的名字 - 删除分支:
git branch


浙公网安备 33010602011771号