GIT
小于 1 分钟
1、git 常用命令
git clone 地址 克隆项目
git status 查看状态
git add . 提交到暂存区
git commit -m '描述' 提交到分支
git push origin xxx 提交远程
git pull origin xxx 从远程拉取代码并合并到本地分支
git checkout -b xxx 创建分支
git checkout xxx 切换分支
git branch 查看分支
git reset --hard '版本号' 回退版本
git log 查看日志
git reflog 查看所有提交的日志
2、git 的工作流程(git 是怎么工作的)
通过git add将工作区的代码提交到暂存区,通过git commit将暂存区的代码提交到自己的分支,git push提交到远程仓库
3、git fetch 和 git pull 的区别
git pull:相当于是从远程获取最新版本并merge到本地。 git fecth + git merge
git fetch:相当于是从远程获取最新版本到本地,不会自动merge。
4、git pull 和 git rebase
git pull:获取远程分支,并更新本地分支。
git rebase:合并分支到当前分支,只存在一个。