Git
为什么使用 Git
Git 是一款分布式的代码版本控制工具,Linux 之父 Linus 嫌弃当时主流的中心式的版本控制工具太难用还要花钱,就自己开发出了 Git 用来维护 Linux 的版本(给大佬跪了)。
Git 的设计非常优雅,但初学者通常因为很难理解其内部逻辑因此会觉得非常难用。对 Git 不熟悉的初学者很容易出现因为误用命令将代码给控制版本控制没了的状况(好吧是我)。
但相信我,和 Vim 一样,Git 是一款你最终掌握之后会感叹“它值得!”的神器。
如何学习 Git
和 Vim 不同,我不建议初学者在一知半解的情况下贸然使用 Git,因为它的内部逻辑并不能熟能生巧,而是需要花时间去理解。我推荐的学习路线如下:
- 阅读这篇 Git tutorial,视频的话可以看这个尚硅谷Git教程
- 阅读这本开源书籍 Pro Git 的 Chapter1 - Chapter5,是的没错,学 Git 需要读一本书(捂脸)。
- 此时你已经掌握了 Git 的原理和绝大部分用法,接下来就可以在实践中反复巩固 Git 的命令了。但用好它同样是一门哲学,我个人觉得这篇如何写好 Commit Message 的博客非常值得一读。
- 好的此时你已经爱上了 Git,你已经不满足于学会它了,你想自己实现一个 Git!巧了,我当年也有这样的想法,这篇 tutorial 可以满足你!
- 什么?光实现一个 Git 无法满足你?小伙子/小仙女有前途,巧的是我也喜欢造轮子,这两个 GitHub 项目 build-your-own-x 和 project-based-learning 收录了你能想到的各种造轮子教程,比如:自己造个编辑器、自己写个虚拟机、自己写个 docker、自己写个 TCP 等等等等。
Git
Why Git
Git is a distributed version control system. The father of Linux, Linus Torvalds developed Git to maintain the version control of Linux, replacing the centralized version control tools which were difficult and costly to use.
The design of Git is very elegant, but beginners usually find it very difficult to use without understanding its internal logic. It is very easy to mess up the version history if misusing the commands.
Git is a powerful tool and when you finally master it, you will find all the effort paid off.
How to learn Git
Different from Vim, I don't suggest beginners use Git rashly without fully understanding it, because its inner logic can not be acquainted by practicing. Here is my recommended learning path:
- Read this Git tutorial in English, or you can watch this Git tutorial (by 尚硅谷) in Chinese.
- Read Chap1 - Chap5 of this open source book Pro Git. Yes, to learn Git, you need to read a book.
- Now that you have understood its principles and most of its usages, it's time to consolidate those commands by practicing. How to use Git properly is a kind of philosophy. I recommend reading this blog How to Write a Git Commit Message.
- You are now in love with Git and are not content with only using it, you want to build a Git by yourself! Great, that's exactly what I was thinking. This tutorial will satisfy you!
- What? Building your own Git is not enough? Seems that you are also passionate about reinventing the wheels. These two GitHub projects, build-your-own-x and project-based-learning, collected many wheel-reinventing tutorials, e.g., text editor, virtual machine, docker, TCP and so on.