Git版本控制

Update :20191024


问题:

  1. 为什么要使用git,有哪些应用
  2. 是否有过软件项目开发经验
  3. 是否经常与人合作,共同开发软件

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 的应用

  1. 去中心化
  2. 分布式
  3. 分支策略

Git的工作区域

  1. WorkSpace(工作目录)
  2. Index(暂存区)
  3. Repository(资源区 - .git)
  4. Remote(git 的远程仓库)

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 的面试题

  1. git push origin master 这个指令在做些什么事情
  2. git clone, git fetch, git pull 三者的区别
  3. git 中 head 的是什么
  4. 合并分支与删除分支 发生了什么事情
  5. git diff 是做什么用的
  6. git 中为什么要使用标签
  7. rebase合并与一般合并有什么不同
  8. 合并分支发生冲突时, 应该如何解决
  9. git checkout SHA1, git reset SHA1, git revert SHA1三个指令有什么不同
  10. 如果不小心把还没有合并的develop分支删掉了,该怎么办
  11. 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

oh-my-zsh/wiki/Cheatsheet

aliascommand
ggit
gbgit branch
gcgit commit -v
gcogit checkout
gstgit status
gstgit status
glogagit log --oneline --decorate --graph --all
glgpgit log --stat -p
glgggit log --graph

参考

  1. Git版本控制的原理
  2. git 面试题
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值