git_初识

Git

版本控制的工具git

工做区: 当前工做的地方面试

缓存区 git add 以后存到的地方就叫缓存区shell

版本库 git commit 以后到的地方就叫版本库缓存


git init 初始化

git status 查看状态

git add 添加到缓存区

git commit 提交到版本库

git log 查看提交记录, 

git reflog 查看全部提交记录

git reset head 从缓存区把文件拉去到工做区

git diff 对比的是工做区跟缓存区之间的差异

git diff --cached 对比缓存区跟版本库之间的差异

git checkout -- filename 取消修改的内容

stash

git stash 将当前开发的内容放在'某个地方'
git stash pop 回复当前的工做目录,并删除
git stash list 查看stash 列表
git stash drop 删除
git stash apply 回复当前的工做目录,不删除stash

branch

git branch name 新建分支
git branch 查看分支
git branch -d name 删除分支
git checkout name 切换到哪一个分支
git checkout -b name 建立分支并切换分支

面试题:app

大家公司用什么作版本控制工具

git a版本控制

那如何来管理的code

master 分支用来存放生产环境的代码开发

dev 分支是用来开发使用it

会临时建立bug分支来修复线上的bug,修复完成而后和并到master,删除bug 分支

相关文章
相关标签/搜索