Update :20191024
问题:
- 为什么要使用git,有哪些应用
- 是否有过软件项目开发经验
- 是否经常与人合作,共同开发软件
Git 的历史
Wiki的解释:
Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals includes speed, data integrity, and support for distributed, non-linear workflows.
Git 的应用
- 去中心化
- 分布式
- 分支策略
Git的工作区域
- WorkSpace(工作目录)
- Index(暂存区)
- Repository(资源区 - .git)
- Remote(git 的远程仓库)
Git的工作流程
图片来源于网络,仅用于解释Git的工作流程
Git的常用命令
git commit -a
- git-commit : record changes to the repository
- git-pull
- git-push
- git rebase
- git branch
- git merge
- git fetch
远程分支
基于远程分支快速合并
git remote update -p
# git fetch --all -p
git rebase master | origin/master
Git commit questions
Q: Unmerged paths
A: 修改冲突的文件
Q: Untracked files
A: git reset --head HEAD
Git 的面试题
- git push origin master 这个指令在做些什么事情
- git clone, git fetch, git pull 三者的区别
- git 中 head 的是什么
- 合并分支与删除分支 发生了什么事情
- git diff 是做什么用的
- git 中为什么要使用标签
- rebase合并与一般合并有什么不同
- 合并分支发生冲突时, 应该如何解决
- git checkout SHA1, git reset SHA1, git revert SHA1三个指令有什么不同
- 如果不小心把还没有合并的develop分支删掉了,该怎么办
- git reset --hard 指令把档案处理掉了,有机会救回来吗?
Ubuntu Git log 管理工具
More information is :
conventional-changelog
cz-conventional-changelog
A commitizen adapter for the angular preset of https://github.com/conventional-changelog/conventional-changelog
sudo npm install -g commitizen
sudo npm install -g conventional-changelog-cli
sudo npm install -g cz-conventional-changelog
sudo npm install -g conventional-changelog
配置:
echo '{"path": "cz-conventional-changelog"}' > ~/.czrc
oh-my-zsh
alias | command |
---|---|
g | git |
gb | git branch |
gc | git commit -v |
gco | git checkout |
gst | git status |
gst | git status |
gloga | git log --oneline --decorate --graph --all |
glgp | git log --stat -p |
glgg | git log --graph |
参考